Suppose I'm connecting to HTTPS server with self-signed certificate using NSURLConnection. I (really) want to do the following weird things: compare a certificate byte by byte with my local copy and check if the IP address of the server hostname is the same as my local copy. The reason I want to do that is a conclusion of the original problem: kSecTrustResultRecoverableTrustFailure when connecting to https with self-signed certificate using NSURLConnection
Right now I don't understand how to
- Retrieve server's certificate I've got on the current connection
- Get the IP address of the server I'm connected to
I didn't find any working example and any mention in the documentation of how to do that. Is that possible to resolve these problems using NSURLConnection and related C/Objective-C stuff?
I guess if both problems can't be resolved normally—they can be workarounded by custom IP address resolving and custom certificate downloading (using openssl library, for example). But that sounds terrible/nonsense to me because that will be completely different connections, not the current one I'm making with NSURLConnection.