I'm having problems with reading a API with a pkcs12 certificate. I can read the certificate with openssl
, but I can't figure out how to pass the certificate to the GET command.
library(openssl)
library(httr)
pkcs12_name <- "path_to_certificate.p12"
pkcs12_pwd <- "password"
url <- "theAPIURL"
cert <- read_p12(pkcs12_name,pkcs12_pwd)
This works fine, but the following GET
doesn't work:
GET(url1,config(cainfo=cert$ca,sslcert=cert$cert,sslkey=cert$key))
Error in curl::handle_setopt(handle, .list = req$options) :
Value for option cainfo (10065) must be a string or raw vector.
cert$ca
is a list with two elements. If I just take cert$ca[[1]]
or cert$ca[[2]]
I get
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the local SSL certificate
Any suggestions?