4

Alice wants to send an encrypted message to Bob, but she also wants to connect to Carol's server. Are there any dangers associated with using the same RSA key for both PGP and SSH (other than a lack of anonymity)?

3

In a PGP setup, encryption occurs with the recipient's public key. In SSH authentication, this is (internally) a signature with the client's private key. If Alice sends a message to Bob and also connects to Carol's server, then Alice will use Bob's public key to encrypt, and here own private key (from a distinct key pair) to sign. No problem here.

A trickier case is when Bob wants to both receive encrypted messages from Alice, and connect to Carol's SSH server. In that case, Bob uses his private key to decrypt incoming messages (from Alice), and also to sign things sent by Carol (the authentication challenge within the SSH handshake). Using the same private key for two distinct algorithms is, generally speaking, a bad idea, because possible interactions between the two usages are a poorly explored area. Also, normally want to keep a backup of any encryption key, and not keep a backup of any authentication/signature key (see this), so making the two keys the same means that you are doing things suboptimally.

For that matter, a normal PGP setup already entails having several key pairs (a "master key" that can revoke the sub-keys, and sub-keys for encryption and signatures). Having an extra one for SSH should be no hardship.

(Not counting the fact that PGP implementations like GnuPG, and SSH implementations like OpenSSH, have distinct formats for encoding keys, so using the same key for both would need some effort.)

1

The real question is whether you're using a signing/authentication GPG subkey as your SSH key, or an encryption one. The former is fine, the latter is not: an RSA key must never be used to both encrypt and sign! (Authentication uses digital signatures.)

  • Shouldn't the private key I use to decrypt messages sent to me, be the same as the key that I use to sign messages (So that others can use the same public key for both purposes?) – Jason Coyne Jul 12 '15 at 13:45
  • It partially depends on the encryption algorithm in use, but with RSA, the answer is no: doing this risks revealing the private key. (Have a look at the RSA math to see why.) However, software packages like GPG manage this for you. The public key that you publish is actually a signing key, and GPG automatically generates a another key (the "encryption subkey"), signed by your primary key, that it does data encryption with. – Justin King-Lacroix Jul 12 '15 at 13:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.