The Elliptic Curve Digital Signature Algorithm (ECDSA) is a variant of the Digital Signature Algorithm (DSA) which uses Elliptic curve cryptography.

## Key and signature size comparison to DSA

As with elliptic curve cryptography in general, the bit size of the public key believed to be needed for ECDSA is about twice the size of the security level, in bits. By comparison, at a security level of 80 bits, meaning an attacker requires about the equivalent of about ${\displaystyle 2^{80}}$ signature generations to find the private key, the size of a DSA public key is at least 1024 bits, whereas the size of an ECDSA public key would be 160 bits. On the other hand, the signature size is the same for both DSA and ECDSA: ${\displaystyle 4 t}$ bits, where ${\displaystyle t}$ is the security level measured in bits, that is, about 320 bits for a security level of 80 bits.

## Signature generation algorithm

Suppose Alice wants to send a signed message to Bob. Initially, the curve parameters ${\displaystyle (q, FR, a, b,[DomainParameterSeed,] G, n, h)}$ must be agreed upon. ${\displaystyle q}$ is the field size; ${\displaystyle FR}$ is an indication of the basis used; ${\displaystyle a}$ and ${\displaystyle b}$ are two field elements that define the equation of the curve; ${\displaystyle DomainParameterSeed}$ is an optional bit string that is present if the elliptic curve was randomly generated in a verifiable fashion;${\displaystyle G}$ is a base point of prime order on the curve (i.e., ${\displaystyle G = (x_G, y_G)}$); ${\displaystyle n}$ is the order of the point ${\displaystyle G}$; and ${\displaystyle h}$ is the cofactor (which is equal to the order of the curve divided by ${\displaystyle n}$).

Also, Alice must have a key pair suitable for elliptic curve cryptography, consisting of a private key ${\displaystyle d_A}$ (a randomly selected integer in the interval ${\displaystyle [1, n-1]}$) and a public key ${\displaystyle Q_A}$ (where ${\displaystyle Q_A = d_A G}$). Let ${\displaystyle L_n}$ be the bit length of the group order ${\displaystyle n}$.

For Alice to sign a message ${\displaystyle m}$, she follows these steps:

1. Calculate ${\displaystyle e = \textrm{HASH}(m)}$, where HASH is a cryptographic hash function, such as SHA-1, and let ${\displaystyle z}$ be the ${\displaystyle L_n}$ leftmost bits of ${\displaystyle e}$.
2. Select a random integer ${\displaystyle k}$ from ${\displaystyle [1, n-1]}$.
3. Calculate ${\displaystyle r = x_1 \pmod{n}}$, where ${\displaystyle (x_1, y_1) = k G}$. If ${\displaystyle r = 0}$, go back to step 2.
4. Calculate ${\displaystyle s = k^{-1}(z + r d_A ) \pmod{n}}$. If ${\displaystyle s=0}$, go back to step 2.
5. The signature is the pair ${\displaystyle (r, s)}$.

When computing ${\displaystyle s}$, the string ${\displaystyle z}$ resulting from ${\displaystyle \textrm{HASH}(m)}$ shall be converted to an integer. Note that ${\displaystyle z}$ can be greater than ${\displaystyle n}$ but not longer[1].

## Signature verification algorithm

For Bob to authenticate Alice's signature, he must have a copy of her public key ${\displaystyle Q_A}$. If he does not trust the source of ${\displaystyle Q_A}$, he needs to validate the key (${\displaystyle O}$ here indicates the identity element):

1. Check that ${\displaystyle Q_A}$ is not equal to ${\displaystyle O}$ and its coordinates are otherwise valid
2. Check that ${\displaystyle Q_A}$ lies on the curve
3. Check that ${\displaystyle nQ_A = O}$

After that, Bob follows these steps:

1. Verify that ${\displaystyle r}$ and ${\displaystyle s}$ are integers in ${\displaystyle [1, n-1]}$. If not, the signature is invalid.
2. Calculate ${\displaystyle e = \textrm{HASH}(m)}$, where HASH is the same function used in the signature generation. Let ${\displaystyle z}$ be the ${\displaystyle L_n}$ leftmost bits of ${\displaystyle e}$.
3. Calculate ${\displaystyle w = s^{-1} \pmod{n}}$.
4. Calculate ${\displaystyle u_1 = zw \pmod{n}}$ and ${\displaystyle u_2 = rw \pmod{n}}$.
5. Calculate ${\displaystyle (x_1, y_1) = u_1 G + u_2 Q_A}$.
6. The signature is valid if ${\displaystyle r = x_1 \pmod{n}}$, invalid otherwise.

Note that using Straus's algorithm (also known as Shamir's trick) a sum of two scalar multiplications ${\displaystyle u_1 G + u_2 Q_A}$ can be calculated faster than with two scalar multiplications.

## References

• Accredited Standards Committee X9, American National Standard X9.62-2005, Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA), November 16, 2005.
• Certicom Research, Standards for efficient cryptography, SEC 1: Elliptic Curve Cryptography, Version 2.0, May 21, 2009.
• López, J. and Dahab, R. An Overview of Elliptic Curve Cryptography, Technical Report IC-00-10, State University of Campinas, 2000.
• Daniel J. Bernstein, Pippenger's exponentiation algorithm, 2002.
• Daniel R. L. Brown, Generic Groups, Collision Resistance, and ECDSA, Designs, Codes and Cryptography, 35, 119-152, 2005. ePrint version
• Ian F. Blake, Gadiel Seroussi, and Nigel P. Smart, editors, Advances in Elliptic Curve Cryptography, London Mathematical Society Lecture Note Series 317, Cambridge University Press, 2005.
• Darrel Hankerson, Alfred Menezes and Scott Vanstone, Guide to Elliptic Curve Cryptography, Springer, Springer, 2004.