← Cryptography guide

K041 / Asymmetric encryption, signatures and key exchange

ECDSA

ECDSA signature · Survey date 2026-12-05

An elliptic-curve digital signature scheme, and the elliptic-curve variant of DSA.

CRYPTOGRAPHY LAB / K041

Cryptography Lab · ECDSA

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Toy educational example

ECDSA (toy curve, sign and verify)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Open lab →

Definition and overview
An elliptic-curve digital signature scheme, and the elliptic-curve variant of DSA. Source document ↗
Classification and reversibility
Asymmetric signature scheme for signing and verification, not message recovery or encryption/encoding/hashing. Source document ↗
Key or secret requirements
Requires signing private key d, public key Q=d·G and a secret nonce k per signature. Source document ↗
Operating principle and structure
With hash e and nonce k, calculate R=k·G, r=x(R) mod n, s=k⁻¹(e+d·r) mod n to produce (r,s). Source document ↗
Key size, block size and parameters
P-256/secp256k1: r and s each 32 bytes, 64-byte IEEE P1363 signature; size depends on field/curve parameters. Source document ↗
Security strength and recommendation
Avoid curves below 224 bits; recommend at least 224 bits. Source document ↗
Known attacks and vulnerabilities
Signature nonce reuse can expose the private key. Source document ↗
Standards and certification
Related standards: FIPS 186-5, SEC 1, ANSI X9.62, RFC 6979 (deterministic nonce). Source document ↗
Typical uses
Used for signatures in TLS certificates, hardware tokens and cryptocurrency transactions. Source document ↗
Implementations, libraries and tools
Available through the Python ecdsa library. Source document ↗
Decryption or decoding
No decryption; verify with public key. DER signatures can be format-decoded to raw r‖s. Source document ↗
Advantages
Short keys/signatures are easy to handle and integrate with other protocols. Source document ↗
Limitations and cautions
Reusing signing and ECDH keys is bad practice; generate separate keys. Source document ↗
Distinguishing encryption, encoding and hashing
Digital signature made with private key and verified with public key, distinct from encryption, encoding and hashing. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Hash message and create ECDSA signature (r,s) with private key; recipient verifies with same hash and public key. Success means integrity and signer authentication, not decryption.

Procedure

Hash message, generate (r,s) with private key and nonce, transmit signature. Verify equations with message hash, public key and (r,s). No decryption; DER/raw r‖s conversion is encoding/decoding.

Scenario

Sign and verify TLS certificates, code, hardware tokens and cryptocurrency transactions. Servers verify request integrity and key possession; obtain confidentiality separately via TLS/AEAD.

Pitfalls and alternatives

Avoid nonce reuse, bias or disclosure; use deterministic RFC 6979 or vetted libraries. Avoid curves below 224 bits, separate ECDSA and ECDH keys, and use AEAD for confidentiality.

References