I did this
We are getting an error downloading a page through SSL with libcurl in our iOS app. This only happen when we hit a certain page with a certain certificate, and on Asian locales (simplified Chinese, Japanese).
The error message is "SSL: invalid CA certificate subject", which come from this block of code:
/* Check if cacert is valid. */
CFStringRef subject = CopyCertSubject(cacert);
if(subject) {
char subject_cbuf[128];
memset(subject_cbuf, 0, 128);
if(!CFStringGetCString(subject,
subject_cbuf,
128,
kCFStringEncodingUTF8)) {
CFRelease(cacert);
failf(data, "SSL: invalid CA certificate subject");
return CURLE_SSL_CACERT;
}
If I bump 128 to 256 everywhere in this file, the error goes away.
- Does a certificate subjects needs to be less than 128 bytes in utf-8 ?
- Is it "good enough" to bump that value a little higher to 256. Or maybe to 128 * max number of bytes in a utf-8 char (5 ?) if we only ever expect 128 characters in a subject ?
- Should we make that code work with arbitrary length ?
I expected the following
I should be able to download that page through SSL.
curl/libcurl version
curl-7.54.1
operating system
iOS
I did this
We are getting an error downloading a page through SSL with libcurl in our iOS app. This only happen when we hit a certain page with a certain certificate, and on Asian locales (simplified Chinese, Japanese).
The error message is
"SSL: invalid CA certificate subject", which come from this block of code:If I bump 128 to 256 everywhere in this file, the error goes away.
I expected the following
I should be able to download that page through SSL.
curl/libcurl version
curl-7.54.1
operating system
iOS