Please dont mark repetitive question.
HI all,
I am doing NSURLAuthenticationMethodClientCertificate in which I am using the following code. In which code is fine if I dont use swiftlint. But when I use swiftlint I am getting this error and unable to solve this. Tried a lot please help me . Posting the code below.
var items: CFArray?
//let PKCS12Data = DataSourceManager.sharedInstance.serverPolicyManager?.PKCS12Data
securityError = SecPKCS12Import(certData, options, &items)
if securityError == errSecSuccess {
let certItems: CFArray = items as CFArray!
let certItemsArray: Array = certItems as Array
let dict: AnyObject? = certItemsArray.first
if let certEntry: Dictionary = dict as? Dictionary<String, AnyObject> {
// grab the identity
let identityPointer = certEntry["identity"]
let secIdentityRef = identityPointer as! SecIdentity
print("\(String(describing: identityPointer)) :::: \(secIdentityRef)")
// grab the trust
let trustPointer: AnyObject? = certEntry["trust"]
let trustRef: SecTrust? = trustPointer as! SecTrust
print("\(String(describing: trustPointer)) :::: \(trustRef)")
// grab the cert
let chainPointer: AnyObject? = certEntry["chain"]
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef!, certArray: chainPointer!)
}
}
I am getting forcecast violation in the below lines.
let secIdentityRef = identityPointer as! SecIdentity
let trustRef: SecTrust? = trustPointer as! SecTrust