## FANDOM

573 Pages

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 Edit

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 $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: $4 t$ bits, where $t$ is the security level measured in bits, that is, about 320 bits for a security level of 80 bits.

## Signature generation algorithm Edit

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

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

For Alice to sign a message $m$, she follows these steps:

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

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

## Signature verification algorithm Edit

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

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

After that, Bob follows these steps:

1. Verify that $r$ and $s$ are integers in $[1, n-1]$. If not, the signature is invalid.
2. Calculate $e = \textrm{HASH}(m)$, where HASH is the same function used in the signature generation. Let $z$ be the $L_n$ leftmost bits of $e$.
3. Calculate $w = s^{-1} \pmod{n}$.
4. Calculate $u_1 = zw \pmod{n}$ and $u_2 = rw \pmod{n}$.
5. Calculate $(x_1, y_1) = u_1 G + u_2 Q_A$.
6. The signature is valid if $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 $u_1 G + u_2 Q_A$ can be calculated faster than with two scalar multiplications.

## Edit

Community content is available under CC-BY-SA unless otherwise noted.