Post not yet marked as solved
Same problem with LAContext.If I try with access control on iOS 12, I have a 25291 error.I Must be doing something wrong.
Post not yet marked as solved
The problems appears as soon as I use controll access. I don't think it's related to access group as I have only the application one (so no entitlement created explicitly) var controlAccess : SecAccessControl!
let controlAccessFlags = SecAccessControlCreateFlags(arrayLiteral: [.userPresence])
guard withCFErrorCheck (context: "Create control access structure", {
controlAccess = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, controlAccessFlags, $0)
}) else {
return nil
}
let keyParameters : [CFString: Any] = [
kSecAttrKeyType: kSecAttrKeyTypeRSA,
kSecAttrKeySizeInBits: 2048,
kSecPublicKeyAttrs: [
kSecAttrLabel: "Public Key" as NSString,
],
kSecPrivateKeyAttrs: [
kSecAttrLabel: "Private Key" as NSString,
kSecAttrApplicationTag: Self.keyTag,
kSecAttrIsPermanent: true,
kSecAttrAccessControl: controlAccess!,
]
]
var privateKey: SecKey! // on success, privateKey will not be nil
guard withCFErrorCheck(context: "Generate key pair", {
privateKey = SecKeyCreateRandomKey(keyParameters as CFDictionary, $0)
}) else {
return nil
}
On the simulator when I try SecCopyItemMatching, I have a 25300 error.On the device a 34018.I'll try now to add a LAContext.
Post not yet marked as solved
I wrote a small demonstrator and it worked, so I got back to my project.Deleting all KeyChain items fixed the problem.It must have been poluted with some tests I've done with control access. I'll investigate and post here if I found something.Still, I don't understand the missing entitlement. It would be so great if iOS would tell me which one is missing.Thanks,Jean-Alexis
Post not yet marked as solved
It works on the simulator iOS 13 and iOS 12 devices.Fails on iOS 13 devices.