如何在Mac OS X Yosemite上导入RSA密钥?

时间:2015-04-25 20:36:20

标签: terminal osx-yosemite keychain ssh-keys

执行以下操作:

ssh-keygen -t rsa
...
security import ~/.ssh/id_rsa -k login.keychain -t priv -f openssh2

我收到以下错误:

security: SecKeychainItemImport: Unknown format in import.

1 个答案:

答案 0 :(得分:2)

您可以先将其转换为X.509 pem:

openssl rsa -in ~/.ssh/id_rsa -outform PEM -out id_rsa.pem

然后security将能够识别它:

security import id_rsa.pem

示例输出:

1 key imported.