How do I display a list of pfx digital identidy from iOS --> Settings.
From inside your app? In general you can’t. QA1745 Making Certificates and Keys Available To Your App explains the background to this.
If i were to open the app using Mobile safari browser it will prompt me to choose the client certificate, i want to achieve the similar using WKWebView.
WKWebView will pass you authentication challenges via the
-webView:didReceiveAuthenticationChallenge:completionHandler:
navigation delegate callback and, in general, you can handle authentication by responding to those challenges. However, this does not work in the case of client identity authentication challenges (
NSURLAuthenticationMethodClientCertificate
). You get the authentication challenge but, when you respond, the response is ineffective. We’re tracking this issue as a bug (r. 22659960).
The only workaround is to use UIWebView with a custom NSURLProtocol subclass, as illustrated by the CustomHTTPProtocol sample code. There are, however, multiple drawbacks:
It’s a bit of a hack.
It’s a bunch of complex code.
WKWebView is the modern replacement for UIWebView, so using UIWebView seems like a backward step.
In addition, you still have the problem I discussed above, namely, getting the required identities into your app’s ‘slice’ of the keychain.
In addition i have tried to use SafariViewController, this has an unexpected behavior.
In contrast to WKWebView, SafariViewController is meant to act Just Like Safari™. As such, it does have access to the Apple ‘slice’ of the keychain. And it sounds like that works, modulo a restart or two (-;
With regards the requirement to restart, IMO that’s a bug and you should file it as such. Please post your bug number, just for the record.
All other things being equal, I think you’d be better off doing this via SafariViewController, and living with the restart issue, than trying to use the UIWebView hackaround.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"