Everything you wanted to know about Elliptic Curve Cryptography – Fission (2024)

View more blog posts
Everything you wanted to know about Elliptic Curve Cryptography – Fission (1)

So you've heard of Elliptic Curve Cryptography. Maybe you know it's supposed to be better than RSA. Maybe you know that all these cool new decentralized protocols use it. Maybe you've seen the landslide of acronyms that go along with it: ECC, ECDSA, ECDH, EdDSA, Ed25519, etc. Maybe you've seen some cool looking graphs but don't know how those translate to working cryptography. The articles you find online either don't answer your questions, or launch in to a 30 minute description of birational equivalence.

We feel your pain. We wanted to create a resource that answers all those questions you have, gives you a cheat sheet for those pesky acronyms, and takes you from crypto-kindergartener to elliptic-expert in less than 10 minutes.

Enough with the talk! I just need to figure out what all these funky acronyms mean!

RSA: Rivest–Shamir–Adleman (the three inventors of RSA)
Old school cryptography that uses prime-factorization

ECC: Elliptic Curve Cryptography
New-fangled cryptography that uses elliptic curves. More secure & smaller keys than RSA.

ECDH: Elliptic Curve Diffie Hellman
Key-sharing algorithm used for asymmetric encryption

ECDSA: Elliptic Curve Digital Signing Algorithm
Digital signing algorithm using elliptic curves (makes sense right?)

Edwards Curve:
A special type of elliptic curve (most are Montgomery Curves). Faster for certain operations.

EdDSA: Edwards Digital Signing Algorithm
Digital signing algorithm using an Edwards curve. Runs in constant time.

Ed25519: Edwards Curve 25519
The most commonly used Edwards Curve

Curve25519:
The non-edwards companion to Ed25519

secp256k1:
The curve used by Bitcoin & Ethereum

NIST Curves:
Curves created and standardized by the National Institute of Standards and Technology

What is asymmetric cryptography?

Asymmetric cryptography (or "public key cryptography") is a cryptographic system that uses keypairs (a private key and a public key). The public key is shared widely, while the private key must be kept
completely secret.

There are two main use cases for public key cryptography: asymmetric encryption and digital signatures.

Asymmetric encryption is a method by which Alice can send a message to Bob without leaking any information about her private key to Bob and nothing about the key or the message to the outside world.

Digital signatures are a means of verifying that a message came from the holder of a certain private key and that the information has not been tampered with in flight.

How on earth does that work?

All public key cryptography relies on the existence of one-way functions: mathematical functions that are very easy to calculate in one direction but nearly impossible to "undo", or calculate in the other direction.

RSA has been the predominant cryptosystem since its introduction in 1977. It relies on prime factorization of very large numbers.

Prime factorization is the process of breaking a number down into the product of prime numbers. This is easy with small numbers: for instance, the prime factors of 70 are 2 * 5 * 7. Now do that with a 2048-bit integer, and it ends up being pretty complicated.

Sweet good thing someone figured that out. Now we can all kick back and relax knowing all of our information is secure!

Well, computers are a lot faster nowadays than in 1977. Unfortunately that means that they're also getting faster at factoring large prime numbers. While a 256 bit key might've cut it at one point, now that key can be broken in ⌚👀, 103 seconds.

Computers and prime numbers are now in an arms race, with the current key size recommendation being 2048 bits. As keys get larger, operations obviously become slower. Meanwhile, the threat of quantum computing looms on the horizon. The now infamous Shor's algorithm threatens to solve prime factorization in polynomial time. Which would render RSA as good as done.

Is there no hope for privacy?!

There's a new one-way function on the block: Elliptic Curve Cryptography. Now with 100% less prime factorization!

What's an elliptic curve?

Elliptic curves are cool looking curves that look like this:

Everything you wanted to know about Elliptic Curve Cryptography – Fission (2)

And are graphed with equations that looks like this:

y^2 = x^3 + ax + b

