7

-edit- After following a chain of links from this question I see this is similar/duplicate of Why should one not use the same asymmetric key for encryption as they do for signing? but this question is asking if there is a technical reason why we shouldn't and the linked is less technical and not exclusively to rsa

I may have the wrong understanding. GPG lets you generate a RSA key that is sign only. From my understanding an RSA key is a public and key pair. Signature works by hashing the message and encrypting it with the private key and others decrypts it using the public key. From my understanding if the hash matches what is decrypted than the message is signed.

How can GPG generate a key and sign it but not let me encrypt messages? I believe in another app it suggested you have one key for signing and one key for encryption but there was no reason why. Wouldn't that be confusing because an encrypted message and a signed cleartext would be using different keys and appear to be from a different user?

  • 1
    You encrypt with the target's public key, they decrypt with their private key. Signing is a separate mechanism. It involves signing with your private, and verifying with your public key. You can designate keys as "Signature Keys" or "Encryption Keys". You're right in that normally you can perform both actions with the same key-pair. However, the GPG client will see these flags and only allow one or the other. This is an attribute of GPG, not RSA itself. – RoraΖ Jul 07 '15 at 18:22
  • @raz: I'm not satisfied with Thomas answer (although it doesn't mean its bad). Do you know why GPG separates the two? (I'm unsure but it looks like your comment is assuring me that everything I said is correct or mostly correct and assuring me its something GPG does for their reason which I do not know) –  Jul 07 '15 at 20:30
  • In encryption, you use either a symetric key for encryption and decryption, or a public-private keypair. How do you want to transfer a secret key to someone who wants to send you an encrypted message? – ott-- Jul 07 '15 at 21:37
  • @ott--: Your question is flawed. I don't want to transfer a secret (or private) key to anyone. I want to give them a public key. –  Jul 08 '15 at 00:04

2 Answers2

7

Please don't use the "explanation" of signatures as "encryption with the private key" because it is a flawed analogy that does not actually work.

RSA is really two algorithms, one for asymmetric encryption, and one for signatures. It so happens that the two algorithms have some common mathematical elements, and, in particular, use the same kind of key (which is why we call it a "RSA key", not a "RSA encryption key" or "RSA signature key"). Thus, it is conceivable that a given RSA key pair may be used for both encryption and signatures.

However, there are good reasons why you would like to keep encryption and signature keys separate. The OpenPGP format acknowledges that, and thus "tags" keys with an indication of their intended usage. Therefore, your signature-only RSA key is a RSA key that OpenPGP tagged with a label that mostly says "please don't use that key for encryption".

Thomas Pornin
  • 326,555
  • 60
  • 792
  • 962
  • Why is the analogy fallowed and not work? AFAIK signatures are is a hash of the message and encrypted with the private key 2) I called it the same key hence why I am confused why we need two 3) That link made no sense. In short it doesn't explain why a key for signing not be backed up. It just says it doesn't need to bc it isnt a big deal and thats why it's separated from an encryption key. I don't see why anyone should bother separating it or why it's harmful to back up
  • –  Jul 07 '15 at 19:32
  • 1
    @acidzombie24 As you´re saying yourself, the sign and encryption algos are not the same. First, signing contains hashing. Second, there is OAEP (nobody uses plain RSA because security). etc. ... and that the rest is similar to encryption is specific to RSA. I know no other public key system where this holds (I don´t think there is one). – deviantfan Jul 07 '15 at 20:47
  • @deviantfan I'm not sure what you're trying to say. My entire post is about the fact I can do signing and encryption with the same RSA key. I'm asking why GPG and others don't appear to recommend doing so –  Jul 07 '15 at 20:53
  • @acidzombie24 Signing never involves encryption. For RSA at a basic level signing involves DECRYPTING with private key. In reality it is more complex. You really need to get away from the incorrect and simplistic view that SIGNING is anything but SIGNING. SIGN, VERIFY, ENCRYPT, DECRYPT are four distinct cryptographic operations. There is some similarity between DECRYPT and SIGN in RSA but for other systems like ECC SIGN AND DECRYPT have nothing in common. – Gerald Davis Jul 07 '15 at 21:44
  • @GeraldDavis maybe I'm misunderstanding. When using RSA to encrypt it's something similar to encrypting an AES key and SHA of the message (along with some other data) then concatenate the (AES) encrypted message to it. Is signing just encrypting the SHA concatenate the plaintext and public key? Did you mean to say there are similarity between DECRYPT and VERIFY? I'm not sure what I am misunderstanding –  Jul 08 '15 at 01:11
  • @acidzombie24 VERIFY is similar to ENCRYPT (not decrypt). SIGN is similar to DECRYPT (not encrypt). You use the sender's private key to DECRYPT and SIGN. You use the receiver's public key to ENCRYPT and VERIFY. So my point was you really should do yourself a favor and treat SIGN, VERIFY, ENCRYPT, and DECRYPT as distinct operations because they are (as Thomas points out) BUT even if you want to follow that broken X is like Y explanation your explanation was wrong and is still wrong because you mixed up the relationship. As a SAT problem; SIGN is to DECRYPT as VERIFY is to ENCRYPT. – Gerald Davis Jul 08 '15 at 01:15
  • @GeraldDavis Hmmm that makes sense. I saw decrypt and verify to be similar because you're using the senders public key to decrypt the SHA. It's weird to hear signing is decrypting because you'd decrypt (sign) before encrypt (verify). But I see what you're saying (verify and encrypt both use the target public key –  Jul 08 '15 at 03:33
  • This answer indicates that the "sign only" is just a tag added to a key pair that tells gpg that it should not use the key for encryption. So does that mean that if I try to encrypt with a "sign only" key gpg will say that is not allowed? Thus technically you can use the key to both encrypt and sign but gpg allows you to enforce a separation because it is good practice? – Arthur Thompson Dec 02 '15 at 01:57