blob: 54c5cb0a0c5d54152a56105060b6ef791a999fa8 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
2SPDX-License-Identifier: curl
3Short: E
4Long: cert
5Arg: <certificate[:password]>
6Help: Client certificate file and password
7Protocols: TLS
8See-also: cert-type key key-type
9Category: tls
10Example: --cert certfile --key keyfile $URL
11Added: 5.0
12Multi: single
13---
14Tells curl to use the specified client certificate file when getting a file
15with HTTPS, FTPS or another SSL-based protocol. The certificate must be in
16PKCS#12 format if using Secure Transport, or PEM format if using any other
17engine. If the optional password is not specified, it will be queried for on
18the terminal. Note that this option assumes a certificate file that is the
19private key and the client certificate concatenated. See --cert and --key to
20specify them independently.
21
22In the <certificate> portion of the argument, you must escape the character ":"
23as "\\:" so that it is not recognized as the password delimiter. Similarly, you
24must escape the character "\\" as "\\\\" so that it is not recognized as an
25escape character.
26
27If curl is built against the NSS SSL library then this option can tell
28curl the nickname of the certificate to use within the NSS database defined
29by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the
30NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be
31loaded.
32
33If you provide a path relative to the current directory, you must prefix the
34path with "./" in order to avoid confusion with an NSS database nickname.
35
36If curl is built against OpenSSL library, and the engine pkcs11 is available,
37then a PKCS#11 URI (RFC 7512) can be used to specify a certificate located in
38a PKCS#11 device. A string beginning with "pkcs11:" will be interpreted as a
39PKCS#11 URI. If a PKCS#11 URI is provided, then the --engine option will be set
40as "pkcs11" if none was provided and the --cert-type option will be set as
41"ENG" if none was provided.
42
43(iOS and macOS only) If curl is built against Secure Transport, then the
44certificate string can either be the name of a certificate/private key in the
45system or user keychain, or the path to a PKCS#12-encoded certificate and
46private key. If you want to use a file from the current directory, please
47precede it with "./" prefix, in order to avoid confusion with a nickname.
48
49(Schannel only) Client certificates must be specified by a path
50expression to a certificate store. (Loading PFX is not supported; you can
51import it to a store first). You can use
52"<store location>\\<store name>\\<thumbprint>" to refer to a certificate
53in the system certificates store, for example,
54"CurrentUser\\MY\\934a7ac6f8a5d579285a74fa61e19f23ddfe8d7a". Thumbprint is
55usually a SHA-1 hex string which you can see in certificate details. Following
56store locations are supported: CurrentUser, LocalMachine, CurrentService,
57Services, CurrentUserGroupPolicy, LocalMachineGroupPolicy,
58LocalMachineEnterprise.