An object that represents a cryptographic key.


iOS, Mac Catalyst, tvOS, watchOS
typedef struct __SecKey SecKeyRef;
typedef struct __SecKey *SecKeyRef;


A SecKeyRef instance that represents a key that is stored in a keychain can be safely cast to a SecKeychainItemRef for manipulation as a keychain item. On the other hand, if the key is not stored in a keychain, casting the object to a SecKeychainItemRef and passing it to Keychain Services functions returns errors.

See Also


Getting an Existing Key

Learn how to obtain an existing cryptographic key.

Storing Keys in the Keychain

Store and access cryptographic keys in the keychain.


Returns the unique identifier of the opaque type to which a key object belongs.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software