0

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 (i.e. no false negatives)
  3. is this method only called during SSL handshake (i.e. 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!

Community
  • 1
  • 1
Thomas Köhn
  • 123
  • 7
  • @rob-napier: Clarification regarding 1.: I was wondering if there is any other method that might indicate an TLS handshake (does not have to be from NSURLConnectionDelegate). With my current knowledge, I will only be able to detect a full TLS handshake, not a resumed one. – Thomas Köhn May 11 '17 at 18:14

2 Answers2

0

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

  1. is this method called reliably on every SSL handshake (i.e. 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 (i.e. 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).

Thomas Köhn
  • 123
  • 7
0
  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.)

Rob Napier
  • 286,113
  • 34
  • 456
  • 610