I've been in searching where keychain stores either secure enclave or any other, I found many articles (one of this stackoverflow answer) which says following but I'm looking for some Authenticated like Apple statement
The keychain stores the keys (and other small data) encrypted and restricts access to that data. Additionally in recent iPhones (5S and later) the keychain is in a separate processor, the Secure Enclave which additionally restricts access. There is no more secure way to store keys in iOS.
So my queries on the basis of above statement.
- Is Keychain Items store in secure Enclave
- If yes then where Public key and Private key
CFTypeRef
Store Why we use this
kSecAttrTokenIDSecureEnclave
while creating key pair. (example following code).-(bool) generateKeyPairWithAccessControlObject:(SecAccessControlRef)accessControlRef { CFMutableDictionaryRef accessControlDict = newCFDict;; CFDictionaryAddValue(accessControlDict, kSecAttrAccessControl, accessControlRef); CFDictionaryAddValue(accessControlDict, kSecAttrIsPermanent, kCFBooleanTrue); CFDictionaryAddValue(accessControlDict, kSecAttrLabel, kPrivateKeyName); // create dict which actually saves key into keychain CFMutableDictionaryRef generatePairRef = newCFDict; CFDictionaryAddValue(generatePairRef, kSecAttrTokenID, kSecAttrTokenIDSecureEnclave); CFDictionaryAddValue(generatePairRef, kSecAttrKeyType, kSecAttrKeyTypeEC); CFDictionaryAddValue(generatePairRef, kSecAttrKeySizeInBits, (__bridge const void *)([NSNumber numberWithInt:256])); CFDictionaryAddValue(generatePairRef, kSecPrivateKeyAttrs, accessControlDict); OSStatus status = SecKeyGeneratePair(generatePairRef, &publicKeyRef, &privateKeyRef); if (status != errSecSuccess) return NO; [self savePublicKeyFromRef:publicKeyRef]; return YES; }
Looking for authenticated answer. Cheers