Question

I need to export one private key (identity) from my OSX Keychain from the command line. Using security, I can only figure out how to export all private keys (identities) as a single pkcs12 (p12) file. How do I export a specific one?

Was it helpful?

Solution

https://github.com/torsten/keychain_access works, but it doesn't support filtering by type. I submitted a pull request for this functionality. Until it is accepted, you can try my fork.

./keychain_access -p password_for_exported_private_key "Name of private key"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top