Except decimals are a bit unruly so we only take the integers, and then take a modulus of the function (basically wrap the graph around the edges like an old game of snake), so the graph actually ends up looking something like this (note there's still a horizontal line of symmetry):

Everything you wanted to know about Elliptic Curve Cryptography – Fission (3)

Alright, but what do these have to do with cryptography?

The basic procedure of ECC is this:

  • Choose a curve and a point P on the curve (everyone uses the same point)
  • Choose an arbitrary very large number N (this is your private key).
  • Using point addition, add P to itself N times
  • The x-coordinate of N*P is your public-key

Can you ground this in reality a bit?

Sure! Let's draw an analogy to adjusting a clock. Here are the same steps listed out but with a clock instead of an elliptic curve:

  • Grab a clock sitting at exactly midnight and choose an arbitrary number of seconds P
  • Choose a very large number N
  • Move the clock forward P seconds N times (pretend you have really fast hands 😜)
  • Give the clock to a friend and tell them how big each step was (P) then see if they can figure out how many times you moved it (N) to arrive at the current location

And how well does this whole thing work?

It turns out this is a much more robust one-way function than prime factorization. In fact, we can achieve the same security as a 3072-bit RSA key with a 256-bit ECC key. Not bad!

What if someone guesses the same number N that I chose?

There's a mind-blowingly large range of numbers to choose from. Each key is 256 bits so you have 2^256 = 10^77 options. To give you a scale of how big this is, there are:

  • ~10^18 grains of sand on earth
  • ~10^22 stars in the observable universe
  • ~10^78 atoms in the observable universe

So guessing someone's private key would be approximately equivalent to guessing a random atom in the universe.

Doesn't it take a long time to calculate my public key?

Nope, point addition is associative. Meaning:
P + P + P + P = (P + P) + (P + P) = 2P + 2P

So when calculating a N*P for a very large N, you only need to calculate P + 2P + 4P + 8P...

At most, you must calculate 256 terms. Trivial for a computer. But to guess the public key for a given private key, you would need to check every number in between (that big number we talked about earlier).

How do these keys translate into cryptographic functions?

ECDH is a key sharing algorithm, most commonly used to send encrypted messages. ECDH works by multiplying your private key by another's public key to get a shared secret, then using that shared secret to perform symmetric encryption.

To illustrate why this works:

  • Alice and Bob agree on a curve with starting point P
  • Alice has a private key a and public key A = a * P
  • Bob has a private key b and public key B = b * P
  • a * B = a * b * P = b * A
  • So a * b * P ends up being the shared secret

ECDSA is a signature algorithm, used to prove authenticity of some information. The algorithm is a bit trickier than ECDH.
Warning: lots of equations, feel free to skip to the takeways below.

  • Alice and bob agree on a curve with starting point P
  • Alice has a private key a and public key A = a * P
  • Alice chooses a random k and point K = k * P
  • Alice takes r which is just the x-value of K
  • Alice hashes her message to produce hash H
  • Alice calculates a value s = inv(k)*(H+ra)
  • Alice sends her message to Bob along with the signature (r, s)
  • Bob calculates H from the message
  • Bob ensures that r = H*inv(s)*P + r*inv(s)*A
  • If it does, the signature is valid!

If you skipped those equations or they don't quite click, the key takeaways are:

  • Alice sends a random value r and a calculated value s that could only be calculated with a combination of the private key, the message hash, and the random value, but gives away no information about her private key.
  • Bob can verify r and s by using just the message hash and Alice's public key
  • You need a good source of randomness to use ECDSA. If you're randomness function is broken, repeated signatures can disclose your private key

Real quick, you mentioned symmetric encryption. How does that work?

Symmetric encryption uses just one key to encrypt and decrypt a message. Encrypted messages just look like random jumbles of letters and numbers that give no information about the underlying message unless you have the key to "unjumble" it. Most algorithms use a block cipher. This involves choosing a block size (say 64 bits), and encrypting the message in blocks of that size.

We mentioned symmetric encryption when talking about ECDH. When people say "asymmetrically encrypted", they actually mean "symmetrically encrypted with a secret that is shared asymmetrically".

A few examples of algorithms are AES, Salsa20, or Triplesec (which is actually just a combo of the first two for extra security).

Okay, I generally understand how this works, but how do people decide on a curve and a point P?

A bunch of different ways, sometimes they're chosen for a specific reason, sometimes they're algorithmically determined. Different curves have different properties. Checkout Safe Curves for an analysis of different curves.

Can "faulty" curves give backdoors?

Yes! Faulty curves can give shortcuts to determining a private key from a given public key.

Many suspect that NIST curves have NSA backdoors in them. This is because a published NIST randomization algorithm (that the NSA tightly collaborated on) was found to have a backdoor. We encourage you not to use any curves published by the NIST!

What's this "Edwards Curve" I keep hearing about?

Most Elliptic curves are Montgomery Curves. Edwards Curves were described by mathematician Harold Edwards and popularized by cryptographer Daniel Bernstein. They have a different structure that allows for a faster signature algorithm. This signature algorithm, when performed on an Edwards curve, is called EdDSA. This algorithm runs in constant time, meaning it's faster and leaks less information

Can Edwards Curves do key sharing?

Edwards curves are specifically used for signatures. There is not a related Diffie-Hellman key sharing algorithm.

So if I want to use both ECDH & EdDSA, I need two key pairs?

Not exactly. Let's take the most common Edwards curve Ed25519. This curve is related to Montgomery curve Curve25519. In fact Ed25519 is a twist of Curve25519. A "twist" basically means that the curves are mappable to one another. What this means is that you can use the same private key to generate a public key on both curves and then transform those public keys between one another without any knowledge of the private key. Specifically, with these equations.

(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))

