Guest User

Untitled

a guest
Nov 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (CFDataRef) certificateData);
  2.  
  3. CFArrayRef rootCerts = (CFArrayRef)[client.additionalRootCertificates allObjects];
  4. SecTrustResultType result;
  5. OSStatus returnCode;
  6.  
  7. if (rootCerts && CFArrayGetCount(rootCerts)) {
  8. // this could fail, but the trust evaluation will proceed (it's likely to fail, of course)
  9. SecTrustSetAnchorCertificates(trust, rootCerts);
  10. }
  11.  
  12. returnCode = SecTrustEvaluate(trust, &result);
  13.  
  14. if (returnCode == errSecSuccess) {
  15. proceed = (result == kSecTrustResultProceed || result == kSecTrustResultConfirm || result == kSecTrustResultUnspecified);
  16. if (result == kSecTrustResultRecoverableTrustFailure) {
  17. // TODO: should try to recover here
  18. // call SecTrustGetCssmResult() for more information about the failure
  19. }
  20. }
Add Comment
Please, Sign In to add comment