Hi,
I am implementing an NSURLProtocol subclass, that really handles its own protocol using NSInputStream/NSOutputStream instances inside. It's not just wrapping HTTP. Additionally, I need to cope with self-signed certificates. So I have the serverTrust object at hand, resulting from the TLS handshake done for me by NSStream. Now I would like to call [NSURLProtocolClient URLProtocol:didReceiveAuthenticationChallenge:] from "inside" the NSURLSession machinery such that the NSURLSessionDelegate implementation "outside" can do the certificate- / public-key-pinning as we all know and love from HTTPS connections using NSURLSession.
Alas, there is no [NSURLProtectionSpace initWithServerTrust:] 😟
At the end I want the NSURLSessionDelegate to do the [challenge.protectionSpace serverTrust] boogie, but that seems to be impossible when using NSURLSession subclasses. What am I missing?
Thanks!