Elliptic Curve Cryptography (ECC) Explained
Elliptic curve cryptography (ECC) is a family of public-key algorithms that achieve strong security with remarkably small keys. Where RSA needs a 3072-bit key, an elliptic curve can offer comparable security at just 256 bits. That efficiency makes ECC the preferred choice for TLS, secure messaging, hardware tokens, cryptocurrencies, and any setting where bandwidth, storage, or computation is constrained. Understanding how elliptic curve cryptography works reveals why it has become a cornerstone of modern secure systems.
The Math of Elliptic Curves
An elliptic curve used in cryptography is defined by an equation of the form:
y^2 = x^3 + a*x + b (mod p)
The curve is considered over a finite field, typically the integers modulo a large prime p. Instead of a smooth curve over the real numbers, cryptographic curves consist of a finite set of discrete points whose coordinates are field elements, plus a special point at infinity that acts as an identity element.
The parameters a and b define the specific curve, and they are chosen so the curve has good security properties (for example, avoiding singular or weak curves). The set of points on the curve, together with a defined addition operation, forms a mathematical group, which is what makes cryptography possible.
Point Addition and Scalar Multiplication
ECC relies on a geometric operation called point addition. Given two points P and Q on the curve, you can compute a third point P + Q using well-defined algebraic formulas. Adding a point to itself is called point doubling.
The critical operation for cryptography is scalar multiplication: adding a point P to itself k times, written k·P. This is computed efficiently using a double-and-add algorithm, similar to fast modular exponentiation:
- Given a scalar k and a base point P, computing Q = k·P is fast.
- Given the points Q and P, recovering the scalar k is believed to be computationally infeasible.
This one-way relationship is the Elliptic Curve Discrete Logarithm Problem (ECDLP), and it is the hard problem underpinning all ECC security. Unlike integer factorization, no sub-exponential algorithm is known for the ECDLP on well-chosen curves, which is precisely why ECC keys can be so much smaller for the same security level.
Why Small Keys Give Strong Security
The best known attacks against the ECDLP on a well-chosen curve run in roughly the square root of the group size. This means a curve over a 256-bit field provides about 128 bits of security, matching AES-128 and roughly equivalent to 3072-bit RSA. Approximate equivalences include:
- 256-bit ECC ≈ 3072-bit RSA ≈ 128-bit symmetric security
- 384-bit ECC ≈ 7680-bit RSA ≈ 192-bit symmetric security
- 521-bit ECC ≈ 15360-bit RSA ≈ 256-bit symmetric security
Smaller keys translate directly into faster computation, smaller signatures and certificates, and lower power consumption, which is why ECC dominates in mobile and embedded contexts.
Common Curves in Practice
Not all curves are equal; the choice of curve strongly affects both security and implementation safety. Widely used named curves include:
- NIST P-256 (secp256r1) is broadly supported in TLS and government systems. It offers 128-bit security but uses parameters whose provenance some cryptographers prefer to avoid.
- Curve25519 is a modern curve designed for speed and implementation safety, used with the X25519 key-exchange function. Its structure resists many implementation pitfalls and timing attacks.
- secp256k1 is the curve used by Bitcoin and other cryptocurrencies.
Modern designs favor curves like Curve25519 and its signature counterpart Ed25519 because they encourage constant-time, misuse-resistant implementations.
ECC Algorithms: ECDH and ECDSA
ECC is a building block rather than a single algorithm. The two most important protocols built on it are:
- ECDH (Elliptic Curve Diffie-Hellman) is a key-agreement protocol. Each party has a key pair, and by combining their private key with the other party's public key they derive the same shared secret. It is the elliptic-curve analogue of classic Diffie-Hellman key exchange and provides forward secrecy when ephemeral keys are used.
- ECDSA (Elliptic Curve Digital Signature Algorithm) and EdDSA produce compact digital signatures. These are covered in depth in digital signatures explained.
A public key in ECC is simply a point on the curve (Q = d·G, where G is a fixed base point and d is the private scalar), while the private key is the scalar d.
Implementation Pitfalls to Avoid
ECC's security depends heavily on correct implementation. Common hazards include:
- Invalid-curve and small-subgroup attacks, where an attacker submits a malicious public point. Implementations must validate that received points actually lie on the correct curve.
- Timing side channels in scalar multiplication that can leak private key bits; constant-time algorithms are essential.
- Poor randomness in ECDSA nonce generation, which can catastrophically expose the private key. Deterministic nonce schemes (RFC 6979) and EdDSA avoid this class of failure.
Like RSA, ECC is not resistant to large-scale quantum computers, motivating parallel work on post-quantum algorithms.
Key Takeaways
- Elliptic curve cryptography provides public-key security based on the hardness of the elliptic curve discrete logarithm problem (ECDLP).
- Its core operation is scalar multiplication (k·P), which is easy to compute but infeasible to reverse on well-chosen curves.
- ECC achieves the same security as RSA with far smaller keys, so 256-bit ECC roughly matches 3072-bit RSA and 128-bit symmetric security.
- Practical protocols include ECDH for key agreement and ECDSA/EdDSA for signatures, using curves like NIST P-256, Curve25519, and secp256k1.
- Correct, constant-time implementation and point validation are essential, and strong, unpredictable nonces are critical for ECDSA.