Developer account required for key generation

I've been reading information/signing data using keys in the file keychain without too many problems but the other day I tried to generate a private key in the file and the secure enclave keychains and I faced the -30418 error. I made sure that the entitlements were correct based on previous posts but still no luck.

Code kind of based off this: https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/protecting_keys_with_the_secure_enclave

Do you actually need to pay for the $99/per year developer account to generate private keys inside the keychains ?

Replies

Do you actually need [a paid] developer account to generate private keys inside the keychains ?

No.

The ability to protect a keychain item with the Secure Enclave is a feature of the data protection keychain [1]. To use the data protection keychain your app must be signed with an App ID. Without that, you get this errSecMissingEntitlement error (btw, that’s -34018, not -30418).

If you create and run a standard macOS app, it’s not signed with an App ID. The easiest way to force Xcode to do that is to add a restricted entitlement to you project [2]. A Personal Team doesn’t have a lot of access to restricted entitlements, but there are a few. For example, if you use Signing & Capabilities to add the Maps capability to your app target, Xcode will assign an App ID to your app.

Once you get things working, you can then remove the Maps capability and Xcode should continue to apply your App ID.

Share and Enjoy

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

[1] If you’re unfamiliar with that term, see TN3137 On Mac keychain APIs and implementations.

[2] If you’re unfamiliar with that term, see TN3125 Inside Code Signing: Provisioning Profiles.