1

I have been doing research on how RSA encryption works (mostly from a math's point of view) and I have come to understand this:

  • By encrypting with the public key of bob, only bob can decrypt it with his private key.
  • By encrypting with my private key, everybody with my public key can decrypt it, and know it's really me (signature).

But what if I want to sign my message (private key) and make so only bob can read it?

Should I encrypt with my private key for signature and then encrypt with bob public key so only he can read it?

And by the way, wouldn't this be heavy on computing power?

2
  • 1
    Encrypting and signing are 2 completely different processes with different goals, even though you are using the same RSA algorithm. So, yes, you need to do both, and yes, there is a computational cost to doing 2 processes.
    – schroeder
    Commented Sep 8, 2018 at 9:44
  • Wiki explains all this nicely: en.wikipedia.org/wiki/RSA_(cryptosystem)#Signing_messages
    – schroeder
    Commented Sep 8, 2018 at 9:46

1 Answer 1

0

Yes, you should first sign your message (With your private key) and then encrypt it with Bob's public key. In this way only he can decrypt the message with his private key and then verify the signature with your public key to actually know that the message was from you.

About the computing power. GPG encryption, which is the most extended system to encrypt and sign messages using public key encryption, actually uses symmetric encryption (f.e. AES) for messages. In this sense, what it really does is generating a random key for symmetric encryption, encrypt the message with that key and then encrypts that key with the receiver's public key. For signing, GPG calculates a hash of the message (f.e. SHA256) and encrypts that result with the senders private key.

This turns out to be way more performant for large messages, as symmetric encryption and hash calculations are pretty fast and, in some cases like AES, are optimized to be performed in hardware rather than software. Furthermore this mechanism allows a message to be delivered to multiple parties, for this, the symmetric key must be encrypted once for each receiver but the message and the signature stays the same

2
  • Signing and encryption are distinct processes.
    – forest
    Commented Dec 8, 2018 at 5:01
  • @forest Changed wording so it's more clear that difference. BTW, you can edit yourself answers if you consider it can be improved
    – Mr. E
    Commented Dec 11, 2018 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .