Elliptic Curve Digital Signature Algorithm In cryptography,…

metamitya ·

Elliptic Curve Digital Signature Algorithm
In cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic-curve cryptography.
Key and signature sizes
[edit]As with elliptic-curve cryptography in general, the bit size of the private key believed to be needed for ECDSA is about twice the size of the security level, in bits.[1] For example, at a security level of 80 bits—meaning an attacker requires a maximum of about operations to find the private key—the size of an ECDSA private key would be 160 bits. On the other hand, the signature size is the same for both DSA and ECDSA: approximately bits, where is the exponent in the formula , that is, about 320 bits for a security level of 80 bits, which is equivalent to operations.
Signature generation algorithm
[edit]Suppose Alice wants to send a signed message to Bob. Initially, they must agree on the curve parameters . In addition to the field and equation of the curve, we need , a base point of prime order on the curve; is the multiplicative order of the point .
| Parameter | |
|---|---|
| CURVE | the elliptic curve field and equation used |
| G | elliptic curve base point, a point on the curve that generates a subgroup of large prime order n |
| n | integer order of G, means that , where is the identity element. |
| the private key (randomly selected) | |
| the public key (calculated by elliptic curve) | |
| m | the message to send |
The order of the base point must be prime. Indeed, we assume that every nonzero element of the ring is invertible, so that must be a field. It implies that must be prime (cf. Bézout's identity).
Alice creates a key pair, consisting of a private key integer , randomly selected in the interval ; and a public key curve point . We use to denote elliptic curve point multiplication by a scalar.
For Alice to sign a message , she follows these steps:
- Calculate . (Here HASH is a cryptographic hash function, such as SHA-2, with the output converted to an integer.)
- Let be the leftmost bits of , where is the bit length of the group order . (Note that can be greater than but not longer.[2])
- Select a cryptographically secure random integer from .
- Calculate the curve point .
- Calculate . If , go back to step 3.
- Calculate . If , go back to step 3.
- The signature is the pair . (And is also a valid signature.)
As the standard notes, it is not only required for to be secret, but it is also crucial to select different for different signatures. Otherwise, the equation in step 6 can be solved for , the private key: given two signatures and , employing the same unknown for different known messages and , an attacker can calculate and , and since (all operations in this paragraph are done modulo ) the attacker can find . Since , the attacker can now calculate the private key .
This implementation failure was used, for example, to extract the signing key used for the PlayStation 3 gaming-console.[3]
Another way ECDSA signature may leak private keys is when is generated by a faulty random number generator. Such a failure in random number generation caused users of Android Bitcoin Wallet to lose their funds in August 2013.[4]
To ensure that is unique for each message, one may bypass random number generation completely and generate deterministic signatures by deriving from both the message and the private key.[5]
Signature verification algorithm
[edit]For Bob to authenticate Alice's signature on a message , he must have a copy of her public-key curve point . Bob can verify is a valid curve point as follows:
- Check that is not equal to the identity element O, and its coordinates are otherwise valid.
- Check that lies on the curve.
- Check that .
After that, Bob follows these steps:
- Verify that r and s are integers in . If not, the signature is invalid.
- Calculate , where HASH is the same function used in the signature generation.
- Let be the leftmost bits of e.
- Calculate and .
- Calculate the curve point . If then the signature is invalid.
- The signature is valid if , invalid otherwise.
Note that an efficient implementation would compute inverse only once. Also, using Shamir's trick, a sum of two scalar multiplications can be calculated faster than two scalar multiplications done independently.[6]
Correctness of the algorithm
[edit]It is not immediately obvious why verification even functions correctly. To see why, denote as C the curve point computed in step 5 of verification,
From the definition of the public key as ,
Because elliptic curve scalar multiplication distributes over addition,
Expanding the definition of and from verification step 4,
Collecting the common term ,
Expanding the definition of s from signature step 6,
Since the inverse of an inverse is the original element, and the product of an element's inverse and the element is the identity, we are left with
From the definition of r, this is verification step 6.
This shows only that a correctl…