# What is a digital signature?

A digital signature is an extra chunk of data send along with an (encrypted) message which tells the receiver that the message is coming from the one who claims to have sent it. It ensures that the message has not been tampered with by a man-in-the-middle, a person who spies on the communication line and intercepts messages. You also have a proof that the sender is the one who holds the private key of a public-private key pair.

It goes as follows:

```   - Two parties, A and B.  A wants to send a message M to B.

+-----+                              +-----+
|  A  |                              |  B  |
+-----+                              +-----+
- holds private key PVT of       - holds public key PUB of
public-private key pair          public-private key pair

Sender:
1. A calculates a message digest MD on M
2. A encrypts that message digest MD with his private
key PVT (A is the only one that has the private key
that belongs to him!) = digital signature DS
3. A sends message M and DS to B