DSA (Digital Signature Algorithm)
Al-Tarazi Assaubay
Senior Lecturer
Department of Computational and Data Sciences
Department of Intelligent Systems and Cybersecurity
Algorithm, part 1: keys
Global keys:
1 p - prime number
2 q - prime divisor of p − 1
3 h - any integer 2 ≤ h ≤ p − 2 (usually h = 2 is used)
4 g = h(p−1)/q (mod p) ̸= 1
User keys:
1 private key x : 1 ≤ x ≤ q − 1
2 public key y = gx (mod p)
DSA (Digital Signature Algorithm) 2/8
Algorithm, part 2: signature
1 k - random integer 1 ≤ k ≤ q − 1
2 (Hash(M)) (mod q), but we use M : 0 ≤ M ≤ q − 1
3 s1 = (gk (mod p)) (mod q), (s1 ̸= 0)
4 s2 = k−1 (M + x · s1 ) (mod q) (s2 ̸= 0)
DSA (Digital Signature Algorithm) 3/8
Algorithm, part 3: verification
1 1 ≤ s1 ≤ q − 1, 1 ≤ s2 ≤ q − 1
2 u1 = M · s−1
2 (mod q)
−1
3 u2 = s1 · s2 (mod q)
gu1 · yu2
4 v= (mod p) (mod q)
5 v = s1 means the signature is authentic.
DSA (Digital Signature Algorithm) 4/8
Example, part 1
Choose a prime p = 53
Since q is a prime divisor of p − 1, we factorize 53 − 1:
53 − 1 = 52 = 4 · 13 = 22 · 13, thus, let q = 13
Choose standard h = 2 and compute g:
g = 252/13 (mod 53) = 16
Choose x: 1 ≤ x ≤ 12. Say, x = 7
Compute y
y = 167 (mod 53) = 49
DSA (Digital Signature Algorithm) 5/8
Example, part 2
Let M = 5, k = 5
Then k−1 (mod q) = 5−1 (mod 13) = 8
Compute s1 = 165 (mod 53) (mod 13) = 24 (mod 13) = 11
Compute s2 = 8(5 + 7 · 11) (mod 13) = 6
DSA (Digital Signature Algorithm) 6/8
Example, part 3
Compute s−1
2 (mod q) = 6
−1 (mod 13) = 11
Compute u1 = M · s−1
2 (mod q) = 5 · 11 (mod 13) = 3
Compute u2 = s1 · s−1
2 (mod 13) = 11 · 11 (mod 13) = 4
Compute v = gu1 · yu2 (mod 53) (mod 13):
v = 163 · 494 (mod 53) (mod 13) = 15 · 44 (mod 53) (mod 13)
= 660 (mod 53) (mod 13) = 24 (mod 13) = 11.
Since v = s1 , the signature is authentic.
DSA (Digital Signature Algorithm) 7/8
Practice
1 Let p = 23, q = 11, h = 2, compute g.
Then let x = 9, compute y.
Compute the signature (s1 , s2 ) for M = 10, k = 7.
Verify the signature.
2 Let p = 47, q = 23, h = 2, compute g.
Then let x = 17, compute y.
Compute the signature (s1 , s2 ) for M = 21, k = 6.
Verify the signature.
DSA (Digital Signature Algorithm) 8/8