Function

SecKeyCopyPublicKey

Gets the public key associated with the given private key.

Declaration

SecKeyRef SecKeyCopyPublicKey(SecKeyRef key);

Parameters

key

The private key for which you want the corresponding public key.

Return Value

The public key corresponding to the given private key. Call the CFRelease function to free this key's memory when you are done with it.

See Also

Key Generation

Generating New Cryptographic Keys

Create both asymmetric and symmetric cryptographic keys.

Storing Keys in the Secure Enclave

Create an extra layer of security for your private keys.

SecKeyCreateRandomKey

Generates a new private/public key pair.

Key Generation Attributes

Use attribute dictionary keys during cryptographic key generation.