Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain public key from private SecKeyRef

Given a SecKeyRef loaded using SecItemImport from an RSA private key is there a way to obtain or create a SecKeyRef for only the public key components? In OpenSSL this could be done by copying the modulus and public exponent to a new struct, but SecKeyRef is opaque and I've been unable to find a function that performs this operation.

like image 398
Paul Kehrer Avatar asked Jun 28 '14 21:06

Paul Kehrer


1 Answers

As of macOS 10.12, iOS/tvOS 10, and watchOS 3 the function SecKeyCopyPublicKey now exists to do this.

like image 93
Paul Kehrer Avatar answered Sep 21 '22 06:09

Paul Kehrer