A signature, or digital signature, is a protocol showing that a message is authentic.
On receiving the message, the verification process
- authenticates the sender - uses the sender's public key to decrypt the signature and recover the hash, which can only be created with the sender's private key, and
- checks message integrity - compares the hash with a newly calculated one from the received document (the two hashes will differ if the document has been tampered with)
The system fails if the private key is compromised or the recipient is deceitfully given the wrong public key.
Digital signatures rely on asymmetric cryptography, also known as public-key cryptography.