Merge branch 'master' into invalid-ssl
This commit is contained in:
commit
22d6747b74
1 changed files with 6 additions and 6 deletions
|
|
@ -208,7 +208,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
|
|
||||||
for (NSData *data in pinnedCertificates) {
|
for (NSData *data in pinnedCertificates) {
|
||||||
SecCertificateRef allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)data);
|
SecCertificateRef allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)data);
|
||||||
NSCParameterAssert(allowedCertificate);
|
NSParameterAssert(allowedCertificate);
|
||||||
|
|
||||||
SecCertificateRef allowedCertificates[] = {allowedCertificate};
|
SecCertificateRef allowedCertificates[] = {allowedCertificate};
|
||||||
CFArrayRef certificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL);
|
CFArrayRef certificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL);
|
||||||
|
|
@ -216,14 +216,14 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
SecPolicyRef policy = SecPolicyCreateBasicX509();
|
SecPolicyRef policy = SecPolicyCreateBasicX509();
|
||||||
SecTrustRef allowedTrust = NULL;
|
SecTrustRef allowedTrust = NULL;
|
||||||
OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &allowedTrust);
|
OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &allowedTrust);
|
||||||
NSAssert(status == noErr, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
NSAssert(status == errSecSuccess, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
||||||
|
|
||||||
SecTrustResultType result = 0;
|
SecTrustResultType result = 0;
|
||||||
status = SecTrustEvaluate(allowedTrust, &result);
|
status = SecTrustEvaluate(allowedTrust, &result);
|
||||||
NSAssert(status == noErr, @"SecTrustEvaluate error: %ld", (long int)status);
|
NSAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status);
|
||||||
|
|
||||||
SecKeyRef allowedPublicKey = SecTrustCopyPublicKey(allowedTrust);
|
SecKeyRef allowedPublicKey = SecTrustCopyPublicKey(allowedTrust);
|
||||||
NSCParameterAssert(allowedPublicKey);
|
NSParameterAssert(allowedPublicKey);
|
||||||
[publicKeys addObject:(__bridge_transfer id)allowedPublicKey];
|
[publicKeys addObject:(__bridge_transfer id)allowedPublicKey];
|
||||||
|
|
||||||
CFRelease(allowedTrust);
|
CFRelease(allowedTrust);
|
||||||
|
|
@ -570,11 +570,11 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe
|
||||||
SecTrustRef trust = NULL;
|
SecTrustRef trust = NULL;
|
||||||
|
|
||||||
OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &trust);
|
OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &trust);
|
||||||
NSAssert(status == noErr, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
NSAssert(status == errSecSuccess, @"SecTrustCreateWithCertificates error: %ld", (long int)status);
|
||||||
|
|
||||||
SecTrustResultType result;
|
SecTrustResultType result;
|
||||||
status = SecTrustEvaluate(trust, &result);
|
status = SecTrustEvaluate(trust, &result);
|
||||||
NSAssert(status == noErr, @"SecTrustEvaluate error: %ld", (long int)status);
|
NSAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status);
|
||||||
|
|
||||||
[trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
|
[trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue