0
$\begingroup$

In public key cryptography, there are two different keys used for the encryption and decryption of data . I am wondering how it is used for digital signature

$\endgroup$
-2
$\begingroup$

Aleksander's answer is very close, but there is one key difference between encrypting and signing a message. When you create a digital signature, you are not encrypting the whole message. The intent is only to validate that the message was indeed sent from you, not to prevent others from reading the message.

To sign a message, first a cryptographic hash is created. This is a calculated string that provides a unique "fingerprint" for your message, that anyone can reproduce on the other end to validate that the message received is the same as the message sent. This hash, rather than the message itself is what is first encrypted by the recipient's public key, then your private key, then it's appended along with the message as the signature and sent to the recipient.

The recipient must then use the sender's public key first, then their private key to decrypt the hash. Once they have the received hash, the last step is to create their own hash of the message, and compare the two. If the hashes match, the signature is valid, and everybody is happy!

Here's a great explanation: http://www.cs.utsa.edu/~bylander/cs1023/signature-encryption-example.html

$\endgroup$
  • $\begingroup$ "This hash, rather than the message itself is what is first encrypted by the recipient's public key, then your private key"; two things wrong with this: a) signatures don't, in general, encrypt with the private key, and b) there's no requirement to encrypt anything with the receipt's public key (for one, there might not be a unique recipient; consider the use of signatures within PKI) $\endgroup$ – poncho Apr 19 '18 at 17:27

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.