Open In App

Digital Signature Algorithm (DSA)

A Digital Signature is a verification method made by the recipient to ensure the message was sent from the authenticated identity. When a customer signs a check, the bank must verify that he issued that specific check. In this case, a signature on a document acts as a sign of authentication and verifies that the document is authentic.

Suppose we have:



In Public Key cryptography (also known as Asymmetric cryptography), the communication process is as follows:

Now, suppose when Alice sends a message to Bob, then Bob will check if the sender is authentic; to ensure that it was Alice who sent the message, not Eve. For this, Bob can ask Alice to sign the message electronically. So we can say that an electronic signature can prove that Alice is authentic and is the one sending the message. We called this type of signature a digital signature.



What is Digital Signature?

Digital Signature is a verification method. Digital signatures do not provide confidential communication. If you want to achieve confidentiality, both the message and the signature must be encrypted using either a secret key or a public key cryptosystem. This additional layer of security can be incorporated into a basic digital signature scheme.

Model of Digital Signature Process

Methods of Digital Signature

These two are standard Approaches to implement the Digital Signature:

Rivest-Shamir-Adleman (RSA)

In the RSA approach, the message that needs to be signed is first fed into a hash function that generates a secure hash code of fixed length. The sender’s private key is then used to encrypt the hash code which makes it signature. The next step involves sending both the signature and the message to the intended receiver. For validation purposes, after receiving the message, the recipient first computes its hash-code. The sender’s public key is applied by recipient to decrypt this already encrypted signature. In case if decrypted signature corresponds to recipient-produced hashcode, that means that signature would be considered as valid. Since only the sender has access to the private key, only they could have produced a valid signature.

You can refer the below diagram for RSA, here,

RSA approach

Digital Signature Algorithm (DSA)

The DSA (Digital Signature Algorithm) approach involves using of a hash function to create a hash code, same as RSA. This hash code is combined with a randomly generated number k as an input to a signature function. The signature function depends on the sender’s private key (PRa) as well as a set of parameters that are known to a group of communicating principals. This set can be considered as a global public key (PUG). The output of the signature function is a signature with two components, s and r. When an incoming message is received, a hash code is generated for the message. This hash code is then combined with the signature and input into a verification function. The verification function depends on the global public key as well as the sender’s public key (PUa) which is paired with the sender’s private key. The output of the verification function returns a value equal to the signature’s component r, if the signature is valid. The signature function is designed in such a way that only the sender, with knowledge of the private key, can produce a valid signature.

You can refer below diagram for DSA, where,

DSA Approach

Primary Termologies

Steps to Perform DSA

The Digital Signature Algorithm (DSA) is a public-key technique (i.e., assymetric cryptography) and it is used to provide only the digital signature function, and it cannot be used for encryption or key exchange.

The Steps to perform the Digital Signature Algorithm can be broadly divided into:

1. Global Public-Key Components

There are three parameters that are public and can be shared to a set of users.

If a user has these numbers, then it can selects a private key and generates a public key.

2. User’s Private Key

The private key x should be chosen randomly or pseudorandomly and it must be a number from 1 to (q – 1), so x is random or pseudorandom integer with 0 < x < q.

3. User’s Public Key

The public key is computed from the private key as y = gx mod p. The computation of y given x is simple. But, given the public key y, it is believed to be computationally infeasible to choose x, which is the discrete logarithm of y to the base g, mod p.

4. Signing

If a user want to develop a signature, a user needs to calculates two quantities, r and s, that are functions of the public key components (p, q, g), the hash code of the message H(M, the user’s private key (x), and an integer k that must be generated randomly or pseudorandomly and be unique for each signing. k is generated randomly or pseudorandomly integer such that 0<k < q.

Signing

5. Verification

Let M, r′, and s′ be the received versions of M, r, and s, respectively.

Verification is performed using the formulas shown in below:

The receiver needs to generate a quantity v that is a function of the public key components, the sender’s public key, and the hash code of the message. If this value matches the r value of the signature, then the signature is considered as valid.

TEST: v = r′

Verification

Now, at the end it will test on the value r, and it does not depend on the message or plaintext as, r is the function of k and the three global public-key components as mentioned above. The multiplicative inverse of k (mod q) when passed to the function that also has as inputs the message hash code and the user’s private key. The structure of this function is such that the receiver can recover r using the incoming message and signature, the public key of the user, and the global public key.

It is given that there is difficulty in taking discrete logarithms, it is not feasible for an attacker to recover k from r or to recover x from s. The only computationally demanding task in signature generation is the exponential calculation gk mod p. Because this value does not depend on the message to be signed, it can be computed ahead of time. Indeed, a user could precalculate a number of values of r to be used to sign documents as needed. The only other somewhat demanding task is the determination of a multiplicative inverse, k-1 .

Services

Advantages of DSA

Authentication: At some point, digital signatures ensure strong identity authentication for the sender. The recipient can be sure that the message or document was signed by the purported signatory.

Disadvantages of DSA

Frequently Asked Questions on Digital Signature Algorithm – FAQs

Do digital signatures provide confidentiality?

No, it does not provide confidentiataily, confidentiality is that only authorised user or receiver has viewed the message, it is not viewed by some scammer or attacker.

Which type of cryptography is used for digital signatures and why?

Digital signatures have been created that use public-key infrastructure, also called asymmetric cryptography, which is just a technique where the person sending the message and those receiving it generate different keys private keys and public keys.

How does DSA differ from RSA?

DSA (Digital Signature Algorithm) is a digital signature algorithm that is on the discrete logarithm problem, and widely used digital signature algorithm, especially in government and financial applications.

If we compare it with other digital signature algorithms, such as RSA and ECDSA, DSA has a few key differences:

Keywords

Description

Key size

DSA keys are generally smaller in size than RSA keys for same security, that can help in faster signature generation and verification, which improves complexity.

Signature size

Same as above, DSA signatures are generally smaller than RSA signatures for same security, which can result in less data being transmitted and stored.

Randomness requirements

DSA uses a random number or nonce in signature generation, while RSA does not. This makes DSA more vulnerable to certain types of attacks if the nonce is not generated properly.

Patent restrictions

RSA was patented until 2000, which limited its availability and use. But, DSA was developed as a part of the Digital Signature Standard (DSS) and has always been freely available for use.

Use cases

Government and financial applications often prefer DSA because it is standardized and has been widely examined for security purposes.

Overall, compared to other digital signature algorithms, DSA has several advantages and drawbacks, and the specific application requirements will determine which algorithm to choose.

Why is hashing used?

The major goal of hashing is to verify the integrity of a part of data or message. Since the hash generated is UNIQUE to the input data, it serves as a unique “fingerprint” of the input data, and it can make a hash valuable for verifying the integrity of messages sent via insecure transmission channels e.g. the internet.


Article Tags :