The Elliptic Curve Digital Signature Algorithm (ECDSA) is the elliptic curve analogue of the Digital Signature Algorithm (DSA). It uses elliptic curve cryptography to provide the same level of security as DSA with smaller key sizes. Below is a description of the algorithm for generating and verifying an ECDSA signature.
Preconditions:
Before starting the ECDSA process, we need to define the domain parameters over which the elliptic curve is defined. These are the constants that define the particular curve being used.
- An elliptic curve
E over a finite field F_p with equation y^2 = x^3 + ax + b.
- A base point
G on the curve E that generates a cyclic subgroup of prime order n.
- Private key
d, a randomly selected integer in the range [1, n-1].
- Corresponding public key
Q = dG, which is a point on the curve.
Signature Generation Algorithm:
- Choose a cryptographically secure random integer
k from [1, n-1].
- Compute the point on the curve
(x1, y1) = kG.
- Calculate
r = x1 mod n. If r = 0, choose another k and start again.
- Compute
s = k^(-1)(z + rd) mod n. Here, z is the leftmost L_n bits of the hash of the message m, where L_n is the bit length of the prime n. If s = 0, choose another k and start again.
- The signature is the pair
(r, s).
Signature Verification Algorithm:
- Obtain an authentic copy of the domain parameters (
E, F_p, a, b, G, n).
- Verify that
r and s are integers in [1, n-1]. If not, the signature is invalid.
- Calculate
z, the leftmost L_n bits of the hash of the message m.
- Compute
w = s^(-1) mod n.
- Calculate
u1 = zw mod n and u2 = rw mod n.
- Compute the point
(x2, y2) = u1G + u2Q.
- If
(x2, y2) is the point at infinity, the signature is not valid.
- Calculate
v = x2 mod n.
- The signature is valid if and only if
v = r.
Example:
Let's go through a simplified example of ECDSA signature generation and verification where we use symbolic representations for several values instead of actual numerical computations.
Signature Generation:
- Assume Alice has a private key
d_A and the corresponding public key Q_A = d_A * G.
- Alice wants to sign a message 'm.'
- Alice selects a random integer
k from [1, n-1].
- She computes the point
(x1, y1) = kG.
- She calculates
r = x1 mod n. (r must not be zero.)
- She computes
s = k^(-1)(z + r * d_A) mod n. (s must not be zero.)
- The signature is
(r, s).
Signature Verification:
- Assume Bob has Alice's public key
Q_A and the signature (r, s) on the message m.
- Bob computes
z from the message m.
- He calculates
w = s^(-1) mod n.
- He calculates
u1 = z * w mod n and u2 = r * w mod n.
- He computes
(x2, y2) = u1G + u2Q_A.
- He calculates
v = x2 mod n.
- If
v = r, the signature is valid.
The actual implementation of ECDSA includes many details that are beyond the scope of this simplified explanation, including the choice of hash functions, encoding of points on the curve, and various protections against cryptographic attacks. Nonetheless, this description provides a foundational understanding of how ECDSA generates and verifies digital signatures using elliptic curves.