ECDSA random numbers
Abstract
In the ECDSA signing process, a random number(or determined non-repeat hash number) is required to sign the message.
If you use the same random number for different messages, your private key will be exposed.
The most famous incident is Sony PlayStation 3 Hack.
Cryptography Background
Several simplified steps in ECDSA:
Key Generation
private key d_A, an integer generated from RNG
public key Q_A:
Signature
Calculate hash
h = hash(M)
of the messageM
Generate a random number
k
Calculate the random point
R = kG
Denote R's x coordinate
R.x
asr
, then calculate s
Now we have the signature (r,s)
.
Verify Signature
Calculate hash
h = hash(M)
of the messageM
Calculate the modular inverse
Recover the random point used during the signing
Check if
R'.x == r
Attack Details
Apparently, if we use the same k
(also means the same r
) for different message M
, the private key can be solved by the following steps:
Summary
Never use the same random numbers when signing by ECDSA
Or, use a deterministic ECDSA
Developers should be familiar enough with the underlying cryptography to avoid similar attacks.
Last updated