Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How to convert an existing private key into ppk format using ssh-keygen?

Writer Andrew Henderson

I have a private key private.key) in format -----BEGIN RSA PRIVATE KEY-----IEpAIBAAKCAQEAvKwuhMiQR/THmjK.....-----END RSA PRIVATE KEY-----, and I am trying to convert it in the format that putty (.ppk) understands using ssh-keygen command through cygwin, but i am getting a public key instead. Do I need to save the original file (private.key) in any specific format?

I tried saving the (private.key) in .pem format and no extension. Tried ssh-keygen -t rsa -e -f private.key > privatekey2.ppkTried ssh-keygen -t rsa -i -f privatekey2.keyTried ssh-keygen -pExpecting the key in below format:

Comment: imported-openssh-key
Public-Lines: 6
AAAAB3NzaC1yc2EAAAADAQABAAABAQCiud9bCgiaSX7ck2Y1orbH3U5+4lsOmAbT
Az361YM3XwX6nLNyPycFkTdYfX75IhUPCT9ywPm4WvEy9B78qL6EoKZctAM/DUZA
7DDJeeK4NWsulN4qDUyWoR50wVJCswgwMLCZPwcXeyed8WpUi2qbi8Di4KJphdtV
HIAeq2pDYaj1HMBtxI2Lrd5DPSt7u28v/twrOksDpSA7DXzRu7AsIKvO/dF9/PR4
WB/cqctC9RPvDK1VWNj+xPFGZ2ylBr0aC3TilbKaou/8S2AmJyp5FOGUEBCUMGWs
P/fQbN0XQX6dQuvfTtYUBf4ZuJKxhPDBKiacUg5YufXdNR3I/JIx
Private-Lines: 14
AAABACLXmqgDG3lxsCypkPJ+DxX3YFXRwL58tcVbxdsd+XUTLxQMlm2pcQEDqW6U
nGnartij2caH5FBhhJCs7a+asAR043oo/yLyhC7lg8K4Ct/3bCYysOkfJN2BzSQh
uqvWarPq0P1XHf0chidx4AxTsLxz0DQ5nG89tXlu4eQRYHq4jdR5Pkr5wWHjYzpX/
o9C3bcgSlKqFVJMnw06eUI6c1STtQAj/Tn+1wLpTS+p3P7kO6oXXwAKU6kOnjbx5
S0u4XUY+ZKTlhrY24zbXhGPliGDyaTL8387AE1cqWAJeWenAlbIxRzy13BQ/8RNe
hpmLaHhCz32d+BFc4Oav3GyxibkAAACBANA8e5hWJOGnbSIugrWrkDGuSTQp1BFi
rYEaxml69w8QmsY2s5kzLXvuWPIZCUzMv1XjHJxsa8LmzwZ/tdKKfcfQILRT54Oe
NHkznPj4LgwsmVw+8WyCoA8sOykZ+tIOtwpEQUzBEGCPrMR/tsg3qigvbnno9daT
BdOTiYFbowQVAAAAgQDIDQ5qRRWuyu0broHDoB0JozFPUvIDZfIwfjWqVQqgjO5HG
I4kIKCS5JYC2HDtgb8t7f841hKvLzitmRiswZr5koEKBOrZTxPhI6CNBtZPTgFfV
ipJHukDSkZxzxlaG52bc1NxqXh8Q6XZFiURQ36JbQtWmCLQTFC2vRXOMEiuQrQAA
AIEAxo+trWXMfn7W21wMCEXDTtX5ciZMPupIoUjZ/rmRxVLSI5PmJDJS549UmVWy
Q8bnU9rFgc7dG/ZuB4HD+iVSpFDhkovGCE8a2DF47Bu100bOVPIH3o7KxfWFCtzh
Yw/KqweHiU1iUwuC4FUIxJW8jyxv2sOmxbOgZCZ7WNm8Qvo=
Private-MAC: 22f55dc7c54402157df04950dsf67d8473bb5476f
2

1 Answer

You cannot do this with OpenSSH's ssh-keygen; it can neither import nor export PuTTY's key format.

(Your -e and -i options don't work because they have absolutely nothing to do with PPK. The manual page actually says it'll output RFC4716 format keys, which is a very different thing.)

To make a PuTTY PPK file, you need puttygen:

$ puttygen private_key.key -O private -o private_key.ppk
11

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy