I've been trying to use Alamofire to pin a PEM certificate using these methods:
I've also tried using AFNetworking
:
NSData *certificateData = [NSData dataWithContentsOfFile:certificatePath];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certificateData);
NSArray *arr = [[NSArray alloc] initWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(cert), nil];
[securityPolicy setPinnedCertificates:arr];
Most of the time I will get -999 and -1012 errors. When running a curl command, it works as it should. However, it does not seem to work when converting the PEM certificate to a DER format.