我想知道是否有人知道在Secure Enclave内创建密钥后是否可以更新标志?这是我创建密钥的方式:
let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
[SecAccessControlCreateFlags.userPresence,
SecAccessControlCreateFlags.privateKeyUsage],
nil)!
let attributes: [String: Any] = [
kSecAttrKeyType as String: kSecAttrKeyTypeECSECPrimeRandom,
kSecAttrKeySizeInBits as String: 256,
kSecAttrTokenID as String: kSecAttrTokenIDSecureEnclave,
kSecPrivateKeyAttrs as String: [
kSecAttrIsPermanent as String: true,
kSecAttrApplicationTag as String: "stacksometimesoverflow",
kSecAttrAccessControl as String: access
]
]
var error: Unmanaged<CFError>?
guard SecKeyCreateRandomKey(attributes as CFDictionary, &error) != nil else {
throw error!.takeRetainedValue() as Error
}
如您所见,密钥是使用
SecAccessControlCreateFlags.userPresence, SecAccessControlCreateFlags.privateKeyUsage
我的问题是,是否可以更新密钥的访问标志(相同的密钥),比如我想删除SecAccessControlCreateFlags.userPresence
一切顺利!
约翰尼