I created a key pair using PGP (GnuPG) for the purpose of encrypting and signing data (documents, emails, and so on). That key was created with the RSA algorithm, and naturally starts with:

-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v2

I would like to know, if it is possible, to "convert" that very same key pair for the purpose of authentication using SSH (example: AWS instance or some other remote SSH server). I realize that the result would probably yet another key pair in a different format (.pem for example.)

The idea would be to use the same original RSA key pair (and therefore the same secret passphrase) for all the following purposes: encrypting, signing and SSH authentication.

How would I exactly do that and what are the limitations involved (for example, with private key passphrases, etc)?

  • 1
    $\begingroup$ Using the same values of $(N,e,d,p,q,dp,dq,qInv)$ is entirely independent of using the same passphrase. Therefore there is little point in doing what's asked (the files are bound to be different, so what's the point in having the same numbers if the passphrase can be the same?). What's asked can be done, in principle, by dumping the GPG key (see this), then converting it to whatever other format; that's a programming/usage question, thus arguably off-topic. The devil is in the details; like: usual GPG keys actually contains two RSA keys. $\endgroup$ – fgrieu Dec 22 '16 at 20:27
  • $\begingroup$ To emphasize a point @fgrieu didn't, your parenthetical 'therefore the same secret passphrase' is very wrong. The passphrase, in either GnuPG or OpenSSH/OpenSSL, is independent of the RSA key. You can have different keys -- one GPG and one OSSH, both GPG, or both OSSH -- using the same passphrase, and copies of the same key using different passphrases -- or for OSSH no passphrase (not advised). So there's no good reason to go to the effort to convert a key. $\endgroup$ – dave_thompson_085 Jan 6 '17 at 17:12

Browse other questions tagged or ask your own question.