1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SSLCERTTYPE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_SSLCERT (3)
9  - CURLOPT_SSLKEY (3)
10Protocol:
11  - TLS
12TLS-backend:
13  - OpenSSL
14  - GnuTLS
15  - mbedTLS
16  - Schannel
17  - Secure Transport
18  - wolfSSL
19---
20
21# NAME
22
23CURLOPT_SSLCERTTYPE - type of client SSL certificate
24
25# SYNOPSIS
26
27~~~c
28#include <curl/curl.h>
29
30CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERTTYPE, char *type);
31~~~
32
33# DESCRIPTION
34
35Pass a pointer to a null-terminated string as parameter. The string should be
36the format of your certificate.
37
38Supported formats are "PEM" and "DER", except with Secure Transport or
39Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or
40later, or OS X 10.7 or later) and Schannel support "P12" for PKCS#12-encoded
41files.
42
43The application does not have to keep the string around after setting this
44option.
45
46# DEFAULT
47
48"PEM"
49
50# EXAMPLE
51
52~~~c
53int main(void)
54{
55  CURL *curl = curl_easy_init();
56  if(curl) {
57    CURLcode res;
58    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
59    curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
60    curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
61    curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
62    curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
63    res = curl_easy_perform(curl);
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71If built TLS enabled. Added in 7.9.3
72
73# RETURN VALUE
74
75Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or
76CURLE_OUT_OF_MEMORY if there was insufficient heap space.
77