drogonframework / drogonframework/drogon

Passing PEM file and KEY file content instead of file path

Open
#1,093 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

This is related to #1083 and https://github.com/drogonframework/drogon/pull/1090/files

curl has BLOB options of SSLCERT and SSLKEY. It means instead of providing file path of the cert and key file, it is possible to pass file contents.
For example I keep cert and pv key files in configuration server not in the web server directly. So I am reading content of the cert and key file so I need to use
curl_easy_setopt(curl_ptr, CURLOPT_SSLCERT_BLOB,....
instead of
curl_easy_setopt(curl_ptr, CURLOPT_SSLCERT,...

and it is same for CURLOPT_SSLKEY. Can we add this option as well? below there is a sample with curl library.

struct curl_blob blob_cert_file;
struct curl_blob blob_pv_key;
curl_easy_setopt(this->curl_ptr, CURLOPT_SSLCERTTYPE, "PEM");
/* set the cert for client authentication */
blob_cert_file.data = const_cast(cert_file_content.c_str());
blob_cert_file.len = cert_file.length();
blob_cert_file.flags = CURL_BLOB_COPY;
curl_easy_setopt(curl_ptr, CURLOPT_SSLCERT_BLOB, blob_cert_file);
/* set the private key (file or ID in engine) */
blob_pv_key.data = const_cast(pv_key_file_content.c_str());
blob_pv_key.len = pv_key_file.length();
blob_pv_key.flags = CURL_BLOB_COPY;
curl_easy_setopt(curl_ptr, CURLOPT_SSLKEY_BLOB, blob_pv_key);

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.