iOS - Load client certificate from local storage
This commit is contained in:
parent
0a49c7094f
commit
23d57ed807
|
@ -1993,21 +1993,19 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
let certificatePath = response.certificatePath
|
let certificatePath = response.certificatePath
|
||||||
let certificatePassword = response.certificatePassword ?? "";
|
let certificatePassword = response.certificatePassword ?? "";
|
||||||
|
|
||||||
|
var path: String = certificatePath
|
||||||
do {
|
do {
|
||||||
let path = try Util.getAbsPathAsset(assetFilePath: certificatePath)
|
path = try Util.getAbsPathAsset(assetFilePath: certificatePath)
|
||||||
let PKCS12Data = NSData(contentsOfFile: path)!
|
} catch {}
|
||||||
|
|
||||||
if let identityAndTrust: IdentityAndTrust = self.extractIdentity(PKCS12Data: PKCS12Data, password: certificatePassword) {
|
if let PKCS12Data = NSData(contentsOfFile: path),
|
||||||
let urlCredential: URLCredential = URLCredential(
|
let identityAndTrust: IdentityAndTrust = self.extractIdentity(PKCS12Data: PKCS12Data, password: certificatePassword) {
|
||||||
identity: identityAndTrust.identityRef,
|
let urlCredential: URLCredential = URLCredential(
|
||||||
certificates: identityAndTrust.certArray as? [AnyObject],
|
identity: identityAndTrust.identityRef,
|
||||||
persistence: URLCredential.Persistence.forSession);
|
certificates: identityAndTrust.certArray as? [AnyObject],
|
||||||
completionHandler(.useCredential, urlCredential)
|
persistence: URLCredential.Persistence.forSession);
|
||||||
} else {
|
completionHandler(.useCredential, urlCredential)
|
||||||
completionHandler(.performDefaultHandling, nil)
|
} else {
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
print(error.localizedDescription)
|
|
||||||
completionHandler(.performDefaultHandling, nil)
|
completionHandler(.performDefaultHandling, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue