I am working on a HTTPSClient for iOS. I have a CA Certificate in DER format in my application in order to perform Trust & Evaluation. Unfortunately I am not able to load the certificate with SecCertificateCreateWithData
. My caRef stays nil and I do not get an error message.
(I export my CA certificate from a windows server)
certDataRef always has some bytes.
I also stumbled across Created a certificate using SecCertificateCreateWithData on iOS and iPhone Simulator custom CA certificate . Is it true that iOS requires some certificate attributes/extensions? Or do I just have to run this on a device instead of the simulator?
NSData *derCA = [NSData dataWithContentsOfFile:caDerFilePath];
if (!derCA) {
return nil;
}
CFDataRef certDataRef = (__bridge_retained CFDataRef)derCA;
SecCertificateRef caRef = SecCertificateCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)(derCA));
if (!caRef) {
return nil;
}