As with elliptic-curve cryptography in general, the bitsize of theprivate key believed to be needed for ECDSA is about twice the size of thesecurity 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.
SupposeAlice wants to send a signed message toBob. Initially, they must agree on the curve parameters. In addition to thefield and equation of the curve, we need, a base point of prime order on the curve; is the additive order of the point.
integer order ofG, 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 pointmust be prime. Indeed, we assume that every nonzero element of thering is invertible, so that must be afield. 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 denoteelliptic curve point multiplication by a scalar.
For Alice to sign a message, she follows these steps:
Let be the leftmost bits of, where is the bit length of the group order. (Note that can begreater than but notlonger.[2])
Select acryptographically 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 thePlayStation 3 gaming-console.[3]
Another way ECDSA signature may leak private keys is when is generated by a faultyrandom 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]
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 elementO, and its coordinates are otherwise valid.
Check that lies on the curve.
Check that.
After that, Bob follows these steps:
Verify thatr ands 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 ofe.
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]
It is not immediately obvious why verification even functions correctly. To see why, denote asC 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 ofs 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 ofr, this is verification step 6.
This shows only that a correctly signed message will verify correctly; other properties such as incorrectly signed messages failing to verify correctly and resistance tocryptanalytic attacks are required for a secure signature algorithm.
Given a messagem and Alice's signature on that message, Bob can (potentially) recover Alice's public key:[7]
Verify thatr ands are integers in. If not, the signature is invalid.
Calculate a curve point where is one of,,, etc. (provided is not too large for thefield of the curve) and is a value such that the curve equation is satisfied. Note that there may be several curve points satisfying these conditions, and each differentR value results in a distinct recovered key.
Calculate, where HASH is the same function used in the signature generation.
Letz be the leftmost bits ofe.
Calculate and.
Calculate the curve point.
The signature is valid if, matches Alice's public key.
The signature is invalid if all the possibleR points have been tried and none match Alice's public key.
Note that an invalid signature, or a signature from a different message, will result in the recovery of an incorrect public key. The recovery algorithm can only be used to check validity of a signature if the signer's public key (or its hash) is known beforehand.
Start with the definition of from recovery step 6,
From the definition from signing step 4,
Because elliptic curve scalar multiplication distributes over addition,
Expanding the definition of and from recovery step 5,
Expanding the definition ofs from signature step 6,
Since the product of an element's inverse and the element is the identity, we are left with
The first and second terms cancel each other out,
From the definition of, this is Alice's public key.
This shows that a correctly signed message will recover the correct public key, provided additional information was shared to uniquely calculate curve point from signature valuer.
In December 2010, a group calling itselffail0verflow announced the recovery of the ECDSA private key used bySony to sign software for thePlayStation 3 game console. However, this attack only worked because Sony did not properly implement the algorithm, because was static instead of random. As pointed out in theSignature generation algorithm section above, this makes solvable, rendering the entire algorithm useless.[8]
On March 29, 2011, two researchers published anIACR paper[9] demonstrating that it is possible to retrieve a TLS private key of a server usingOpenSSL that authenticates with Elliptic Curves DSA over a binaryfield via atiming attack.[10] The vulnerability was fixed in OpenSSL 1.0.0e.[11]
In August 2013, it was revealed that bugs in some implementations of theJava classSecureRandom sometimes generated collisions in the value. This allowed hackers to recover private keys giving them the same control over bitcoin transactions as legitimate keys' owners had, using the same exploit that was used to reveal the PS3 signing key on someAndroid app implementations, which use Java and rely on ECDSA to authenticate transactions.[12]
This issue can be prevented by deterministic generation of k, as described by RFC 6979.
Political concerns: the trustworthiness ofNIST-produced curves being questioned after revelations were made that theNSA willingly insertsbackdoors into software, hardware components and published standards; well-known cryptographers[13] have expressed[14][15] doubts about how the NIST curves were designed, and voluntary tainting has already been proved in the past.[16][17] (See also thelibsshcurve25519 introduction.[18]) Nevertheless, a proof that the named NIST curves exploit a rare weakness is still missing.
Technical concerns: the difficulty of properly implementing the standard, its slowness, and design flaws which reduce security in insufficiently defensive implementations.[19]
Accredited Standards CommitteeX9,ASC X9 Issues New Standard for Public Key Cryptography/ECDSA, Oct. 6, 2020.Source
Accredited Standards CommitteeX9,American National Standard X9.62-2005, Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA), November 16, 2005.
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, andNigel Smart, editors,Advances in Elliptic Curve Cryptography, London Mathematical Society Lecture Note Series 317, Cambridge University Press, 2005.