Function

SecKeyCreateWithData(_:_:_:)

Restores a key from an external representation of that key.

Declaration

func SecKeyCreateWithData(_ keyData: CFData, _ attributes: CFDictionary, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> SecKey?

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 nil on failure.

See Also

Import and Export

Storing Keys as Data

Create an external representation of a key for transmission.

func SecKeyCopyExternalRepresentation(SecKey, UnsafeMutablePointer<Unmanaged<CFError>?>?) -> CFData?

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

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