How does one export an RSA public key that has been generated with SecKeyGeneratePair
in pkcs#8 format?
I'm currently writing an iOS app that needs to be able to generate RSA private/public key pairs, sign a piece of content and export the public key in pkcs#8 format to be sent to the server. So far I'm generating my pair with SecKeyGeneratePair
, retrieving my public and private keys with SecItemCopyMatching
and signing things with SecKeyRawSign
, which all seems to be working fine and the signature is verifying just fine for testing with SecKeyRawVerify
. But I am unfortunately coming up completely blank on how to export the public key properly in pkcs#8.
Thank you in advance for any help.