- Source: 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. 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.: 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. 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.: 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, FIPS 186–2 in 2000, FIPS 186–3 in 2009, FIPS 186–4 in 2013, and FIPS 186–5 in 2023. 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.
DSA is covered by U.S. patent 5,231,668, filed July 26, 1991 and now expired, and attributed to David W. Kravitz, 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. Claus P. Schnorr claims that his U.S. patent 4,995,082 (also now expired) covered DSA; this claim is disputed.
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.
OpenSSH announced that DSA is scheduled to be removed in 2025.
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
H
{\displaystyle H}
with output length
|
H
|
{\displaystyle |H|}
bits. In the original DSS,
H
{\displaystyle H}
was always SHA-1, but the stronger SHA-2 hash functions are approved for use in the current DSS. If
|
H
|
{\displaystyle |H|}
is greater than the modulus length
N
{\displaystyle N}
, only the leftmost
N
{\displaystyle N}
bits of the hash output are used.
Choose a key length
L
{\displaystyle L}
. The original DSS constrained
L
{\displaystyle 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).
Choose the modulus length
N
{\displaystyle N}
such that
N
<
L
{\displaystyle N
and
N
≤
|
H
|
{\displaystyle N\leq |H|}
. FIPS 186-4 specifies
L
{\displaystyle L}
and
N
{\displaystyle N}
to have one of the values: (1024, 160), (2048, 224), (2048, 256), or (3072, 256).
Choose an
N
{\displaystyle N}
-bit prime
q
{\displaystyle q}
.
Choose an
L
{\displaystyle L}
-bit prime
p
{\displaystyle p}
such that
p
−
1
{\displaystyle p-1}
is a multiple of
q
{\displaystyle q}
.
Choose an integer
h
{\displaystyle h}
randomly from
{
2
…
p
−
2
}
{\displaystyle \{2\ldots p-2\}}
.
Compute
g
:=
h
(
p
−
1
)
/
q
mod
p
{\displaystyle g:=h^{(p-1)/q}\mod p}
. In the rare case that
g
=
1
{\displaystyle g=1}
try again with a different
h
{\displaystyle h}
. Commonly
h
=
2
{\displaystyle h=2}
is used. This modular exponentiation can be computed efficiently even if the values are large.
The algorithm parameters are (
p
{\displaystyle p}
,
q
{\displaystyle q}
,
g
{\displaystyle 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:
Choose an integer
x
{\displaystyle x}
randomly from
{
1
…
q
−
1
}
{\displaystyle \{1\ldots q-1\}}
.
Compute
y
:=
g
x
mod
p
{\displaystyle y:=g^{x}\mod p}
.
x
{\displaystyle x}
is the private key and
y
{\displaystyle y}
is the public key.
= 2. Key distribution
=The signer should publish the public key
y
{\displaystyle 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
{\displaystyle x}
secret.
= 3. Signing
=A message
m
{\displaystyle m}
is signed as follows:
Choose an integer
k
{\displaystyle k}
randomly from
{
1
…
q
−
1
}
{\displaystyle \{1\ldots q-1\}}
Compute
r
:=
(
g
k
mod
p
)
mod
q
{\displaystyle r:=\left(g^{k}{\bmod {\,}}p\right){\bmod {\,}}q}
. In the unlikely case that
r
=
0
{\displaystyle r=0}
, start again with a different random
k
{\displaystyle k}
.
Compute
s
:=
(
k
−
1
(
H
(
m
)
+
x
r
)
)
mod
q
{\displaystyle s:=\left(k^{-1}\left(H(m)+xr\right)\right){\bmod {\,}}q}
. In the unlikely case that
s
=
0
{\displaystyle s=0}
, start again with a different random
k
{\displaystyle k}
.
The signature is
(
r
,
s
)
{\displaystyle \left(r,s\right)}
The calculation of
k
{\displaystyle k}
and
r
{\displaystyle r}
amounts to creating a new per-message key. The modular exponentiation in computing
r
{\displaystyle 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
mod
q
{\displaystyle k^{-1}{\bmod {\,}}q}
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
k
q
−
2
mod
q
{\displaystyle k^{q-2}{\bmod {\,}}q}
.
= 4. Signature Verification
=One can verify that a signature
(
r
,
s
)
{\displaystyle \left(r,s\right)}
is a valid signature for a message
m
{\displaystyle m}
as follows:
Verify that
0
<
r
<
q
{\displaystyle 0
and
0
<
s
<
q
{\displaystyle 0
.
Compute
w
:=
s
−
1
mod
q
{\displaystyle w:=s^{-1}{\bmod {\,}}q}
.
Compute
u
1
:=
H
(
m
)
⋅
w
mod
q
{\displaystyle u_{1}:=H(m)\cdot w\,{\bmod {\,}}q}
.
Compute
u
2
:=
r
⋅
w
mod
q
{\displaystyle u_{2}:=r\cdot w\,{\bmod {\,}}q}
.
Compute
v
:=
(
g
u
1
y
u
2
mod
p
)
mod
q
{\displaystyle v:=\left(g^{u_{1}}y^{u_{2}}{\bmod {\,}}p\right){\bmod {\,}}q}
.
The signature is valid if and only if
v
=
r
{\displaystyle 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
(
p
−
1
)
/
q
mod
p
{\textstyle g=h^{(p-1)/q}~{\text{mod}}~p}
, it follows that
g
q
≡
h
p
−
1
≡
1
mod
p
{\textstyle g^{q}\equiv h^{p-1}\equiv 1\mod p}
by Fermat's little theorem. Since
g
>
0
{\displaystyle g>0}
and
q
{\displaystyle q}
is prime,
g
{\displaystyle g}
must have order
q
{\displaystyle q}
.
The signer computes
s
=
k
−
1
(
H
(
m
)
+
x
r
)
mod
q
{\displaystyle s=k^{-1}(H(m)+xr){\bmod {\,}}q}
Thus
k
≡
H
(
m
)
s
−
1
+
x
r
s
−
1
≡
H
(
m
)
w
+
x
r
w
(
mod
q
)
{\displaystyle {\begin{aligned}k&\equiv H(m)s^{-1}+xrs^{-1}\\&\equiv H(m)w+xrw{\pmod {q}}\end{aligned}}}
Since
g
{\displaystyle g}
has order
q
{\displaystyle q}
we have
g
k
≡
g
H
(
m
)
w
g
x
r
w
≡
g
H
(
m
)
w
y
r
w
≡
g
u
1
y
u
2
(
mod
p
)
{\displaystyle {\begin{aligned}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{aligned}}}
Finally, the correctness of DSA follows from
r
=
(
g
k
mod
p
)
mod
q
=
(
g
u
1
y
u
2
mod
p
)
mod
q
=
v
{\displaystyle {\begin{aligned}r&=(g^{k}{\bmod {\,}}p){\bmod {\,}}q\\&=(g^{u_{1}}y^{u_{2}}{\bmod {\,}}p){\bmod {\,}}q\\&=v\end{aligned}}}
Sensitivity
With DSA, the entropy, secrecy, and uniqueness of the random signature value
k
{\displaystyle k}
are critical. It is so critical that violating any one of those three requirements can reveal the entire private key to an attacker. Using the same value twice (even while keeping
k
{\displaystyle k}
secret), using a predictable value, or leaking even a few bits of
k
{\displaystyle k}
in each of several signatures, is enough to reveal the private key
x
{\displaystyle x}
.
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
{\displaystyle k}
for each signature.
This issue can be prevented by deriving
k
{\displaystyle k}
deterministically from the private key and the message hash, as described by RFC 6979. This ensures that
k
{\displaystyle k}
is different for each
H
(
m
)
{\displaystyle H(m)}
and unpredictable for attackers who do not know the private key
x
{\displaystyle x}
.
In addition, malicious implementations of DSA and ECDSA can be created where
k
{\displaystyle 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.
Implementations
Below is a list of cryptographic libraries that provide support for DSA:
Botan
Bouncy Castle
cryptlib
Crypto++
libgcrypt
Nettle
OpenSSL
wolfCrypt
GnuTLS
See also
Modular arithmetic
RSA (cryptosystem)
ECDSA
References
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
Kata Kunci Pencarian:
- Enkripsi
- RSA
- MD5
- Bruce Schneier
- Fernando de Magelhaens
- Leslie Lamport
- Digital Signature Algorithm
- Elliptic Curve Digital Signature Algorithm
- Digital signature
- Digital Signature Standard
- EdDSA
- ElGamal signature scheme
- Public-key cryptography
- BLS digital signature
- Rabin cryptosystem
- ElGamal encryption