Fixes SecTrustCreateWithCertificates expecting an array as first argument.
This commit is contained in:
parent
a0f1f83a2b
commit
8b2d01a503
1 changed files with 61 additions and 56 deletions
|
|
@ -553,13 +553,18 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe
|
||||||
if (self.SSLPinningMode == AFSSLPinningModeCertificate) {
|
if (self.SSLPinningMode == AFSSLPinningModeCertificate) {
|
||||||
[trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];
|
[trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];
|
||||||
} else if (self.SSLPinningMode == AFSSLPinningModePublicKey) {
|
} else if (self.SSLPinningMode == AFSSLPinningModePublicKey) {
|
||||||
|
SecCertificateRef someCertificates[] = {certificate};
|
||||||
|
CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL);
|
||||||
|
|
||||||
SecTrustRef trust = NULL;
|
SecTrustRef trust = NULL;
|
||||||
OSStatus status = SecTrustCreateWithCertificates(certificate, policy, &trust);
|
|
||||||
|
OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &trust);
|
||||||
NSAssert(status == noErr, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
NSAssert(status == noErr, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
||||||
|
|
||||||
[trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
|
[trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
|
||||||
|
|
||||||
CFRelease(trust);
|
CFRelease(trust);
|
||||||
|
CFRelease(certificates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue