diff options
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/curl_darwinssl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/vtls/curl_darwinssl.c b/lib/vtls/curl_darwinssl.c index 9ba287d0e..372635747 100644 --- a/lib/vtls/curl_darwinssl.c +++ b/lib/vtls/curl_darwinssl.c @@ -1671,6 +1671,16 @@ static int append_cert_to_array(struct SessionHandle *data, return CURLE_SSL_CACERT; } + /* Check if cacert is valid. */ + SecKeyRef key; + OSStatus ret = SecCertificateCopyPublicKey(cacert, &key); + if(ret != noErr) { + CFRelease(cacert); + failf(data, "SSL: invalid CA certificate"); + return CURLE_SSL_CACERT; + } + CFRelease(key); + CFArrayAppendValue(array, cacert); CFRelease(cacert); |