JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
660 stars 117 forks source link

SSLCERT_BLOB & SSLKEY_BLOB not working as expected #378

Closed siddtagirisa closed 1 year ago

siddtagirisa commented 1 year ago

Describe the bug

I am trying to do a curl request which has MTLS connection requirement. I am trying to pass the cert and key like below:

curl.setOpt(Curl.option.SSLCERT_BLOB, Buffer.from(options.cert, 'utf-8'));
curl.setOpt(Curl.option.SSLKEY_BLOB, Buffer.from(options.key, 'utf-8'));

Which is not working.

Same thing when tried using curl on command line with --cert and --key options is working.

I tried passing as file as well using SSLCERT and SSLKEY, still same thing, for some reason MTLS is not going through.

Also, I made sure I am passing in unencrypted PEM formatted private key and certificate.

I need help with understanding how to proceed further here. Please let me know if I can help further. Version information:

Version:

Version: libcurl/7.86.0 OpenSSL/1.1.1q zlib/1.2.11 brotli/1.0.9 zstd/1.4.9 libidn2/2.1.1 libssh2/1.10.0 nghttp2/1.47.0
Protocols: dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Features: AsynchDNS, Debug, TrackMemory, IPv6, Largefile, NTLM, NTLM_WB, SSL, libz, brotli, TLS-SRP, HTTP2, UnixSockets, HTTPS-proxy, alt-svc

OS: macOS 12.3.1 Node.js Version: 16.13.0