Digital signatures are used to ensure the authenticity of message received. It uses asymmetric encryption.
Sender:
- The message to be send is put through a hash function to produce a digest.
A message digest is a numeric representation of the content of a message
- The digest is encrypted with sender's private key to create the digital signature
- The message and the encrypted digest are sent to the recipient
Recipient:
- The received encrypted digest is decrypted with sender's public key.
- The received message is put through the hash algorithm to get a digest
- The decrypted digest is compared to the recalculated digest
- If they are the same, the identity of the sender of this message is verified.
About hash function:
- One-way: it is impossible to revers the function, i.e., it is impossible to get the original message from the digest
- No same digest for 2 different messages