Secure Enclave key accessibility attribute differs from SecAccessControl creation policy

We created a persistent P-256 Secure Enclave private key on iPadOS using SecAccessControlCreateWithFlags with the following settings:

  • kSecAttrAccessibleWhenUnlockedThisDeviceOnly
  • privateKeyUsage
  • userPresence

Key generation, persistence across app launches and updates, and authenticated signing were successful.

However, SecItemCopyMatching with kSecReturnAttributes returned an accessibility attribute of "dk" rather than the expected "aku".

SecKeyCopyAttributes did not return the accessibility attribute.

A signing attempt using a fresh non-interactive authentication context failed with LAError.notInteractive (-1004). Interactive signing succeeded following Face ID authentication, and the signature was independently verified.

My questions are:

  1. Is the returned "dk" value expected for a persistent Secure Enclave private key created with this access control policy?
  2. Does this attribute describe the Keychain reference or the effective protection policy of the private key?
  3. Is there a supported public API to independently verify that the requested WhenUnlockedThisDeviceOnly protection is enforced?

We do not intend to weaken the requested protection policy or treat these two accessibility values as equivalent without supporting evidence.

Any clarification would be appreciated. Thank you.

Answered by DTS Engineer in 919825022

kSecAttrAccessControl doesn’t behave like normal attributes, something I call out in SecItem: Pitfalls and Best Practices and in my replies on this thread. I’m gonna have you read through those and then come back here if you have follow-up questions.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

kSecAttrAccessControl doesn’t behave like normal attributes, something I call out in SecItem: Pitfalls and Best Practices and in my replies on this thread. I’m gonna have you read through those and then come back here if you have follow-up questions.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"