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 19Added-in: 7.9.3 20--- 21 22# NAME 23 24CURLOPT_SSLCERTTYPE - type of client SSL certificate 25 26# SYNOPSIS 27 28~~~c 29#include <curl/curl.h> 30 31CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERTTYPE, char *type); 32~~~ 33 34# DESCRIPTION 35 36Pass a pointer to a null-terminated string as parameter. The string should be 37the format of your certificate. 38 39Supported formats are "PEM" and "DER", except with Secure Transport or 40Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or 41later, or macOS 10.7 or later) and Schannel support "P12" for PKCS#12-encoded 42files. GnuTLS supports P12 starting with curl 8.11.0. 43 44The application does not have to keep the string around after setting this 45option. 46 47Using this option multiple times makes the last set string override the 48previous ones. Set it to NULL restores back to internal default. 49 50# DEFAULT 51 52"PEM" 53 54# %PROTOCOLS% 55 56# EXAMPLE 57 58~~~c 59int main(void) 60{ 61 CURL *curl = curl_easy_init(); 62 if(curl) { 63 CURLcode res; 64 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 65 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 66 curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM"); 67 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 68 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret"); 69 res = curl_easy_perform(curl); 70 curl_easy_cleanup(curl); 71 } 72} 73~~~ 74 75# %AVAILABILITY% 76 77# RETURN VALUE 78 79Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or 80CURLE_OUT_OF_MEMORY if there was insufficient heap space. 81