Skip to content

DSA

DSA A.K.A Digital Signature Algorithm is a signing algorithm similar to RSA.

This algorithm is based on the ElGamal encryption system.

Textbook definition

The variables of textbook RSA are:

VariableDescription
qqA large prime
ppA large prime such that p−1p -1 is a multiple of qq
ggg=h(p−1)/qmod  pg = h^{(p-1)/q} \mod p where hh is a random integer such that 1<h<p−11 < h < p-1

Key generation

  • Chose xx such that 1<x<q1 < x < q, this is the private key.
  • Compute y=gxmod  py = g^x \mod p, this is the public key.

Signing

The signature of a message mm requires a hashing function HH.

  • Chose kk such that 1<k<q1 < k < q.
  • Compute r=(gkmod  p)mod  qr = (g^k \mod p) \mod q s=k−1(H(m)+xr)mod  qs = k^{-1} (H(m) + xr) \mod q

If r=0r = 0 or s=0s = 0, do it again with another kk. The signature is (r,s)(r, s).

Verification

  • Verify that 0<r<q0 < r < q and 0<s<q0 < s < q.
  • Compute w=s−1mod  qw = s^{-1} \mod q.
  • Compute u1=H(m)wmod  qu_1 = H(m)w \mod q and u2=rwmod  qu_2 = rw \mod q.
  • Compute v=(gu1yu2mod  p)mod  qv = (g^{u_1} y^{u_2} \mod p) \mod q.
  • Iif v=rv = r, the signature is valid.

Attacks

  • No hash function - StackExchange

    If message is directly signed without hashing, it is possible to forge create messages that have the same signature.