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