Question

For some legacy and internal reasons, I need to retrieve the certificate of the server (and ones from the chain as well), and read its fingerprint.

I understand this is easy to implement using AFNetworking or NSURLConnection since I only need to implement it in

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

But is it possible to do the same thing when using ASIHTTPRequest, which is just just basically a wrapper of CFNetworking?

Once again, I don't have a client certificate and my goal is to get the certificate from the server to read its fingerprint of issuer.

I will need to validate the fingerprint of server certificate in client and continue the request if it matches the one I expected, or cancel the request / throw error otherwise. Is this possible using ASIHTTPRequest?

Était-ce utile?

La solution

I verified that there's no way to do this using CFNetworking (what ASIHTTPRequest is using), see https://devforums.apple.com/thread/87346. For those who don't have ios Developers account (I am not sure why you are reading this though), "No. After thinking about this in depth I don't think it's possible. NSURLConnection, which does this, use a private hook into CFHTTPStream, and you won't be able to use that."

Btw, we rewrote our network layer using NSURLConnection and solved this problem

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top