You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
curl_easy_setopt with CURLOPT_SSLCERT_BLOB seems not to work. #6816
So while it shows clearly for us in l our log above, the length is > 6000 for the PEM, but at point of PEM_read_bio_PrivateKey, the length is zero! And Openssl can't find the --- BEGIN in the PEM.
I added logging for the created BIO object and it has the size:
if(ssl_cert || ssl_cert_blob || ssl_cert_type) {
BIO *ssl_cert_bio = NULL;
BIO *ssl_key_bio = NULL;
if(ssl_cert_blob) {
/* the typecast of blob->len is fine since it is guaranteed to never be
larger than CURL_MAX_INPUT_LENGTH */
ssl_cert_bio = BIO_new_mem_buf(ssl_cert_blob->data,
(int)ssl_cert_blob->len);
if(!ssl_cert_bio)
result = CURLE_OUT_OF_MEMORY;
{
BUF_MEM *bptr = NULL;
BIO_get_mem_ptr(ssl_cert_bio, &bptr);
fprintf(stderr, "ssl_cert_bio: %p %d\n", bptr->data, (int) bptr->length );
}
Seems like some of the BIO taking functions read the content of the BIO, so you can't reuse it.
So I put cloning in for those BIO with BIO_new_mem_buf.
Activity
MonkeybreadSoftware commentedon Mar 31, 2021
We pass PEM data with the option and I can verify it got 6000 bytes and a non NULL pointer in curl_blob.
flags = CURL_BLOB_COPY
PS: Bug is also in 7.75.0.
MonkeybreadSoftware commentedon Mar 31, 2021
I put some debug code in SSL_CTX_use_PrivateKey_bio:
and the output is:
So while it shows clearly for us in l our log above, the length is > 6000 for the PEM, but at point of PEM_read_bio_PrivateKey, the length is zero! And Openssl can't find the --- BEGIN in the PEM.
MonkeybreadSoftware commentedon Mar 31, 2021
I added logging for the created BIO object and it has the size:
So somewhere between that and the later point the length is lost, and internal pointer changes!
MonkeybreadSoftware commentedon Mar 31, 2021
Seems like some of the BIO taking functions read the content of the BIO, so you can't reuse it.
So I put cloning in for those BIO with BIO_new_mem_buf.
MonkeybreadSoftware commentedon Mar 31, 2021
I made a pull request with fixes:
#6817
Fix CURLOPT_SSLCERT_BLOB without CURLOPT_SSLCERT_KEY