ECDSA-secp256k1
Elliptic Curve Digital Signature Algorithm on NIST curves and secp256k1
About ECDSA-secp256k1
ECDSA-secp256k1 is one of 13 ECDSA variants in the NextSSL registry, a digital signature scheme. It uses a 65-byte public key, a 32-byte secret key, a 64-byte signature and a 32-byte seed. It takes the parameter deterministic (default 0). Its registry entry cites SEC 2, RFC 6979 and RFC 8812. It is also known as es256k. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
ECDSA is the elliptic-curve version of the Digital Signature Algorithm and the most widely deployed signature scheme on the internet. It provides compact, fast classical signatures but is not secure against large quantum computers.
A key pair is a secret scalar d and a public point Q = dG on an elliptic curve. To sign, the signer picks a per-signature secret nonce k, computes the x-coordinate r of kG, and combines r, the message hash and d into the value s. Verification uses only Q, the hash and (r, s). Security relies on the elliptic curve discrete logarithm problem.
The nonce is the scheme's weak point. Reusing k, or leaking even a few bits of it across many signatures, allows recovery of the private key, as happened with the Sony PlayStation 3 signing key and several cryptocurrency wallets. RFC 6979 deterministic nonce generation removes the dependence on a random number generator, and FIPS 186-5 permits it. ECDSA signatures are also malleable: (r, -s) is a valid signature when (r, s) is.
Four curves are present: NIST P-256, P-384 and P-521, as specified in FIPS 186-5 and SEC 2, and secp256k1, the Koblitz curve used by Bitcoin and Ethereum and registered for JOSE and COSE in RFC 8812. Hashes are normally SHA-256 for P-256 and secp256k1, SHA-384 for P-384 and SHA-512 for P-521. Signatures are commonly encoded either as a DER sequence or as fixed-length r and s concatenated.
History
1992–2023ECDSA proposed by Scott Vanstone
Standardised in ANSI X9.62
Added to FIPS 186-2
Deterministic nonces specified in RFC 6979
FIPS 186-5 published
How it works
- KeyGen picks a random scalar d and computes Q = dG.
- Sign hashes the message to e, chooses a nonce k (random or per RFC 6979), and sets r = x(kG) mod n.
- It computes s = k^-1 (e + r*d) mod n and outputs (r, s).
- Verify computes u1 = e/s and u2 = r/s and checks that x(u1*G + u2*Q) equals r.
Security notes
Broken by a large quantum computer running Shor's algorithm, so migration to ML-DSA or hybrid signatures is advised for long-lived keys. Nonce reuse or bias leaks the private key; use RFC 6979 or hedged nonces and constant-time scalar multiplication.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| pk | 65 | Public key |
| sk | 32 | Secret key |
| sig | 64 | Signature |
| seed | 32 | Seed |
| ctx | 0 | Context string |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| deterministic | u32 | 0 – 1 | 0 | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
pk, sk = ns.call("sign_keygen", "ecdsa-secp256k1", None, outs=2)
sig = ns.call("sign_detached", "ecdsa-secp256k1", None, sk, b"message", b"")[0]
ok = ns.check("verify_detached", "ecdsa-secp256k1", None, pk, b"message", b"", sig)
nextssl_sign_keygen("ecdsa-secp256k1", NULL, pk, sk);
nextssl_sign_detached("ecdsa-secp256k1", NULL, sk, msg, ctx, sig);
nextssl_verify_detached("ecdsa-secp256k1", NULL, pk, msg, ctx, sig);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_sign_in(reg::all(), Policy::Safe, "ecdsa-secp256k1", &Params::new())?;
let (pk, sk) = alg.keygen(&mut *rng)?;
let sig = alg.sign(&sk, b"message")?;
let ok = alg.verify(&pk, b"message", &sig)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other ECDSA variants
12Similar names
Looking for something else?More digital signatures
All 503Frequently asked questions
What is ECDSA-secp256k1?
ECDSA-secp256k1 is a signature in the ECDSA family. ECDSA is the elliptic-curve version of the Digital Signature Algorithm and the most widely deployed signature scheme on the internet. It is also known as es256k.
What are the ECDSA-secp256k1 sizes?
In NextSSL, ECDSA-secp256k1 uses: public key 65 bytes, signature 64 bytes.
Is ECDSA-secp256k1 post-quantum?
No. ECDSA-secp256k1 is a classical signature based on elliptic curves or discrete logarithms, which a large quantum computer running Shor's algorithm could break. For post-quantum use, look at ML-DSA or SLH-DSA.
Who designed ECDSA-secp256k1 and when?
ECDSA-secp256k1 belongs to the ECDSA family, first published in 1992 by Scott Vanstone (proposal); standardised by ANSI and NIST. Its origin: FIPS 186-5, ANSI X9.62, SEC 1.
Which standards define ECDSA-secp256k1?
ECDSA-secp256k1 is referenced by SEC 2, RFC 6979, RFC 8812.
Is ECDSA-secp256k1 safe to use?
ECDSA-secp256k1 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
What other ECDSA variants are there?
NextSSL also registers ecdsa-p256, ecdsa-p384, ecdsa-p521, libecc-ecdsa-brainpoolp256r1-sha256, libecc-ecdsa-brainpoolp320r1-sha384, libecc-ecdsa-brainpoolp384r1-sha384 and more in the ECDSA family.
Related families
Deterministic hashing of byte strings to elliptic curve points with the SSWU map
SHA-2The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
ECDH (including X25519 and X448)Elliptic-curve Diffie-Hellman key agreement on NIST curves, Curve25519 and Curve448
EdDSADeterministic Edwards-curve signatures: Ed25519 and Ed448
ML-DSANIST's primary post-quantum signature scheme, standardised in FIPS 204
Schnorr signatures (BIP 340)Bitcoin's x-only Schnorr signatures on secp256k1, introduced with Taproot