jasonacox / Build-OpenSSL-cURL

Scripts to build OpenSSL, HTTP/2 (nghttp2) and cURL (libcurl) for MacOS, iOS and tvOS devices (x86_64, armv7, armv7s, arm64, arm64e). Now Supporting Apple Silicon, OpenSSL 3.0.x with TLS 1.3 and Mac Catalyst builds.
MIT License
419 stars 125 forks source link

cURL fails when trying to connect to HTTPS on tvOS #19

Closed SeanAsby closed 6 years ago

SeanAsby commented 6 years ago

I built the libraries using build.sh in the root folder. When trying to connect to an HTTPS endpoint I get the following error from cURL: SSL certificate problem: unable to get local issuer certificate.

Is this a known issue? Do I need to enable some additional options when building?

I have also checked that the root certificate is preinstalled on tvOS. https://support.apple.com/en-us/HT207232

jasonacox commented 6 years ago

It is looking for root certs and doesn't use the tvOS installed certs. You can add them to your project: https://curl.haxx.se/ca/cacert.pem

Then add them with something like this:

 NSString *cacertPath = [[NSBundle mainBundle] pathForResource:@"cacert" ofType:@"pem"];
 curl_easy_setopt(_curl, CURLOPT_CAINFO, [cacertPath UTF8String]); // set root CA certs
SeanAsby commented 6 years ago

That's what I ended up doing and it works. Thanks