A (relatively easy to understand) primer on elliptic curve cryptography (2024)

A (relatively easy to understand) primer on elliptic curve cryptography (1)

Author Nick Sullivan worked for six years at Apple on many of its most important cryptography efforts before recently joining CloudFlare, where he is a systems engineer. He has a degree in mathematics from the University of Waterloo and a Masters in computer science with a concentration in cryptography from the University of Calgary. This post was originally written for the CloudFlare blog and has been lightly edited to appear on Ars.

Readers are reminded that elliptic curve cryptography is a set of algorithms for encrypting and decrypting data and exchanging cryptographic keys. Dual_EC_DRBG, the cryptographic standard suspected of containing a backdoor engineered by the National Security Agency, is a function that uses elliptic curve mathematics to generate a series of random-looking numbers from a seed. This primer comes two months after internationally recognized cryptographers called on peers around the world to adopt ECC to avert a possible "cryptopocalypse."

Elliptic curve cryptography (ECC) is one of the most powerful but least understood types of cryptography in wide use today. An increasing number of websites make extensive use of ECC to secure everything from customers' HTTPS connections to how they pass data between data centers. Fundamentally, it's important for end users to understand the technology behind any security system in order to trust it. To that end, we looked around to find a good, relatively easy-to-understand primer on ECC in order to share with our users. Finding none, we decided to write one ourselves. That is what follows.

Be warned: this is a complicated subject, and it's not possible to boil it down to a pithy blog post. In other words, settle in for a bit of an epic because there's a lot to cover. If you just want the gist, here's the TL;DR version: ECC is the next generation of public key cryptography, and based on currently understood mathematics, it provides a significantly more secure foundation than first-generation public key cryptography systems like RSA. If you're worried about ensuring the highest level of security while maintaining performance, ECC makes sense to adopt. If you're interested in the details, read on.

The dawn of public key cryptography

The history of cryptography can be split into two eras: the classical era and the modern era. The turning point between the two occurred in 1977, when both the RSA algorithm and the Diffie-Hellman key exchange algorithm were introduced. These new algorithms were revolutionary because they represented the first viable cryptographic schemes where security was based on the theory of numbers; it was the first to enable secure communication between two parties without a shared secret. Cryptography went from being about securely transporting secret codebooks around the world to being able to have provably secure communication between any two parties without worrying about someone listening in on the key exchange.

A (relatively easy to understand) primer on elliptic curve cryptography (2)

Modern cryptography is founded on the idea that the key that you use to encrypt your data can be made public while the key that is used to decrypt your data can be kept private. As such, these systems are known as public key cryptographic systems. The first, and still most widely used of these systems, is known as RSA—named after the initials of the three men who first publicly described the algorithm: Ron Rivest, Adi Shamir, and Leonard Adleman.

What you need for a public key cryptographic system to work is a set of algorithms that is easy to process in one direction but difficult to undo. In the case of RSA, the easy algorithm multiplies two prime numbers. If multiplication is the easy algorithm, its difficult pair algorithm is factoring the product of the multiplication into its two component primes. Algorithms that have this characteristic—easy in one direction, hard the other—are known as trapdoor functions. Finding a good trapdoor function is critical to making a secure public key cryptographic system. Simplistically, the bigger the spread between the difficulty of going one direction in a trapdoor function and going the other, the more secure a cryptographic system based on it will be.

A toy RSA algorithm

The RSA algorithm is the most popular and best understood public key cryptography system. Its security relies on the fact that factoring is slow and multiplication is fast. What follows is a quick walk-through of what a small RSA system looks like and how it works.

In general, a public key encryption system has two components, a public key and a private key. Encryption works by taking a message and applying a mathematical operation to it to get a random-looking number. Decryption takes the random looking number and applies a different operation to get back to the original number. Encryption with the public key can only be undone by decrypting with the private key.

Computers don't do well with arbitrarily large numbers. We can make sure that the numbers we are dealing with do not get too large by choosing a maximum number and only dealing with numbers less than the maximum. We can treat the numbers like the numbers on an analog clock. Any calculation that results in a number larger than the maximum gets wrapped around to a number in the valid range.

