What is the Elliptic Curve Digital Signature Algorithm?
The Elliptic Curve Digital Signature Algorithm (ECDSA) is a digital signature algorithm (DSA). ECDSA relies on elliptic curves defined over a finite field to generate and verify signatures. The underlying elliptic curves make the signing process more efficient and secure, as the process relies on the complexity of the elliptic-curve discrete logarithm problem (ECDLP).
Key generation
We generate asymmetric keys using the key agreement algorithms that elliptic curve cryptography provides. Elliptic-curve Diffie–Hellman (ECDH) is a widely used key agreement algorithm. The process of public-private key generation in ECDH as follows:
- Private key: The private key is a randomly selected number
such that is in the interval 1 to - 1, where is the order of the subgroup of the elliptic curve points, generated by the generator point The starting point of the elliptic curve defined according to the standard being used . - Public key: The public key is given as
, where is the private key selected randomly above, is the generator point of the elliptic curve, and is the public key.
Note: To learn more about the ECDH, we can click here.
Signature generation
The signature generation algorithm is based on the ElGamal signature scheme. It takes the private key of the sender and the message to be sent as input, and generates the signature as output. The working of the algorithm is as follows:
- Message hash: We calculate the hash
of the message using hash functions like MD-5, SHA-256, and Keccak-256, as follows:
- Random number: We choose a random number
, ranging from to , where is a prime number that represents the order of the subgroup of elliptic curve points generated by the generator point . - Random point: We calculate the random point
on the elliptic curve by multiplying the random number with the generator point , as follows:
-coordinate: We select the -coordinate of the random point generated above, as follows:
- Signature proof: We apply the following equation to calculate the signature proof
, as follows:
The signature consists of two integer values calculated above
Signature verification
The signature verification algorithm takes the message and the signature
- Message hash: We calculate the hash
of the message using the same hash function that was we used during the signature generation, as follows:
- Modular inverse: We calculate the modular inverse of the signature, as follows:
- Random point: We recalculate the random point
as in the signature generation process, where is the public key of the sender, as follows:
-coordinate: We get the -coordinate of the recalculated random point, as follows:
- Verify: We verify the result by matching the recently calculated
with the that came as part of the signature, as follows:
Extended ECDSA
We can generate the public key from the signature calculated by the ECDSA algorithm. The calculation process of public key returns
Extended ECDSA tackles this issue by adding an extra part
Uses of extended ECDSA
Extended ECDSA implementation is particularly useful in storage or bandwidth constraint environments. In situations where it is difficult or expensive to store or transmit public keys, we can use extended ECDSA.
Blockchain is an environment limited on bandwidth and storage. By using extended ECDSA, it avoids transmitting or storing the public key. Ethereum uses it to sign transactions.
Note: To learn how to create a digital signature in Python, we can click here.
Free Resources