Additional findings
This commit is contained in:
parent
7c1cd442bb
commit
3b999a310e
|
@ -2190,17 +2190,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IdentityAndTrust {
|
struct IdentityAndTrust {
|
||||||
|
var identityRef: SecIdentity
|
||||||
var identityRef:SecIdentity
|
var trust: SecTrust
|
||||||
var trust:SecTrust
|
var certArray: AnyObject
|
||||||
var certArray:AnyObject
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractIdentity(PKCS12Data:NSData, password: String) -> IdentityAndTrust? {
|
func extractIdentity(PKCS12Data: NSData, password: String) -> IdentityAndTrust? {
|
||||||
var identityAndTrust:IdentityAndTrust?
|
var identityAndTrust: IdentityAndTrust?
|
||||||
var securityError:OSStatus = errSecSuccess
|
var securityError: OSStatus = errSecSuccess
|
||||||
|
|
||||||
var importResult: CFArray? = nil
|
var importResult: CFArray?
|
||||||
securityError = SecPKCS12Import(
|
securityError = SecPKCS12Import(
|
||||||
PKCS12Data as NSData,
|
PKCS12Data as NSData,
|
||||||
[kSecImportExportPassphrase as String: password] as NSDictionary,
|
[kSecImportExportPassphrase as String: password] as NSDictionary,
|
||||||
|
@ -2208,24 +2207,24 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
)
|
)
|
||||||
|
|
||||||
if securityError == errSecSuccess {
|
if securityError == errSecSuccess {
|
||||||
let certItems:CFArray = importResult! as CFArray;
|
let certItems: CFArray = importResult! as CFArray
|
||||||
let certItemsArray:Array = certItems as Array
|
let certItemsArray: Array = certItems as Array
|
||||||
let dict:AnyObject? = certItemsArray.first;
|
let dict: AnyObject? = certItemsArray.first
|
||||||
if let certEntry:Dictionary = dict as? Dictionary<String, AnyObject> {
|
if let certEntry: Dictionary = dict as? Dictionary<String, AnyObject> {
|
||||||
// grab the identity
|
// grab the identity
|
||||||
let identityPointer:AnyObject? = certEntry["identity"];
|
let identityPointer: AnyObject? = certEntry["identity"]
|
||||||
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!
|
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!
|
||||||
// grab the trust
|
// grab the trust
|
||||||
let trustPointer:AnyObject? = certEntry["trust"]
|
let trustPointer: AnyObject? = certEntry["trust"]
|
||||||
let trustRef:SecTrust = trustPointer as! SecTrust
|
let trustRef:SecTrust = trustPointer as! SecTrust
|
||||||
// grab the cert
|
// grab the cert
|
||||||
let chainPointer:AnyObject? = certEntry["chain"]
|
let chainPointer: AnyObject? = certEntry["chain"]
|
||||||
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!)
|
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("Security Error: " + securityError.description)
|
print("Security Error: " + securityError.description)
|
||||||
if #available(iOS 11.3, *) {
|
if #available(iOS 11.3, *) {
|
||||||
print(SecCopyErrorMessageString(securityError,nil) ?? "")
|
print(SecCopyErrorMessageString(securityError, nil) ?? "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return identityAndTrust
|
return identityAndTrust
|
||||||
|
@ -2239,7 +2238,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: okButton, style: UIAlertAction.Style.default) {
|
alertController.addAction(UIAlertAction(title: okButton, style: UIAlertAction.Style.default) {
|
||||||
_ in completionHandler()}
|
_ in completionHandler()}
|
||||||
);
|
)
|
||||||
|
|
||||||
guard let presentingViewController = inAppBrowserDelegate != nil ? inAppBrowserDelegate as? InAppBrowserWebViewController : window?.rootViewController else {
|
guard let presentingViewController = inAppBrowserDelegate != nil ? inAppBrowserDelegate as? InAppBrowserWebViewController : window?.rootViewController else {
|
||||||
completionHandler()
|
completionHandler()
|
||||||
|
@ -2463,16 +2462,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
let disableHorizontalScroll = settings?.disableHorizontalScroll ?? false
|
let disableHorizontalScroll = settings?.disableHorizontalScroll ?? false
|
||||||
if startedByUser {
|
if startedByUser {
|
||||||
if disableVerticalScroll && disableHorizontalScroll {
|
if disableVerticalScroll && disableHorizontalScroll {
|
||||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: lastScrollY);
|
scrollView.contentOffset = CGPoint(x: lastScrollX, y: lastScrollY)
|
||||||
}
|
}
|
||||||
else if disableVerticalScroll {
|
else if disableVerticalScroll {
|
||||||
if scrollView.contentOffset.y >= 0 || scrollView.contentOffset.y < 0 {
|
if scrollView.contentOffset.y >= 0 || scrollView.contentOffset.y < 0 {
|
||||||
scrollView.contentOffset = CGPoint(x: scrollView.contentOffset.x, y: lastScrollY);
|
scrollView.contentOffset = CGPoint(x: scrollView.contentOffset.x, y: lastScrollY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if disableHorizontalScroll {
|
else if disableHorizontalScroll {
|
||||||
if scrollView.contentOffset.x >= 0 || scrollView.contentOffset.x < 0 {
|
if scrollView.contentOffset.x >= 0 || scrollView.contentOffset.x < 0 {
|
||||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: scrollView.contentOffset.y);
|
scrollView.contentOffset = CGPoint(x: lastScrollX, y: scrollView.contentOffset.y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2789,24 +2788,24 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
switch (message.name) {
|
switch (message.name) {
|
||||||
case "consoleLog":
|
case "consoleLog":
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
case "consoleDebug":
|
case "consoleDebug":
|
||||||
// on Android, console.debug is TIP
|
// on Android, console.debug is TIP
|
||||||
messageLevel = 0
|
messageLevel = 0
|
||||||
break;
|
break
|
||||||
case "consoleError":
|
case "consoleError":
|
||||||
messageLevel = 3
|
messageLevel = 3
|
||||||
break;
|
break
|
||||||
case "consoleInfo":
|
case "consoleInfo":
|
||||||
// on Android, console.info is LOG
|
// on Android, console.info is LOG
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
case "consoleWarn":
|
case "consoleWarn":
|
||||||
messageLevel = 2
|
messageLevel = 2
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
let consoleMessage = body["message"] as? String ?? ""
|
let consoleMessage = body["message"] as? String ?? ""
|
||||||
|
|
||||||
|
|
|
@ -1571,15 +1571,14 @@ public class InAppWebView: WKWebView, WKUIDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IdentityAndTrust {
|
struct IdentityAndTrust {
|
||||||
|
var identityRef: SecIdentity
|
||||||
var identityRef:SecIdentity
|
var trust: SecTrust
|
||||||
var trust:SecTrust
|
var certArray: AnyObject
|
||||||
var certArray:AnyObject
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractIdentity(PKCS12Data:NSData, password: String) -> IdentityAndTrust? {
|
func extractIdentity(PKCS12Data: NSData, password: String) -> IdentityAndTrust? {
|
||||||
var identityAndTrust:IdentityAndTrust?
|
var identityAndTrust: IdentityAndTrust?
|
||||||
var securityError:OSStatus = errSecSuccess
|
var securityError: OSStatus = errSecSuccess
|
||||||
|
|
||||||
var importResult: CFArray? = nil
|
var importResult: CFArray? = nil
|
||||||
securityError = SecPKCS12Import(
|
securityError = SecPKCS12Import(
|
||||||
|
@ -1589,19 +1588,19 @@ public class InAppWebView: WKWebView, WKUIDelegate,
|
||||||
)
|
)
|
||||||
|
|
||||||
if securityError == errSecSuccess {
|
if securityError == errSecSuccess {
|
||||||
let certItems:CFArray = importResult! as CFArray;
|
let certItems: CFArray = importResult! as CFArray;
|
||||||
let certItemsArray:Array = certItems as Array
|
let certItemsArray: Array = certItems as Array
|
||||||
let dict:AnyObject? = certItemsArray.first;
|
let dict: AnyObject? = certItemsArray.first;
|
||||||
if let certEntry:Dictionary = dict as? Dictionary<String, AnyObject> {
|
if let certEntry: Dictionary = dict as? Dictionary<String, AnyObject> {
|
||||||
// grab the identity
|
// grab the identity
|
||||||
let identityPointer:AnyObject? = certEntry["identity"];
|
let identityPointer: AnyObject? = certEntry["identity"]
|
||||||
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!;
|
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!
|
||||||
// grab the trust
|
// grab the trust
|
||||||
let trustPointer:AnyObject? = certEntry["trust"];
|
let trustPointer: AnyObject? = certEntry["trust"]
|
||||||
let trustRef:SecTrust = trustPointer as! SecTrust;
|
let trustRef:SecTrust = trustPointer as! SecTrust
|
||||||
// grab the cert
|
// grab the cert
|
||||||
let chainPointer:AnyObject? = certEntry["chain"];
|
let chainPointer: AnyObject? = certEntry["chain"]
|
||||||
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!);
|
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("Security Error: " + securityError.description)
|
print("Security Error: " + securityError.description)
|
||||||
|
|
Loading…
Reference in New Issue