In RSA, this maximum value (call it max) is obtained by multiplying two random prime numbers. The public and private keys are two specially chosen numbers that are greater than zero and less than the maximum value (call them pub and priv). To encrypt a number, you multiply it by itself pub times, making sure to wrap around when you hit the maximum. To decrypt a message, you multiply it by itself priv times, and you get back to the original number. It sounds surprising, but it actually works. This property was a big breakthrough when it was discovered.

To create an RSA key pair, first randomly pick the two prime numbers to obtain the maximum (max). Then pick a number to be the public key pub. As long as you know the two prime numbers, you can compute a corresponding private key priv from this public key. This is how factoring relates to breaking RSA—factoring the maximum number into its component primes allows you to compute someone's private key from the public key and decrypt their private messages.

Let's make this more concrete with an example. Take the prime numbers 13 and 7. Their product gives us our maximum value of 91. Let's take our public encryption key to be the number 5. Then using the fact that we know 7 and 13 are the factors of 91 and applying an algorithm called the Extended Euclidean Algorithm, we get that the private key is the number 29.

These parameters (max: 91, pub: 5,priv: 29) define a fully functional RSA system. You can take a number and multiply it by itself 5 times to encrypt it, then take that number and multiply it by itself 29 times and you get the original number back.

Let's use these values to encrypt the message "CLOUD".

In order to represent a message mathematically, we have to turn the letters into numbers. A common representation of the Latin alphabet is UTF-8. Each character corresponds to a number.

A (relatively easy to understand) primer on elliptic curve cryptography (3)

Under this encoding, CLOUD is 67, 76, 79, 85, 68. Each of these digits is smaller than our maximum of 91, so we can encrypt them individually. Let's start with the first letter.

We have to multiply it by itself five times to get the encrypted value.

67×67 = 4489 = 30 *

*Since 4489 is larger than max, we have to wrap it around. We do that by dividing by 91 and taking the remainder.

4489 = 91×49 + 30

30×67 = 2010 = 8

8×67 = 536 = 81

81×67 = 5427 = 58

This means the encrypted version of 67 (or C) is 58.

Repeating the process for each of the letters, we get that the encrypted message CLOUD becomes:

58, 20, 53, 50, 87

To decrypt this scrambled message, we take each number and multiply it by itself 29 times:

58×58 = 3364 = 88 (Remember, we wrap around when the number is greater than max.)

88×58 = 5104 = 8

9×58 = 522 = 67

Voila, we're back to 67. This works with the rest of the digits, resulting in the original message.

The takeaway is that you can take a number, multiply it by itself a number of times to get a random-looking number, and then multiply that number by itself a secret number of times to get back to the original number.

A (relatively easy to understand) primer on elliptic curve cryptography (2024)

FAQs

What is elliptic curve cryptography in simple terms? ›

ECC, as the name implies, is an asymmetric encryption algorithm that employs the algebraic architecture of elliptic curves with finite fields. Elliptic Curve Cryptography (ECC) is an encryption technology comparable to RSA that enables public-key encryption.

What is elliptic curve cryptography quizlet? ›

Elliptic Curve Cryptography (ECC) An algorithm that uses elliptic curves instead of prime numbers to compute keys. Elliptic Curve Diffie-Hellman (ECDH) A Diffie-Hellman key exchange that uses elliptic curve cryptography instead of prime numbers in its computation. Encryption.

What are the pros and cons of elliptic curve cryptography? ›

Its decryption and encryption speeds are moderately fast. ECC enables lower latency than inverse throughout by computing signatures in two stages. ECC features strong protocols for authenticated key exchange and support for the tech is strong. The main disadvantage of ECC is that it isn't easy to securely implement.

What is the equation for the elliptic curve cryptography? ›

An elliptic curve is a plane curve defined by an equation of the form y^2 = x^3 + ax + b. A and b are constants, and x and y are variables. Elliptic curves have many interesting mathematical properties that make them well-suited for cryptography.

Why is elliptic curve cryptography better? ›

