Digital Signature Algorithm Explained

The Digital Signature Algorithm (DSA) is a public-key cryptosystem and Federal Information Processing Standard for digital signatures, based on the mathematical concept of modular exponentiation and the discrete logarithm problem. In a public-key cryptosystem, two keys are generated: data can only be encrypted with the public key and encrypted data can only be decrypted with the private key. DSA is a variant of the Schnorr and ElGamal signature schemes.[1]

The National Institute of Standards and Technology (NIST) proposed DSA for use in their Digital Signature Standard (DSS) in 1991, and adopted it as FIPS 186 in 1994.[2] Five revisions to the initial specification have been released. The newest specification is: FIPS 186-5 from February 2023. DSA is patented but NIST has made this patent available worldwide royalty-free. Specification FIPS 186-5 indicates DSA will no longer be approved for digital signature generation, but may be used to verify signatures generated prior to the implementation date of that standard.

Overview

The DSA works in the framework of public-key cryptosystems and is based on the algebraic properties of modular exponentiation, together with the discrete logarithm problem, which is considered to be computationally intractable. The algorithm uses a key pair consisting of a public key and a private key. The private key is used to generate a digital signature for a message, and such a signature can be verified by using the signer's corresponding public key. The digital signature provides message authentication (the receiver can verify the origin of the message), integrity (the receiver can verify that the message has not been modified since it was signed) and non-repudiation (the sender cannot falsely claim that they have not signed the message).

History

In 1982, the U.S government solicited proposals for a public key signature standard. In August 1991 the National Institute of Standards and Technology (NIST) proposed DSA for use in their Digital Signature Standard (DSS). Initially there was significant criticism, especially from software companies that had already invested effort in developing digital signature software based on the RSA cryptosystem.[1] Nevertheless, NIST adopted DSA as a Federal standard (FIPS 186) in 1994. Five revisions to the initial specification have been released: FIPS 186–1 in 1998,[3] FIPS 186–2 in 2000,[4] FIPS 186–3 in 2009,[5] FIPS 186–4 in 2013,[6] and FIPS 186–5 in 2023.[7] Standard FIPS 186-5 forbids signing with DSA, while allowing verification of signatures generated prior to the implementation date of the standard as a document. It is to be replaced by newer signature schemes such as EdDSA.[8]

DSA is covered by, filed July 26, 1991 and now expired, and attributed to David W. Kravitz,[9] a former NSA employee. This patent was given to "The United States of America as represented by the Secretary of Commerce, Washington, D.C.", and NIST has made this patent available worldwide royalty-free.[10] Claus P. Schnorr claims that his (also now expired) covered DSA; this claim is disputed.[11]

In 1993, Dave Banisar managed to get confirmation, via a FOIA request, that the DSA algorithm hasn't been designed by the NIST, but by the NSA.[12]

OpenSSH announced that DSA is scheduled to be removed in 2025.[13]

Operation

The DSA algorithm involves four operations: key generation (which creates the key pair), key distribution, signing and signature verification.

1. Key generation

Key generation has two phases. The first phase is a choice of algorithm parameters which may be shared between different users of the system, while the second phase computes a single key pair for one user.

Parameter generation

H

with output length

|H|

bits. In the original DSS,

H

was always SHA-1, but the stronger SHA-2 hash functions are approved for use in the current DSS.[6] [14] If

|H|

is greater than the modulus length

N

, only the leftmost

N

bits of the hash output are used.

L

. The original DSS constrained

L

to be a multiple of 64 between 512 and 1024 inclusive. NIST 800-57 recommends lengths of 2048 (or 3072) for keys with security lifetimes extending beyond 2010 (or 2030).[15]

N

such that

N<L

and

N\leq|H|

. FIPS 186-4 specifies

L

and

N

to have one of the values: (1024, 160), (2048, 224), (2048, 256), or (3072, 256).

N

-bit prime

q

.

L

-bit prime

p

such that

p-1

is a multiple of

q

.

h

randomly from

\{2\ldotsp-2\}

.

