1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_SSLKEY_BLOB
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_SSLKEY (3)
9  - CURLOPT_SSLKEYTYPE (3)
10  - CURLOPT_SSLKEY_BLOB (3)
11---
12
13# NAME
14
15CURLOPT_PROXY_SSLKEY_BLOB - private key for proxy cert from memory blob
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY_BLOB,
23                          struct curl_blob *blob);
24~~~
25
26# DESCRIPTION
27
28Pass a pointer to a curl_blob structure that contains information (pointer and
29size) about the private key for connecting to the HTTPS proxy. Compatible with
30OpenSSL. The format (like "PEM") must be specified with
31CURLOPT_PROXY_SSLKEYTYPE(3).
32
33If the blob is initialized with the flags member of struct curl_blob set to
34CURL_BLOB_COPY, the application does not have to keep the buffer around after
35setting this.
36
37# DEFAULT
38
39NULL
40
41# PROTOCOLS
42
43All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
44
45# EXAMPLE
46
47~~~c
48
49extern char *certificateData; /* point to data */
50extern size_t filesize; /* size of data */
51
52extern char *privateKeyData; /* point to data */
53extern size_t privateKeySize; /* size */
54
55int main(void)
56{
57  CURL *curl = curl_easy_init();
58  if(curl) {
59    CURLcode res;
60    struct curl_blob blob;
61    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
62    curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
63    blob.data = certificateData;
64    blob.len = filesize;
65    blob.flags = CURL_BLOB_COPY;
66    curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
67    curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
68
69    blob.data = privateKeyData;
70    blob.len = privateKeySize;
71    curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY_BLOB, &blob);
72    curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
73    res = curl_easy_perform(curl);
74    curl_easy_cleanup(curl);
75  }
76}
77~~~
78
79# AVAILABILITY
80
81Added in 7.71.0. This option is supported by the OpenSSL backends.
82
83# RETURN VALUE
84
85Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
86CURLE_OUT_OF_MEMORY if there was insufficient heap space.
87