⇒ The answer to this question is the following: 1) Elliptic Curves provide security equivalent to classical systems (like RSA), but uses fewer bits. 2) Implementation of elliptic curves in cryptography requires smaller chip size, less power consumption, increase in speed, etc.

What is the purpose of the elliptic curve? ›

Elliptic curves are especially important in number theory, and constitute a major area of current research; for example, they were used in Andrew Wiles's proof of Fermat's Last Theorem. They also find applications in elliptic curve cryptography (ECC) and integer factorization.

Why is it called elliptic curve cryptography? ›

The name comes from certain integrals involved in computing the arc length of an ellipse, which involve square roots of cubic and quartic polynomials in x x x.

What is the disadvantage of elliptic curve cryptography? ›

Analysis of the disadvantages of elliptic curve cryptography (ECC) The main disadvantage of elliptic curve cryptography is its low efficiency. Elliptic cryptography relies on mathematical computation to encrypt and decrypt, and its strength depends on the complexity of computation.

What is the key size of elliptic curve cryptography? ›

With a 112-bit strength, the ECC key size is 224 bits and the RSA key size is 2048 bits. The most popular signature scheme that uses elliptic curves is called the Elliptic Curve Digital Signature Algorithm (ECDSA).

Is elliptic curve cryptography still used? ›

Elliptic curve cryptography is used successfully in numerous popular protocols, such as Transport Layer Security and Bitcoin.

Is elliptic curve cryptography quantum safe? ›

However, popular cryptographic schemes based on these hard problems – including RSA and Elliptic Curve Cryptography – will be easily broken by a quantum computer.

What advantage does elliptic curve cryptography have over RSA cryptography? ›

How Does ECC Compare To RSA And DSA? The biggest difference between ECC and RSA/DSA is the greater cryptographic strength that ECC offers for equivalent key size. An ECC key is more secure than an RSA or DSA key of the same size.

Can quantum computing break elliptic curve cryptography? ›

Secure digital communications rely on the success of public-key cryptographic systems, such as RSA and elliptic curve cryptography (ECC). Both RSA and ECC keys are susceptible to being broken by quantum computers, which can efficiently reverse the mathematical operations at the heart of these systems.

What are the attacks on elliptic curve cryptography? ›

ECC (Elliptic Curve Cryptography) is used as a public key crypto system with the key purpose of creating a private shared between two participants in a communication network. Attacks on ECC include the Pohlig-Hellman attack and the Pollard's rho attack.

Who invented elliptic curve cryptography? ›

Elliptic Curve Cryptography (ECC) was discovered in 1985 by Victor Miller (IBM) and Neil Koblitz (University of Washington) as an alternative mechanism for implementing public-key cryptography.

What is an example of elliptic curve encryption? ›

Let's take an example: at the elliptic curve y2 ≡ x3 + 7 (mod 17) the point P {10, 15} can be compressed as C {10, odd}. For decompression, we first calculate the two possible y coordinates for x = 10 using the above formulas: y1 = 2 and y2 = 15. Then we choose the odd one: y = 15. The decompressed point is {10, 15}.

What is the difference between ECC and RSA? ›

This is because ECC key generation involves choosing a random elliptic curve over a finite field and selecting a random point as the public key. On the other hand, RSA key generation involves the selection of two large prime numbers and performing mathematical operations on them to generate the public and private keys.

What is the elliptic curve logarithm problem? ›

Formally, the elliptic curve discrete logarithm problem (ECDLP) is the problem of finding an integer value e within the bounds of 1 and the number of points on the elliptic curve (which ~= the order of the finite cyclic group), such that the scalar multiplication of a primitive element G with e, i.e. eG, produces ...

Why is it called elliptic? ›

Their name originates from their originally arising in connection with the problem of finding the arc length of an ellipse. where R is a rational function of its two arguments, P is a polynomial of degree 3 or 4 with no repeated roots, and c is a constant.

Top Articles
Latest Posts
Article information

Author: Moshe Kshlerin

Last Updated:

Views: 5453

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Moshe Kshlerin

Birthday: 1994-01-25

Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

Phone: +2424755286529

Job: District Education Designer

Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.