A digital signature is a mathematical scheme for verifying the authenticity of digital messages or documents. A valid digital signature, where the prerequisites are satisfied, gives a recipient very strong reason to believe that the message was created by a known sender (authentication), and that the message was not altered in transit (integrity).
Digital signatures are a standard element of most cryptographic protocol suites, and are commonly used for software distribution, financial transactions, contract management software, and in other cases where it is important to detect forgery or tampering.
Let’s suppose that Alice wants to send a message to Bob which he can check the authenticity.
The message that want to send Alice is a binary file M (text, image, executable…) that can be assimilated to a text file.
Setting up the signature’s architecture
Alice chooses :
- asymmetric cryptography made of ciphering function C and deciphering function D
- hash function : H.
For the chosen ciphering, Alice has generated a private key Kpr and a public key Kpb :
- she pass the public key Kpb and the hash function H to Bob by a
- she keeps the private key Kpr secret.
D,H and Kpb don’t need to remain secret. However C has to remain secret.
Preparation of the signed message
Alice prepares the signed message :
- she produces an hash of the message with the chosen hash function
- she ciphers the hash thanks to a cipher function C using her private
key Kpr. The result is obtained by the signature of the message : SM
- she prepares the signed message putting the message unencrypted and
the signature SM in any container : Msigned = (SM,M).
Alice send Msigned to Bob through a non-secured channel.
Reception of the signed message
Bob receives the signed message. To check its authenticity :
- He produces a hash of the unencrypted message by using the Alice’s
hash function : H(M)
- He deciphers the signature using D with Kpb : Dsm=D(Kpb,SM)
- He compares DSM with H(M)
In the case that the signature is authentic, DSM and H(M) are equals, given the properties of the asymmetric cryptography: DSM = D(Kpb,SM) = D(Kpb,C(Kpr,H(M)))=H(M)
Then the message is authenticated.