Using a .asc key file with SshPrivateKey Class

0 votes
asked Jan 4, 2012 by msmith68 (120 points)
edited Jan 10, 2012

We want to use a private key when authenticating/loging in. Our public/private keys were created using PGP and are saved in a .asc file. When the SshPrivateKey class constructor is given .asc file name for its path parameter an "Invalid key format" error is thrown. It appears that the .asc file format is not not supported by Rebex. Is there any way to convert the .asc file to a Rebex compatible format?

commented Jan 5, 2012 by Lukas Pokorny (94,670 points)
edited Jan 5, 2012

At the moment, Rebex supports the following private key formats: 1) PKCS #8 format. 2) PuTTY PPKv2 format. 3) OpenSSH/OpenSSL SSLeay format.

PGP's .asc files are not supported, but if you find a way to convert it to one of the above formats, it should work. We will look into this format as well and let you know what we find.

1 Answer

0 votes
answered Jan 10, 2012 by Lukas Pokorny (94,670 points)
edited May 27, 2016 by Lukas Pokorny

I found a discussion about converting PGP keys to SSH keys. The following process is described:

  • Remove the password from the .asc key.
  • Use openpgp2ssh utility (part of Monkeysphere framework) to convert the PGP key to SSH key.
  • Re-encrypt both the original PGP key and the converted key.

Monkeysphere is available for many Linux distros, but I have not been able to found any Windows binaries yet.

However, why do you actually need to convert the key? Physically, it will be the same key, but what purpose will that serve? Why not simply generate a new SSH key?

...