where (u, v) is the Curve25519 point and (x, y) is the Ed25519 point

You can read a more in-depth post about that Here.

What cryptography algorithms do protocols like Bitcoin, Ethereum, and IPFS use?

Bitcoin uses secp256k1 for completely arbitrary reasons
Etherem uses secp256k1 for interop with Bitcoin
IPFS uses Ed25519 and RSA.

Okay so what do you recommend?

We're using Ed25519 & Curve25519. We chose these because:

  • They are well-recognized as safe curves
  • They are one of the more commonly used curves, so we have easier interop
  • They allow us to use EdDSA for signatures
  • We're fairly certain that they don't have any backdoors in them

This is sweet! Why doesn't everyone have a private key??

We ask ourselves the same question everyday. The main reason is: it's a pain. Keys look scary (6A576D5A7134743777217A25432A462D4A614...). And if you lose a key, you're forever screwed. There's no "recovery by email" available.

What are people doing about this?

We need to fix the UX of public keys. Remove the scary hexadecimal strings and provide more painless recovery.

A few options are

  • Replication: Share the same key across multiple devices. If you drop your phone in a lake, you can recover your key with your laptop
  • Shamir Secret Sharing: This involves splitting a key up into separate "shares". Each share reveals nothing about the key, but by combining the shares back together, you can recover the private key. This leads to interesting solutions like social recovery or zero-knowledge key recovery which we implemented as a Proof of Concept.
  • Secure Hardware Enclaves: Many phones and computers that are coming out these days have Secure Hardware Enclaves. These use both hardware and software to provide very strong security gurantees
  • Hardware Secure Modules (HSMs): These are similar to Secure Hardware Enclaves, but larger and hold more information. Physical modules exist, and you can also rent space from cloud providers such as AWS. Less security-minded users might be interested in backing up their keys with a "trusted custodian" (this still ends up being quite a bit safer than the internet's current security model).

How are you using private keys?

Here at Fission, we wanted to get private keys into the hands of our users as quickly as possible. We just rolled out our new authentication scheme which uses private keys to power our command line tool: Fission Live. Give it a go and let us know what you think! We have other big projects coming down the pipeline soon that will use this public key infrastructure to power some really neat features: a global encrypted filesystem, cryptographically verifiable claims, and more!

Everything you wanted to know about Elliptic Curve Cryptography – Fission (2024)

FAQs

What is the ECC secret key? ›

The ECC private key is used to generate digital signatures, and the ECC public key is used to verify digital signatures. ICSF generates ECC key pairs using the Elliptic Curve Digital Signature Algorithm (ECDSA).

What is elliptic curve cryptography simple explanation? ›

Elliptic Curve Cryptography (ECC) is a key-based technique for encrypting data. ECC focuses on pairs of public and private keys for decryption and encryption of web traffic. ECC is frequently discussed in the context of the Rivest–Shamir–Adleman (RSA) cryptographic algorithm.

What is the problem with elliptic curve cryptography? ›

Basic idea: Given an elliptic curve E(modp), the problem is that not to every x there is an y such that (x, y) is a point of E. Given a message (number) m we therefore adjoin to m few bits at the end of m and adjust them until we get a number x such that x3 + ax + b is a square modp.

How the elliptic curves are useful for cryptography? ›

ECC can yield a level of security that requires fewer computing resources to encrypt and decrypt data compared to alternative methods, like RSA. For example, ECC using a 256-bit key would require a 3,072-bit RSA key to achieve equivalent protection.

How does ECC generate keys? ›

ICSF generates ECC key pairs using the Elliptic Curve Digital Signature Algorithm (ECDSA). This algorithm uses elliptic curve cryptography (an encryption system based on the properties of elliptic curves) to provide a variant of the Digital Signature Algorithm.

What are the key components of ECC? ›

ECC's primary components are elliptical curves, finite fields, Generator points, public and private keys, and the Elliptic-Curve Discrete Logarithm Problem (ECDLP) ECC is faster and more efficient than RSA but has a steeper learning curve.

What are the disadvantages of ECC? ›

Disadvantages of ECC

Random number generator: The system's security is compromised if a broken random number generator is used at the time of private key selection. Patents: It is one of the main factors restricting the widespread use of the ECC algorithm.

Is ECC a trap door function? ›

Elliptic curve cryptography (ECC) is a type of public-key cryptographic system. This class of systems relies on challenging "one-way" math problems – easy to compute one way and intractable to solve the "other" way. Sometimes these are called "trapdoor" functions – easy to fall into, complicated to escape.

Is ECC a hashing algorithm? ›

Simply put, ECC is a more efficient and powerful hash function than SHA. The small size of ECC allows you to speed up SSL handshake speeds, which translates into speed and higher security. The small size also allows you to equip certificates to devices with smaller processing power like IoT devices.

What is an example of ECC cryptography? ›

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 conclusion of elliptic curve cryptography? ›

Conclusion. ECC is an adaption of integer-based classical asymmetric cryptography. Because it is more efficient in terms of key length and power consumption, it is a useful alternative to integer-based algorithms.

Can you encrypt with elliptic curve? ›

The elliptic curve cryptography (ECC) does not directly provide encryption method. Instead, we can design a hybrid encryption scheme by using the ECDH (Elliptic Curve Diffie–Hellman) key exchange scheme to derive a shared secret key for symmetric data encryption and decryption.

What are the advantages and disadvantages of elliptic curve cryptography? ›

Elliptic curve cryptography or RSA algorithm and why? | Advantages and Disadvantages
  • Smaller keys, ciphertexts and signatures.
  • Very fast key generation.
  • Fast signatures.
  • Moderately fast encryption and decryption.
  • Signatures can be computed in two stages, allowing latency much lower than inverse throughput.

What is the most used elliptic curve? ›

As you can see, the most popular (preferred) elliptic curve is NIST P-256, followed by X25519. Let's try to describe the difference between these curves and look at a few others that might be popular in the coming years.

What is better than elliptic curve cryptography? ›

That said, quantum cryptography in its present form is a key exchange, rather than encrypting data. As a key exchange it is very secure, but requires satellites over ground stations. A stronger alternative to ECC is lattice-based cryptography, which is shown to be post-quantum secure.

Can quantum computers break elliptic curve cryptography? ›

Quantum computing attacks

Shor's algorithm can be used to break elliptic curve cryptography by computing discrete logarithms on a hypothetical quantum computer. The latest quantum resource estimates for breaking a curve with a 256-bit modulus (128-bit security level) are 2330 qubits and 126 billion Toffoli gates.

What are the advantages of ECC cryptography? ›

Advantages of ECC
  • Very fast key generation.
  • Smaller keys, cipher-texts, and signatures.
  • Fast signatures.
  • Signatures can be computed in two stages, allowing latency much lower.
  • Moderately fast encryption and decryption.
  • Than inverse throughput.
  • Right protocols for authenticated key exchange (FH-ECMQV et al.).
Sep 3, 2018

What size key is the elliptic curve? ›

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). The most popular key agreement scheme is called Elliptic Curve Diffie-Hellman (ECDH).

What is an example of a ECC private key? ›

ECC Keys. The private keys in the ECC are integers (in the range of the curve's field size, typically 256-bit integers). Example of 256-bit ECC private key (hex encoded, 32 bytes, 64 hex digits) is: 0x51897b64e85c3f714bba707e867914295a1377a7463a9dae8ea6a8b914246319 .

What do you use the secret key for? ›

The secret key method of encryption, which involves the use of a single key, is used to encrypt and decrypt the information and is sometimes referred to as symmetric key cryptography.

What to do with the secret key? ›

The Secret Key opens up Rotom's Room at the Team Galactic Eterna Building in Eterna City after it has been cleared. It contains five appliances necessary for Rotom to change between its six forms.

What is the strength of ECC key? ›

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). The most popular key agreement scheme is called Elliptic Curve Diffie-Hellman (ECDH).

Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated:

Views: 5966

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.