Digital signatures provide source authentication for online documents, messages or records, in a manner analogous to what a signature provides for a paper document.
The steps for the sender are as follows:
- calculate a hash or message digest from the message
- encrypt that hash with the sender's private key
- combine the encrypted hash with information identifying the signer
- append the combination to the message as a signature
Steps for the receiver are:
- obtain the sender's public key and authenticate its integrity and source
- decrypt the signature, using the sender's public key, to get the hash value; call it H1
- hash the message body yourself to get another hash value, H2
- compare H1 and H2
- if they are identical, then you know with overwhelming probability (though not with absolute certainty):
- so you can accept the signature as valid
The use of digital signatures raises legal issues. There is an online reference  for laws around the world.
- Digital Signature Law Survey https://dsls.rechten.uvt.nl/