Reputation: 434
I'm using AFNetworking UIWebView category and I was wondering if there is any way to load a url with certificate pinning check.
Best Regards, fnxpt
Upvotes: 3
Views: 2121
Reputation: 642
UIWebView
does not expose any direct API to that, but it can still be implemented using NSURLProtocol
, which gives you the ability to validate the certificate of all outgoing network requests. It does take a lot of work though, and a better solution is to use WKWebView
, which provides an explicit way of doing pinning via the WKNavigationDelegate
's webView:didReceiveAuthenticationChallenge:completionHandler:
.
There are more details in the "Pinning in Webviews" section of this article: https://datatheorem.github.io/TrustKit/getting-started.html and it's also a library for implement public key pinning in iOS Apps.
Upvotes: 2