I'm trying to use libcurl and I came across this example.
I've tried to use it for one CA and it worked, but when I tried to add another cert by concatenating it to the first one e.g.:
char *mypem =
"-----BEGIN CERTIFICATE-----\n"
"ZXXDdzCCAl+gAwXBAgXEAgXAuTANBgkqXkXG4w0BAQUQADBaZQswCQYDVQQGEwJJRTESZBAGA1UE\n"
/* More here */
"RCwBXbsdtTLSR4X4LtD+gdwyaX614jzV/OeBXRnDJELqYzZp\n"
"-----END CERTIFICATE-----\n"
"-----BEGIN CERTIFICATE-----\n"
"ZXXQnjCCA4agAwXBAgXJANDnLO8E50QXZA0GCSqGSXb3DQEBCwUAZQsxCzAJBgNV\n"
"BAYTAlVTZQswCQYDVQQXDAJVUzEQZA4GA1UECgwXVXVybXAxZDETZBEGA1UECwwK\n"
/* More here */
"YuyZZLPBYprPZbcaEbyYnwgU2zWXNbRQrsBgOrsXULKQlKsT4T+w0ccjZsQtO+XO\n"
"Bkg=\n"
"-----END CERTIFICATE-----";
It seems to work only for the first one.
Doesn't this variable mimic a PEM file ?
Do I need to define them separately and execute the logic for each?
Is it enough to do it once on the first run of the sslctx_function
callback or should this be done for every request ?
rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function);