SecKeyCopyPublicKey(_:)
Gets the public key associated with the given private key.
Declaration
func SecKeyCopyPublicKey(_ key: SecKey) -> SecKey?Parameters
- key:
The private key for which you want the corresponding public key.
Mentioned in
Return Value
The public key corresponding to the given private key. In Objective-C, call the CFRelease function to free this key’s memory when you are done with it.
Discussion
The returned public key may be nil if the app that created the private key didn’t also store the corresponding public key in the keychain, or if the system can’t reconstruct the corresponding public key.