Function

SecKeyUnwrapSymmetric

Unwraps a wrapped symmetric key.

Declaration

SecKeyRef SecKeyUnwrapSymmetric(CFDataRef  _Nullable *keyToUnwrap, SecKeyRef unwrappingKey, CFDictionaryRef parameters, CFErrorRef  _Nullable *error);

Parameters

keyToUnwrap

The wrapped key to unwrap.

unwrappingKey

The key that must be used to unwrap keyToUnwrap.

parameters

A parameter list for the unwrapping process. This is usually either an empty dictionary or a dictionary containing a value for kSecAttrSalt.

error

A pointer to a CFErrorRef variable where an error object is stored upon failure. If not NULL, the caller is responsible for checking this variable and releasing the resulting object if it exists.

Return Value

The unwrapped key, or NULL on failure. Call the CFRelease function to free the key's memory when you are done with it.

See Also

Legacy macOS Key Operations

SecKeyGeneratePairAsync

Generates a public/private key pair.

SecKeyGenerateSymmetric

Generates a random symmetric key.

SecKeyCreateFromData

Constructs a SecKeyRef object for a symmetric key.

SecKeyDeriveFromPassword

Returns a key object in which the key data is derived from a password.

SecKeyWrapSymmetric

Wraps a symmetric key with another key.

SecKeyGetCredentials

Returns an access credential for a key.

Deprecated
SecKeyGetCSPHandle

Returns the CSSM CSP handle for a key.

Deprecated
SecKeyGetCSSMKey

Retrieves a pointer to the CSSM_KEY structure containing the key stored in a keychain item.

Deprecated
SecKeySizes

The supported sizes for keys of various common types.

SecKeyUsage

The flags that indicate key usage in the KeyUsage extension of a certificate.

SecPublicKeyHash

A container for a 20-byte public key hash.

SecKeyCreatePair

Creates an asymmetric key pair and stores it in a keychain.

Deprecated
SecKeyGenerate

Creates a symmetric key and optionally stores it in a keychain.

Deprecated
SecKeyGeneratePairBlock

A block called with the results of a call to SecKeyGeneratePairAsync.

SecCredentialType

The credential type to be returned by SecKeyGetCredentials.