Check CA certificate in curl_darwinssl.c.
SecCertificateCreateWithData() returns a non-NULL SecCertificateRef even if the buffer holds an invalid or corrupt certificate. Call SecCertificateCopyPublicKey() to make sure cacert is a valid certificate.
This commit is contained in:
parent
4c134bcfce
commit
0426670f0a
@ -1671,6 +1671,16 @@ static int append_cert_to_array(struct SessionHandle *data,
|
|||||||
return CURLE_SSL_CACERT;
|
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);
|
CFArrayAppendValue(array, cacert);
|
||||||
CFRelease(cacert);
|
CFRelease(cacert);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user