Created
September 2, 2019 18:11
-
-
Save NSProgrammer/fc7665f84d05573d4d93312463f57233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static OSStatus WrapperSecTrustEvaluate(SecTrustRef serverTrust, SecTrustResultType *result) | |
{ | |
if (@available(iOS 13, *)) { | |
// SecTrustEvaluate is deprecated. | |
// Wrap new API to have same calling pattern as we had prior to deprecation. | |
// 1) call the new function to execut the evaluation | |
CFErrorRef error = NULL; | |
const bool evaluationSucceeded = SecTrustEvaluateWithError(serverTrust, &error); | |
// 2) We don't actually care about the evaluation here, since we will get the result and key off that. | |
if (!evaluationSucceeded) { | |
CFRelease(error); | |
} | |
// 3) call the "get trust result" to yield the result just like the old function | |
return SecTrustGetTrustResult(serverTrust, result); | |
} else { | |
return SecTrustEvaluate(serverTrust, result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment