In cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic curve cryptography.
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.^{[1]} For example, at a security level of 80 bits—meaning an attacker requires a maximum of about $2^{80}$ operations to find the private key—the size of an ECDSA private key would be 160 bits, whereas the size of a DSA private key is at least 1024 bits. On the other hand, the signature size is the same for both DSA and ECDSA: approximately $4t$ bits, where $t$ is the security level measured in bits, that is, about 320 bits for a security level of 80 bits.
Suppose Alice wants to send a signed message to Bob. Initially, they must agree on the curve parameters $({\textrm {CURVE}},G,n)$. In addition to the field and equation of the curve, we need $G$, a base point of prime order on the curve; $n$ is the multiplicative order of the point $G$.
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 $n\times G=O$, where $O$ is the identity element. |
$d_{A}$ | the private key (randomly selected) |
$Q_{A}$ | the public key (calculated by elliptic curve) |
m | the message to send |
The order $n$ of the base point $G$ must be prime. Indeed, we assume that every nonzero element of the ring $\mathbb {Z} /n\mathbb {Z}$ is invertible, so that $\mathbb {Z} /n\mathbb {Z}$ must be a field. It implies that $n$ must be prime (cf. Bézout's identity).
Alice creates a key pair, consisting of a private key integer $d_{A}$, randomly selected in the interval $[1,n-1]$; and a public key curve point $Q_{A}=d_{A}\times G$. We use $\times$ to denote elliptic curve point multiplication by a scalar.
For Alice to sign a message $m$, she follows these steps:
As the standard notes, it is not only required for $k$ to be secret, but it is also crucial to select different $k$ for different signatures, otherwise the equation in step 6 can be solved for $d_{A}$, the private key: given two signatures $(r,s)$ and $(r,s')$, employing the same unknown $k$ for different known messages $m$ and $m'$, an attacker can calculate $z$ and $z'$, and since $s-s'=k^{-1}(z-z')$ (all operations in this paragraph are done modulo $n$) the attacker can find $k={\frac {z-z'}{s-s'}}$. Since $s=k^{-1}(z+rd_{A})$, the attacker can now calculate the private key $d_{A}={\frac {sk-z}{r}}$.
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 $k$ 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 $k$ is unique for each message, one may bypass random number generation completely and generate deterministic signatures by deriving $k$ from both the message and the private key.^{[5]}
For Bob to authenticate Alice's signature, he must have a copy of her public-key curve point $Q_{A}$. Bob can verify $Q_{A}$ is a valid curve point as follows:
After that, Bob follows these steps:
Note that an efficient implementation would compute inverse $s^{-1}\,{\bmod {\,}}n$ only once. Also, using Shamir's trick, a sum of two scalar multiplications $u_{1}\times G+u_{2}\times Q_{A}$ 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 as C the curve point computed in step 5 of verification,
From the definition of the public key as $Q_{A}=d_{A}\times G$,
Because elliptic curve scalar multiplication distributes over addition,
Expanding the definition of $u_{1}$ and $u_{2}$ from verification step 4,
Collecting the common term $s^{-1}$,
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 correctly signed message will verify correctly; many other properties^{[which?]} are required for a secure signature algorithm.
Given a message m and Alice's signature $r,s$ on that message, Bob can (potentially) recover Alice's public key:^{[7]}
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 $Q_{A}$ from recovery step 6,
From the definition $R=(x_{1},y_{1})=k\times G$ from signing step 4,
Because elliptic curve scalar multiplication distributes over addition,
Expanding the definition of $u_{1}$ and $u_{2}$ from recovery step 5,
Expanding the definition of s 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 $Q_{A}=d_{A}\times G$, 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 $R=(x_{1},y_{1})$ from signature value r.
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 $k$ was static instead of random. As pointed out in the Signature generation algorithm section above, this makes $d_{A}$ solvable, rendering the entire algorithm useless.^{[8]}
On March 29, 2011, two researchers published an IACR paper^{[9]} 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.^{[10]} The vulnerability was fixed in OpenSSL 1.0.0e.^{[11]}
In August 2013, it was revealed that bugs in some implementations of the Java class SecureRandom sometimes generated collisions in the $k$ 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 some Android app implementations, which use Java and rely on ECDSA to authenticate transactions.^{[12]}
This issue can be prevented by an unpredictable generation of $k$, e.g., a deterministic procedure as described by RFC 6979.
There exist two sorts of concerns with ECDSA:
Both of those concerns are summarized in libssh curve25519 introduction.^{[20]}
Below is a list of cryptographic libraries that provide support for ECDSA:
Bitcoin.org uses ECDSA in a TLS ciphersuite to authenticate itself to web browsers, which the following abbreviated transcript shows.
$ date
Wed Mar 4 10:24:52 EST 2020
$ openssl s_client -connect wikipedia.org:443 # output below has DELETIONS for brevity
CONNECTED(00000003)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = *.wikipedia.org
verify return:1
---
Certificate chain
0 s:/CN=*.wikipedia.org
i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHOTCCBiGgAwIBAgISA4srJU6bpT7xpINN6bbGO2/mMA0GCSqGSIb3DQEBCwUA
... many lines DELETED ....
kTOXMoKzBkJCU8sCdeziusJtNvWXW6p8Z3UpuTw=
-----END CERTIFICATE-----
subject=/CN=*.wikipedia.org
issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
---
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 3353 bytes and written 431 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-ECDSA-AES256-GCM-SHA384
Server public key is 256 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-ECDSA-AES256-GCM-SHA384
Session-ID: ... DELETED ...
Session-ID-ctx:
Master-Key: ... DELETED ...
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1583335210
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
DONE
People | |||||
---|---|---|---|---|---|
Lists | |||||
Technologies | |||||
Forks |
| ||||
Exchanges |
| ||||
History | |||||
Movies |
| ||||
Legal entities (not exchanges) | |||||