Professional Documents
Culture Documents
16BCS2349 Jaspreet Singh IIS Worksheet 3
16BCS2349 Jaspreet Singh IIS Worksheet 3
WORKSHEET 3
SIGNATURE SCHEME - DIGITAL SIGNATURE STANDARD (DSS)
Objective: Implementation of the Digital Signature Standard (DSS) for generating and
verifying digital signatures.
Digital Signature Standard (DSS) Algorithm:
Key Generation:
1. Generate a random prime number p of size 1024 bits.
2. Generate a random prime number q of size 160 bits.
3. Calculate the value of g as (h^((p-1)/q)) mod p, where h is a randomly chosen value
between 1 and (p-1).
4. Choose a random number x between 1 and (q-1) as the private key.
5. Calculate the public key y as (g^x) mod p.
Signing:
1. Input: message, private key x.
2. Calculate the hash value of the message using a cryptographic hash function.
3. Choose a random number k between 1 and (q-1).
4. Calculate r as ((g^k) mod p) mod q.
5. Calculate s as ((k^(-1)) * (hash + x*r)) mod q.
6. The digital signature consists of the pair (r, s).
Verification:
1. Input: message, digital signature (r, s), public key y.
2. Calculate the hash value of the message using the same cryptographic hash function.
3. Calculate w as the multiplicative inverse of s modulo q.
4. Calculate u1 as (hash * w) mod q.
5. Calculate u2 as (r * w) mod q.
6. Calculate v as (((g^u1) * (y^u2)) mod p) mod q.
7. The signature is valid if v is equal to r. Otherwise, it is invalid.