g:=h(p\modp

. In the rare case that

g=1

try again with a different

h

. Commonly

h=2

is used. This modular exponentiation can be computed efficiently even if the values are large.The algorithm parameters are (

p

,

q

,

g

). These may be shared between different users of the system.

Per-user keys

Given a set of parameters, the second phase computes the key pair for a single user:

x

randomly from

\{1\ldotsq-1\}

.

y:=gx\modp

.

x

is the private key and

y

is the public key.

2. Key distribution

The signer should publish the public key

y

. That is, they should send the key to the receiver via a reliable, but not necessarily secret, mechanism. The signer should keep the private key

x

secret.

3. Signing

A message

m

is signed as follows:

k

randomly from

\{1\ldotsq-1\}

r:=\left(gk\bmodp\right)\bmodq

. In the unlikely case that

r=0

, start again with a different random

k

.

s:=\left(k-1\left(H(m)+xr\right)\right)\bmodq

. In the unlikely case that

s=0

, start again with a different random

k

.The signature is

\left(r,s\right)

The calculation of

k

and

r

amounts to creating a new per-message key. The modular exponentiation in computing

r

is the most computationally expensive part of the signing operation, but it may be computed before the message is known.Calculating the modular inverse

k-1\bmodq

is the second most expensive part, and it may also be computed before the message is known. It may be computed using the extended Euclidean algorithm or using Fermat's little theorem as

kq-2\bmodq

.

4. Signature Verification

One can verify that a signature

\left(r,s\right)

is a valid signature for a message

m

as follows:

0<r<q

and

0<s<q

.

w:=s-1\bmodq

.

u1:=H(m)w\bmodq

.

u2:=rw\bmodq

.

v:=

u1
\left(g
u2
y

\bmodp\right)\bmodq

.

v=r

.

Correctness of the algorithm

The signature scheme is correct in the sense that the verifier will always accept genuine signatures. This can be shown as follows:

First, since g=h^~\text~p, it follows that g^q \equiv h^ \equiv 1 \mod p by Fermat's little theorem. Since

g>0

and

q

is prime,

g

must have order 

q

.

The signer computes

s=k-1(H(m)+xr)\bmodq

Thus

\begin{align} k&\equivH(m)s-1+xrs-1\\ &\equivH(m)w+xrw\pmod{q} \end{align}

Since

g

has order

q

we have

\begin{align} gk&\equivgH(m)wgxrw\\ &\equivgH(m)wyrw\\ &\equiv

u1
g
u2
y

\pmod{p} \end{align}

Finally, the correctness of DSA follows from

\begin{align} r&=(gk\bmodp)\bmodq\\ &=

u1
(g
u2
y

\bmodp)\bmodq\\ &=v \end{align}

Sensitivity

With DSA, the entropy, secrecy, and uniqueness of the random signature value

k

are critical. It is so critical that violating any one of those three requirements can reveal the entire private key to an attacker.[16] Using the same value twice (even while keeping

k

secret), using a predictable value, or leaking even a few bits of

k

in each of several signatures, is enough to reveal the private key

x

.[17]

This issue affects both DSA and Elliptic Curve Digital Signature Algorithm (ECDSA) – in December 2010, the group fail0verflow announced the recovery of the ECDSA private key used by Sony to sign software for the PlayStation 3 game console. The attack was made possible because Sony failed to generate a new random

k

for each signature.[18]

This issue can be prevented by deriving

k

deterministically from the private key and the message hash, as described by . This ensures that

k

is different for each

H(m)

and unpredictable for attackers who do not know the private key

x

.

In addition, malicious implementations of DSA and ECDSA can be created where

k

is chosen in order to subliminally leak information via signatures. For example, an offline private key could be leaked from a perfect offline device that only released innocent-looking signatures.[19]

Implementations

Below is a list of cryptographic libraries that provide support for DSA:

See also

External links

Notes and References

  1. Book: Schneier, Bruce. 1996. Applied Cryptography. Wiley . 0-471-11709-9.
  2. Web site: FIPS PUB 186: Digital Signature Standard (DSS), 1994-05-19. qcsrc.nist.gov. dead. https://web.archive.org/web/20131213131144/http://www.itl.nist.gov/fipspubs/fip186.htm. 2013-12-13.
  3. Web site: FIPS PUB 186-1: Digital Signature Standard (DSS), 1998-12-15. csrc.nist.gov. dead. https://web.archive.org/web/20131226115544/http://csrc.nist.gov/publications/fips/fips1861.pdf. 2013-12-26.
  4. Web site: FIPS PUB 186-2: Digital Signature Standard (DSS), 2000-01-27. csrc.nist.gov.
  5. Web site: FIPS PUB 186-3: Digital Signature Standard (DSS), June 2009. csrc.nist.gov.
  6. Web site: FIPS PUB 186-4: Digital Signature Standard (DSS), July 2013. csrc.nist.gov.
  7. Web site: FIPS PUB 186-5: Digital Signature Standard (DSS), February 2023. csrc.nist.gov.
  8. Web site: Digital Signature Standard (DSS) . U.S. Department of Commerce . 21 July 2020 . en . 31 October 2019.
  9. http://www.certicom.com/index.php/dr-david-kravitz Dr. David W. Kravitz
  10. Werner Koch. "DSA and patents"
  11. Web site: 1994 Annual Report of CSSPAB. https://web.archive.org/web/20090826042831/http://csrc.nist.gov/groups/SMA/ispab/documents/94-rpt.txt. dead. 26 August 2009. 26 August 2009.
  12. Web site: 2020-02-29 . The RISKS Digest Volume 14 Issue 59 . 14 . 59 . 2023-10-03 . 2020-02-29 . https://web.archive.org/web/20200229145033/https://catless.ncl.ac.uk/Risks/14/59 . bot: unknown . Neumann . Peter G. .
  13. Web site: OpenSSH announces DSA-removal timeline [LWN.net] ]. lwn.net . 11 January 2024.
  14. Web site: FIPS PUB 180-4: Secure Hash Standard (SHS), March 2012. csrc.nist.gov.
  15. Web site: NIST Special Publication 800-57 . csrc.nist.gov . dead . https://web.archive.org/web/20140606050814/http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf . 2014-06-06 .
  16. Web site: The Debian PGP disaster that almost was. root labs rdist. 18 May 2009 .
  17. https://rdist.root.org/2010/11/19/dsa-requirements-for-random-k-value/ DSA

    k

    -value Requirements
  18. News: Bendel. Mike. Hackers Describe PS3 Security As Epic Fail, Gain Unrestricted Access. Exophase.com. 2010-12-29. 2011-01-05.
  19. How Perfect Offline Wallets Can Still Leak Bitcoin Private Keys. Stephan. Verbücheln. 2 January 2015. 1501.00447. cs.CR.