Function

SecKeyCreateWithData

Restores a key from an external representation of that key.

Declaration

SecKeyRef SecKeyCreateWithData(CFDataRef keyData, CFDictionaryRef attributes, CFErrorRef  _Nullable *error);

Parameters

keyData

Data representing the key. The format of the data depends on the type of key being created. See the description of the return value of the SecKeyCopyExternalRepresentation function for details.

attributes

A dictionary containing attributes describing the key to be imported. This dictionary must include at least the following keys:

error

The address of a CFError object. If an error occurs, this is set to point at an error instance that describes the failure.

Return Value

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

See Also

Import and Export

Storing Keys as Data

Create an external representation of a key for transmission.

SecKeyCopyExternalRepresentation

Returns an external representation of the given key suitable for the key's type.