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?

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

  • Signing and encryption are distinct processes. – forest Dec 8 '18 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 Dec 11 '18 at 14:16

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.