I have a successful SOAP request in SOAPUI that I'm trying to convert into R code with the httr
package. In SOAPUI, all I have to do for SSL settings is provide a file path that points to a PKCS#12 file for the KeyStore, and then provide a plain text password for the PKCS#12 file as the KeyStore Password. With this setup, everything works fine.
In R, since httr
uses curl
, it is my understanding that I need to extract the client SSL cert and SSL key as two .pem
files from the bundled PKCS#12 file. So I extracted them with the following OpenSSL commands:
openssl pkcs12 -in "path to .p12 file" -passin pass:******** -clcerts -nokeys -out "path to new cert.pem"
openssl pkcs12 -in "path to .p12 file" -passin pass:******** -nodes -nocerts -out "path to new key.pem"
Then, within my httr::POST
request, I've included this config
option to point to the .pem
files so the curl handle can be properly defined (I've only temporarily set ssl_verifypeer = F
so I could eliminate the possibility of getting an error due to the CA bundle):
config(ssl_verifypeer = F, sslcert = "path to new cert.pem", sslkey = "path to new key.pem")
However, whenever I run the httr::POST
request I get the following error:
Error in curl::curl_fetch_memory(url, handle = handle) :
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs
when a fatal SSL/TLS alert is received (e.g. handshake failed). More detail may be available in the Windows
System event log.
I don't know what mistake I'm making here but I have been struggling with it for weeks. Any help here would be a lifesaver.