问题
Our application communicates with server over HTTPS. We want to re-verify the SSL certificate fields on the client side. e.g. I want to verify the CN field of the SSL certificate issues from the server during HTTPS connection. Is there way to retrieve fields information in the didReceiveAuthenticationChallenge()
?
回答1:
As a refresher of how the steps of SSL are performed can be found here http://www.symantec.com/theme.jsp?themeid=how-ssl-works
@Ramesh
(for the function used, please have a look here https://developer.apple.com/library/ios/#documentation/security/Reference/certifkeytrustservices/Reference/reference.html
proceed like this
- SecTrustRef tR = [[challenge protectionSpace] serverTrust];
- call SecTrustEvaluate()
- call SecTrustGetCertificateAtIndex() with index 0 then you can use OpenSSL to do any further validation
来源:https://stackoverflow.com/questions/9784251/retrieve-ssl-certificate-fields-in-the-didreceiveauthenticationchallenge