简体   繁体   中英

Uniquely identify SSL Handshake in iOS app

According to https://stackoverflow.com/a/13373392/5945317 , the NSURLConnectionDelegate method

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

identifies an SSL handshake.

  1. is this the only method that gets called during an SSL handshake?
  2. is this method called reliably on every SSL handshake (ie no false negatives)
  3. is this method only called during SSL handshake (ie no false positives)

Esp. regarding 3), I was surprised to see that it actually gets called again after about 2min, not as specified in other places (see link above) after 10mins.

Thanks guys!

After looking at the network layer and using simulator, i can report so much:

  1. is this method called reliably on every SSL handshake (ie no false negatives)

it is only called on full handshakes ( https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_handshake ), not resumed handshakes ( https://en.wikipedia.org/wiki/Transport_Layer_Security#Resumed_TLS_handshake )

  1. is this method only called during SSL handshake (ie no false positives)

empirically speaking, yes. Of course, i cannot guarantee it, but it seems very certain. The reason for it being called more often than expected was due to different endpoints (several IPs for the same domain, all starting its own TLS session).

  1. I'm not sure what you mean by "only," but it is the NSURLConnectionDelegate method that is called at that point

  2. As Thomas noted, no.

  3. No. It is called any time there is a authentication challenge. For example, for BasicAuth.

Note that NSURLSession is strongly recommended in current code over NSURLConnection . (I believe all of NSURLConnection is now deprecated, though I haven't checked.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM