Digital Signature
Digital Signature
Digital Signature
The difference between the image of a typical digital signature verification process and the one
above is the encryption and decryption part.
Steps in DSA Algorithm
1. Key Generation
parameter generation and
per-user keys
2. Signature Generation
3. Key Distribution
4. Signature Verification
1. Key Generation
Parameter Generation
Initially a user needs to choose a cryptographic hash function (H) along with output length in bits |H|. Modulus
length N is used in when output length |H| is greater.
Then choose a key length L where it should be multiple of 64 and lies between 512 and 1024 as per Original
DSS length. However, lengths 2048 or 3072 are recommended by NIST for lifetime key security.
The values of L and N need to be chosen in between (1024, 60), (2048, 224), (2048, 256), or (3072, 256)
according to FIPS 186-4. Also, a user should chose modulus length N in such a way that modulus length N
should be less than key length (N<L) and less than and equal to output length (N<=|H|).
Later a user can choose a prime number q of N bit and another prime number as p of L bit in such a way that
(p-1) is multiple of q. And then choose h as an integer from the list ( 2……..p-2).
g = h^(p-1)/q*mod(p). If you get g = 1, please try another value for h and compute again for g except 1.
p, q and g are the algorithm parameters that are shared amongst different users of the systems.
Per-user Keys
To compute the key parameters for a single user, first choose an integer x (private key) from the list (1…….q-1),
2. Signature Generation
• It passes the original message (M) through the hash function (H#) to get our hash digest(h).
• It passes the digest as input to a signing function, whose purpose is to give two variables as
output, s, and r.
• Apart from the digest, you also use a random integer k such that 0 < k < q.
• To calculate the value of r, you use the formula r = (gk mod p) mod q.
• To calculate the value of s, you use the formula s = [K-1(h+x . R)mod q].
• It then packages the signature as {r,s}.
• The entire bundle of the message and signature {M,r,s} are sent to the receiver.
3. Key Distribution
While distributing keys, a signer should keep the private key (x) secret and publish the
public key (y) and send the public key (y) to the receiver without any secret mechanism.
Signing
compute r = g^(k)*mod(p)*mod(q).
If you get r = 0, please try another random value of k and compute again for r except
0.
Calculate s=(k^(-1)*(H(m)+xr))*mod(q).
If you get s = 0, please try another random value of k and compute again for s except 0.
The signature is defined by two key elements (r, s). Also, key elements k and r are used to
create a new message. Nevertheless, computing r with modular exponential process is a very
expensive process and computed before the message is known. Computation is done with the
help of the Euclidean algorithm and Fermat's little theorem.
4. Signature Verification
You use the same hash function (H#) to generate the digest h.
You then pass this digest off to the verification function, which needs other variables as
parameters too.
The final verification component v is calculated as v = [((gu1 . yu2) mod p) mod q].
• Highly Robust: DSA is highly robust in the security and stability aspect compared to
alternative signature verification algorithms.
• Better Speed: The key generation is much faster compared to the RSA algorithm and such.
• Less Storage: DSA requires less storage space to work its entire cycle.
• Patent Free: When NIST released it, it was patent-free to enable its global use free of cost.
Summary
References
https://www.devglan.com/online-tools/rsa-encryption-decryption
https://www.simplilearn.com/tutorials/cryptography-tutorial/digital-signature-algorithm