Elliptic Curve Digital Signature Algorithm
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. 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 public key would be 160 bits, whereas the size of a DSA public key is at least 1024 bits. On the other hand, the signature size is the same for both DSA and ECDSA: approximately bits, where 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, 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 .
|CURVE||the elliptic curve field and equation used|
|G||elliptic curve base point, such as a pt (x0,y0) on y^2=x^3+7, a generator of the elliptic curve with large prime order n|
|n||integer order of G, means that , where is the identity element.|
The order of the base point must be prime. Indeed, we assume that every element of the ring are 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 , where HASH is a cryptographic hash function, such as SHA-2.
- Let be the leftmost bits of , where is the bit length of the group order .
- 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 .
When computing , the string resulting from shall be converted to an integer. Note that can be greater than but not longer.
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. 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. 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.
Signature verification algorithm
For Bob to authenticate Alice's signature, 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 , and its coordinates are otherwise valid
- Check that lies on the curve
- Check that
After that, Bob follows these steps:
- Verify that and 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 .
- Calculate .
- Calculate and .
- Calculate the curve point . If then the signature is invalid.
- The signature is valid if , invalid otherwise.
Note that using Shamir's trick, a sum of two scalar multiplications can be calculated faster than two scalar multiplications done independently.
Correctness of the algorithm
It is not immediately obvious why verification even functions correctly. To see why, denote as the curve point computed in step 6 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 5,
Collecting the common term ,
Expanding the definition of 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 , this is verification step 6.
This shows only that a correctly signed message will verify correctly; many other properties[which?] are required for a secure signature algorithm.
In December 2010, a group calling itself fail0verflow announced recovery of the ECDSA private key used by Sony to sign software for the PlayStation 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 the Signature generation algorithm section above, this makes solvable and the entire algorithm useless.
On March 29, 2011, two researchers published an IACR paper demonstrating that it is possible to retrieve a TLS private key of a server using OpenSSL that authenticates with Elliptic Curves DSA over a binary field via a timing attack. The vulnerability was fixed in OpenSSL 1.0.0e.
In August 2013, it was revealed that bugs in some implementations of the Java class SecureRandom sometimes generated collisions in the value. This allowed hackers to recover private keys giving them same control over bitcoin transactions as legitimate keys' owners had, using the same exploit that was used to reveal the PS3 signing key on some Android app implementations, which use Java and rely on ECDSA to authenticate transactions.
This issue can be prevented by deterministic generation of , as described by RFC 6979.
There exists two sorts of concerns with ECDSA:
- Political concerns: the trustworthiness of NIST-produced curves being questioned after revelations that the NSA willingly inserts backdoors into software, hardware components and published standards were made; well-known cryptographers have expressed doubts about how the NIST curves were designed, and voluntary tainting has already been proved in the past.
- Technical concerns: the difficulty to properly implement the standard and the slowness and design flaws which reduce security in insufficiently precautions implementations on the Dual EC DRBG random number generator.
Both of those concerns are summarized in libssh curve25519 introduction.
- NIST FIPS 186-4, July 2013, pp. 19 and 26
- Console Hacking 2010 - PS3 Epic Fail, page 123–128
- "Android Security Vulnerability". Retrieved February 24, 2015.
- "RFC 6979 - Deterministic Usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)". Retrieved February 24, 2015.
- "The Double-Base Number System in Elliptic Curve Cryptography" (PDF). Retrieved 22 April 2014.
- Bendel, Mike (2010-12-29). "Hackers Describe PS3 Security As Epic Fail, Gain Unrestricted Access". Exophase.com. Retrieved 2011-01-05.
- "Cryptology ePrint Archive: Report 2011/232". Retrieved February 24, 2015.
- "Vulnerability Note VU#536044 - OpenSSL leaks ECDSA private key through a remote timing attack". www.kb.cert.org.
- "ChangeLog". OpenSSL Project. Retrieved 22 April 2014.
- "Android bug batters Bitcoin wallets". The Register. 12 August 2013.
- Schneier, Bruce (September 5, 2013). "The NSA Is Breaking Most Encryption on the Internet". Schneier on Security.
- "SafeCurves: choosing safe curves for elliptic-curve cryptography". Oct 25, 2013.
- Bernstein, Daniel J.; Lange, Tanja (May 31, 2013). "Security dangers of the NIST curves" (PDF).
- Schneier, Bruce (November 15, 2007). "The Strange Story of Dual_EC_DRBG". Schneier on Security.
- Greenemeier, Larry (September 18, 2013). "NSA Efforts to Evade Encryption Technology Damaged U.S. Cryptography Standard". Scientific American.
- Bernstein, Daniel J. (March 23, 2014). "How to design an elliptic-curve signature system". The cr.yp.to blog.
- "New key type (ed25519) and private key format".
- "email@example.com\doc - projects/libssh.git". libssh shared repository.
- 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 Smart, editors, Advances in Elliptic Curve Cryptography, London Mathematical Society Lecture Note Series 317, Cambridge University Press, 2005.
- Hankerson, D.; Vanstone, S.; Menezes, A. (2004). Guide to Elliptic Curve Cryptography. Springer Professional Computing. New York: Springer. doi:10.1007/b97644. ISBN 0-387-95273-X.