[ad_1]
Error Area=NSOSStatusErrorDomain Code=-4 “Key technology failed, error -4” UserInfo={numberOfErrorsDeep=0, NSDescription=Key technology failed, error -4} throughout creation non-public key
let tag = "com.qwerty.www".knowledge(utilizing: .utf8)!
let attributes: [String: Any] =
[kSecAttrKeyType as String : type(of: kSecAttrKeyType),
kSecAttrKeySizeInBits as String: 2048,
kSecPrivateKeyAttrs as String:
[kSecAttrIsPermanent as String: true,
kSecAttrApplicationTag as String: tag]
]
var error: Unmanaged<CFError>?
guard let privateKey = SecKeyCreateRandomKey(attributes as CFDictionary, &error) else {
print(error!.takeRetainedValue() as Error)
return
}
let publicKey = SecKeyCopyPublicKey(privateKey)
[ad_2]
