7 Public Key Encryption and Digital Signatures: Using ECC
This chapter transitions from the RSA mindset to elliptic curve cryptography (ECC), explaining why ECC has become the practical default for modern systems. It highlights ECC’s central advantage—equivalent security with far smaller keys and better performance—making it ideal for smartphones, cloud workloads, and high-throughput services. The security foundation is the elliptic curve discrete logarithm problem, which is currently intractable; the text cautions that a breakthrough algorithm or sufficiently powerful quantum computers would endanger ECC, but neither poses an immediate, real-world threat today.
Readers are guided through how ECC is configured and used in practice. Only vetted, named curves should be selected, and both parties must use the same curve; the chapter discusses trade-offs such as security level, computational efficiency, implementation safety, and trust in the curve’s provenance, citing options like Curve25519, P-256, Curve448, and secp256k1. For confidentiality, ECC is applied in hybrid schemes where ECDH establishes a shared secret that feeds symmetric encryption (e.g., AES). Developers typically rely on protocols like TLS/SSH rather than implementing key agreement themselves. Concrete Java examples show key generation for a chosen curve, ECIES-based encryption/decryption via a provider, and ECDSA for signatures with SHA-256. The chapter stresses operational hygiene: use separate key pairs for encryption and signing, verify signatures before decryption, and expect tampering to be detected.
The comparison between RSA and ECC underscores that both remain viable, but ECC generally delivers superior performance and smaller keys (for example, ~256-bit ECC is comparable to 3072-bit RSA), a key reason adoption surged alongside mobile devices and remains attractive on servers. It notes the distinct failure modes—fast factoring would break RSA; a fast elliptic-curve discrete log algorithm would break ECC—and acknowledges future quantum risks while pointing toward emerging post-quantum cryptography. The practical takeaway is to prefer ECC for new applications—commonly Curve25519—use well-reviewed configurations, and adhere to organizational security standards when making final selections.
An example of an elliptic curve. This curve named Curve25519 is one of the most used with ECC algorithm.
ACME Inc. staff inspect returned merchandise and approve refunds using the warehouse management service. Once a day the payment service requests to the warehouse management service to return a JSON array containing the credit cards and amount to refunds. The payment service issues refund to customer credit card accounts.
Diffie-Helman algorithm computes the same result from the (payment private key, warehouse public key) and (warehouse private key, payment public key) key combinations.
Summary
- Elliptic Curve Cryptography (ECC) is a modern alternative to RSA that provides the same level of security with smaller keys and better performance.
- ECC is based on the elliptic curve discrete logarithm problem, which is very hard to solve with today’s computers.
- Just like RSA, ECC will be broken by powerful quantum computers, but those are not yet a practical threat.
- Different elliptic curves offer different levels of security, efficiency, and trust. Widely used safe curves include Curve25519, P-256, and secp256k1.
- Elliptic Curve Diffie-Hellman (ECDH) is used to securely generate shared symmetric keys over insecure networks, and is the variant used in modern TLS.
- Java supports ECC directly, and libraries like Bouncy Castle make it easier to encrypt and decrypt content using ECC.
- ECC is also used for digital signatures through the Elliptic Curve Digital Signature Algorithm (ECDSA). Signing and encryption must use separate key pairs to avoid weakening security.
- Digital signatures with ECC provide authenticity, integrity, and non-repudiation, while remaining more efficient than RSA for mobile devices and high-scale systems.
- Today, most cryptographers recommend ECC over RSA for new applications because of its performance and security trade-offs.
Software Security for Developers ebook for free