A digital signature scheme is primarily a mechanism of making sure the digital documents (such as email, contract documents etc) are not forged in between (**integrity)** when exchanged between two entities. In addition, it solves the problem of **non-repudiation** (when a person disagrees that he/she did not sign the document).

A digital signature is nothing but a sequence of numbers which get generated with a document and later used to verify whether the document is signed with the appropriate private key.

Creating a document with a digital signature comprises of the following:

**Creation of private-public key pair**using key generation algorithm. The public key, as per the name, could be shared with the world. The private key remains private to the user.**A document signing function**which generates the digital signature. The function takes the document and private key as input parameters and generates signature as output.**A signature verifying function**which ensures that document is signed with an appropriate private key by passing the input parameters as document, signature and public key.

### How is Digital Signature created?

The following are the steps for creating a digital signature of a document:

- A key-generation algorithm is used to create a private-public key pair.
- The document along with the private key is passed to a mathematical function (signing algorithm). The mathematical function generates a sequence of numbers/characters which represents the digital signature of the document.
- Alternatively, instead of using the plain document with a private key, the
**digest of the document along with private key is used to generate the digital signature**. The document is passed through a cryptographic hash function which generates the fixed-length digest.

The following diagram depicts the above-mentioned process:

### How does the Document with Digital Signature is verified?

The following are the steps for signing the document with digital signature:

- The document along with digital signature is sent to the other person. In the diagram below, Alice creates a digital signature of the document and sends the document along with the digital signature to Bob. She also shares her public key to the Bob.
- The other person, Bob in the diagram given below, passes the following to another mathematical function (signature verification algorithm) which returns the response related to whether the document is signed with the same public-private key pair.
- Document
- Digital signature
- Public key

### References

### Summary

In this post, you learned about **digital signature scheme including how digital signature is created and used**.

Did you find this article useful? Do you have any questions or suggestions about this article? Leave a comment and ask your questions and I shall do my best to address your queries.

- Beta Distribution Explained with Python Examples - September 24, 2020
- Bernoulli Distribution Explained with PythonExamples - September 23, 2020
- K-Nearest Neighbors Explained with Python Examples - September 22, 2020