Retrieve SSL certificate fields in the didReceiveAuthenticationChallenge

佐手、 提交于 2019-12-13 16:13:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!