I'm attempting (for a niche internal use only, it doesn't need to appear on the App Store and I'm aware there's no way this would pass their checks!) to ignore SSL certificate dates within a WKWebView
I'm completely new to Swift, but not to iOS development, and this is very much a 'solve a problem quickly' rather than a properly designed app.
The Info.plist has Allow Arbitrary Loads in Web Content
and Allow Arbitrary Loads
both set in the ATS Settings and I found this block of code here https://developer.apple.com/forums/thread/15610
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
guard let serverTrust = challenge.protectionSpace.serverTrust else { return completionHandler(.useCredential, nil) }
let exceptions = SecTrustCopyExceptions(serverTrust)
SecTrustSetExceptions(serverTrust, exceptions)
completionHandler(.useCredential, URLCredential(trust: serverTrust))
}
Which works as expected for trusting a self-signed certificate, but if the certificate isn't yet valid or has expired it doesn't work.
Is there a way to completely ignore the certificate issue and expiry date?