Digital Signature Algorithm
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. DSA is a variant of the Schnorr and ElGamal signature schemes.[1]:486
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.[3] 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]:484 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,[4] FIPS 186–2 in 2000,[5] FIPS 186–3 in 2009,[6] FIPS 186–4 in 2013,[3] 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 U.S. Patent 5,231,668, 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 U.S. Patent 4,995,082 (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
- Choose an approved cryptographic hash function [math]\displaystyle{ H }[/math] with output length [math]\displaystyle{ |H| }[/math] bits. In the original DSS, [math]\displaystyle{ H }[/math] was always SHA-1, but the stronger SHA-2 hash functions are approved for use in the current DSS.[3][14] If [math]\displaystyle{ |H| }[/math] is greater than the modulus length [math]\displaystyle{ N }[/math], only the leftmost [math]\displaystyle{ N }[/math] bits of the hash output are used.
- Choose a key length [math]\displaystyle{ L }[/math]. The original DSS constrained [math]\displaystyle{ L }[/math] 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]
- Choose the modulus length [math]\displaystyle{ N }[/math] such that [math]\displaystyle{ N \lt L }[/math] and [math]\displaystyle{ N \leq |H| }[/math]. FIPS 186-4 specifies [math]\displaystyle{ L }[/math] and [math]\displaystyle{ N }[/math] to have one of the values: (1024, 160), (2048, 224), (2048, 256), or (3072, 256).[3]
- Choose an [math]\displaystyle{ N }[/math]-bit prime [math]\displaystyle{ q }[/math].
- Choose an [math]\displaystyle{ L }[/math]-bit prime [math]\displaystyle{ p }[/math] such that [math]\displaystyle{ p - 1 }[/math] is a multiple of [math]\displaystyle{ q }[/math].
- Choose an integer [math]\displaystyle{ h }[/math] randomly from [math]\displaystyle{ \{ 2 \ldots p-2 \} }[/math].
- Compute [math]\displaystyle{ g := h^{(p - 1)/q} \mod p }[/math]. In the rare case that [math]\displaystyle{ g=1 }[/math] try again with a different [math]\displaystyle{ h }[/math]. Commonly [math]\displaystyle{ h=2 }[/math] is used. This modular exponentiation can be computed efficiently even if the values are large.
The algorithm parameters are ([math]\displaystyle{ p }[/math], [math]\displaystyle{ q }[/math], [math]\displaystyle{ g }[/math]). 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:
- Choose an integer [math]\displaystyle{ x }[/math] randomly from [math]\displaystyle{ \{ 1 \ldots q-1 \} }[/math].
- Compute [math]\displaystyle{ y := g^x \mod p }[/math].
[math]\displaystyle{ x }[/math] is the private key and [math]\displaystyle{ y }[/math] is the public key.
2. Key distribution
The signer should publish the public key [math]\displaystyle{ y }[/math]. 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 [math]\displaystyle{ x }[/math] secret.
3. Signing
A message [math]\displaystyle{ m }[/math] is signed as follows:
- Choose an integer [math]\displaystyle{ k }[/math] randomly from [math]\displaystyle{ \{ 1 \ldots q-1 \} }[/math]
- Compute [math]\displaystyle{ r := \left(g^{k}\bmod\,p\right)\bmod\,q }[/math]. In the unlikely case that [math]\displaystyle{ r=0 }[/math], start again with a different random [math]\displaystyle{ k }[/math].
- Compute [math]\displaystyle{ s := \left(k^{-1}\left(H(m)+xr\right)\right)\bmod\,q }[/math]. In the unlikely case that [math]\displaystyle{ s=0 }[/math], start again with a different random [math]\displaystyle{ k }[/math].
The signature is [math]\displaystyle{ \left(r,s\right) }[/math]
The calculation of [math]\displaystyle{ k }[/math] and [math]\displaystyle{ r }[/math] amounts to creating a new per-message key. The modular exponentiation in computing [math]\displaystyle{ r }[/math] is the most computationally expensive part of the signing operation, but it may be computed before the message is known. Calculating the modular inverse [math]\displaystyle{ k^{-1}\bmod\,q }[/math] 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 [math]\displaystyle{ k^{q-2}\bmod\,q }[/math].
4. Signature Verification
One can verify that a signature [math]\displaystyle{ \left(r,s\right) }[/math] is a valid signature for a message [math]\displaystyle{ m }[/math] as follows:
- Verify that [math]\displaystyle{ 0 \lt r \lt q }[/math] and [math]\displaystyle{ 0 \lt s \lt q }[/math].
- Compute [math]\displaystyle{ w := s^{-1} \bmod\,q }[/math].
- Compute [math]\displaystyle{ u_1 := H(m) \cdot w\, \bmod\,q }[/math].
- Compute [math]\displaystyle{ u_2 := r \cdot w\, \bmod\,q }[/math].
- Compute [math]\displaystyle{ v := \left(g^{u_1}y^{u_2} \bmod\,p\right) \bmod\,q }[/math].
- The signature is valid if and only if [math]\displaystyle{ v = r }[/math].
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 [math]\displaystyle{ g=h^{(p-1)/q}~\text{mod}~p }[/math], it follows that [math]\displaystyle{ g^q \equiv h^{p-1} \equiv 1 \mod p }[/math] by Fermat's little theorem. Since [math]\displaystyle{ g\gt 0 }[/math] and [math]\displaystyle{ q }[/math] is prime, [math]\displaystyle{ g }[/math] must have order [math]\displaystyle{ q }[/math].
The signer computes
- [math]\displaystyle{ s=k^{-1}(H(m)+xr)\bmod\,q }[/math]
Thus
- [math]\displaystyle{ \begin{align} k & \equiv H(m)s^{-1}+xrs^{-1}\\ & \equiv H(m)w + xrw \pmod{q} \end{align} }[/math]
Since [math]\displaystyle{ g }[/math] has order [math]\displaystyle{ q }[/math] we have
- [math]\displaystyle{ \begin{align} g^k & \equiv g^{H(m)w}g^{xrw}\\ & \equiv g^{H(m)w}y^{rw}\\ & \equiv g^{u_1}y^{u_2} \pmod{p} \end{align} }[/math]
Finally, the correctness of DSA follows from
- [math]\displaystyle{ \begin{align} r &= (g^k \bmod\,p) \bmod\,q\\ &= (g^{u_1}y^{u_2} \bmod\,p) \bmod\,q\\ &= v \end{align} }[/math]
Sensitivity
With DSA, the entropy, secrecy, and uniqueness of the random signature value [math]\displaystyle{ k }[/math] 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 [math]\displaystyle{ k }[/math] secret), using a predictable value, or leaking even a few bits of [math]\displaystyle{ k }[/math] in each of several signatures, is enough to reveal the private key [math]\displaystyle{ x }[/math].[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 [math]\displaystyle{ k }[/math] for each signature.[18]
This issue can be prevented by deriving [math]\displaystyle{ k }[/math] deterministically from the private key and the message hash, as described by RFC 6979. This ensures that [math]\displaystyle{ k }[/math] is different for each [math]\displaystyle{ H(m) }[/math] and unpredictable for attackers who do not know the private key [math]\displaystyle{ x }[/math].
In addition, malicious implementations of DSA and ECDSA can be created where [math]\displaystyle{ k }[/math] 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
References
- ↑ 1.0 1.1 Schneier, Bruce (1996). Applied Cryptography. Wiley. ISBN 0-471-11709-9. https://archive.org/details/Applied_Cryptography_2nd_ed._B._Schneier.
- ↑ "FIPS PUB 186: Digital Signature Standard (DSS), 1994-05-19". http://www.itl.nist.gov/fipspubs/fip186.htm.
- ↑ 3.0 3.1 3.2 3.3 "FIPS PUB 186-4: Digital Signature Standard (DSS), July 2013". http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf.
- ↑ "FIPS PUB 186-1: Digital Signature Standard (DSS), 1998-12-15". http://csrc.nist.gov/publications/fips/fips1861.pdf.
- ↑ "FIPS PUB 186-2: Digital Signature Standard (DSS), 2000-01-27". http://csrc.nist.gov/publications/fips/archive/fips186-2/fips186-2.pdf.
- ↑ "FIPS PUB 186-3: Digital Signature Standard (DSS), June 2009". http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf.
- ↑ "FIPS PUB 186-5: Digital Signature Standard (DSS), February 2023". https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf.
- ↑ "Digital Signature Standard (DSS)" (in en). U.S. Department of Commerce. 31 October 2019. https://csrc.nist.gov/publications/detail/fips/186/5/draft.
- ↑ Dr. David W. Kravitz
- ↑ Werner Koch. "DSA and patents"
- ↑ "1994 Annual Report of CSSPAB". 26 August 2009. http://csrc.nist.gov/groups/SMA/ispab/documents/94-rpt.txt.
- ↑ Neumann, Peter G. (2020-02-29). "The RISKS Digest Volume 14 Issue 59". https://catless.ncl.ac.uk/Risks/14/59.
- ↑ "OpenSSH announces DSA-removal timeline [LWN.net"]. https://lwn.net/Articles/958048/.
- ↑ "FIPS PUB 180-4: Secure Hash Standard (SHS), March 2012". http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf.
- ↑ "NIST Special Publication 800-57". http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf.
- ↑ "The Debian PGP disaster that almost was". root labs rdist. 18 May 2009. http://rdist.root.org/2009/05/17/the-debian-pgp-disaster-that-almost-was/.
- ↑ DSA [math]\displaystyle{ k }[/math]-value Requirements
- ↑ Bendel, Mike (2010-12-29). "Hackers Describe PS3 Security As Epic Fail, Gain Unrestricted Access". Exophase.com. http://exophase.com/20540/hackers-describe-ps3-security-as-epic-fail-gain-unrestricted-access/.
- ↑ Verbücheln, Stephan (2 January 2015). "How Perfect Offline Wallets Can Still Leak Bitcoin Private Keys". arXiv:1501.00447 [cs.CR].
External links
- FIPS PUB 186-4: Digital Signature Standard (DSS), the fourth (and current) revision of the official DSA specification.
- Recommendation for Key Management -- Part 1: general, NIST Special Publication 800-57, p. 62–63
Original source: https://en.wikipedia.org/wiki/Digital Signature Algorithm.
Read more |