icon

ECDSA (Elliptic Curve Digital Signature Algorithm)

Last modified: 2023-09-09

ECDSA offers a variant of the DSA which uses elliptic curve cryptography.

ECDSA in Python

python-ecdsa can be used for ECDSA.

pip install ecdsa

Verifying

from ecdsa import SigningKey, NIST384p

sk = SigningKey.generate(curve=NIST384p)
vk = sk.verifying_key
signature = sk.sign(b"message")
print(vk.verify(signature, b"message"))

Generating SigningKey

from ecdsa import SigningKey, NIST384p

sk = SigningKey.generate(curve=NIST384p)
sk_string = sk.to_string()
print(sk_string.hex())

sk2 = SigningKey.from_string(sk_string, curve=NIST384p)
print(sk2.to_string().hex())