xref: /curl/docs/cmdline-opts/key.md (revision 6e494a23)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: key
5Arg: <key>
6Protocols: TLS SSH
7Help: Private key filename
8Category: tls ssh
9Added: 7.9.3
10Multi: single
11See-also:
12  - key-type
13  - cert
14Example:
15  - --cert certificate --key here $URL
16---
17
18# `--key`
19
20Private key filename. Allows you to provide your private key in this separate
21file. For SSH, if not specified, curl tries the following candidates in order:
22`~/.ssh/id_rsa`, `~/.ssh/id_dsa`, `./id_rsa`, `./id_dsa`.
23
24If curl is built against OpenSSL library, and the engine pkcs11 is available,
25then a PKCS#11 URI (RFC 7512) can be used to specify a private key located in
26a PKCS#11 device. A string beginning with `pkcs11:` is interpreted as a
27PKCS#11 URI. If a PKCS#11 URI is provided, then the --engine option is set as
28`pkcs11` if none was provided and the --key-type option is set as `ENG` if
29none was provided.
30
31If curl is built against Secure Transport or Schannel then this option is
32ignored for TLS protocols (HTTPS, etc). Those backends expect the private key
33to be already present in the keychain or PKCS#12 file containing the
34certificate.
35