Introduction to Elliptic Curve Cryptography
By: Animesh Gaitonde
Tags: Elliptic Curve, Security, Cryptography, Software Development, Programming

Elliptic Curve Cryptography in simple words

Public Key cryptography

Introduction

In the past century, the world has seen unprecedented progress in the field of Cryptography, & Computer Security. In today’s world, all electronic devices use cryptography for secure communication. We have come a long way since the WW2 days when Nazis used the Enigma machine for military communication. With the world gravitating towards quantum supremacy, encryption might become a thing of past.

In this article, we will have a look at the fundamentals of Elliptic Curve Cryptography (ECC). This article will touch upon the high-level working of ECC without delving into the mathematical details. Along the way, we will also understand the basics of Public Key cryptography and why ECC is preferred over RSA.

Classical Cryptography

Before the advent of Asymmetric Key Cryptography, world extensively used Symmetric Key Cryptography. Assume that there are two parties communication over a network, let’s call them Alice & Bob. Alice wants to send some message to Bob.

An individual on the network reading messages

Anyone on the network can read what message is being exchanged. it’s essential to ensure the confidentiality of the messages while designing such a system. This problem was solved by Symmetric Key Cryptography. This mechanism uses a shared secret or a key between two parties that are communicating. Let’s walk through an example.

Both Alice and Bob will first meet and exchange the key. Alice while sending the message will encrypt the message and then send it to Bob. Since the message is encrypted, only the individual who has the key can decrypt the message. In this case, only Bob will be able to decrypt the message with the shared key. Similarly, Bob will also send an encrypted message to Alice and communication will happen to and fro. This ensures the confidentiality of the message in communication.

Symmetric Key Cryptography

What do you think are disadvantages of the above approach? Well, one of the major drawbacks is that the key must be shared with the other party. What will happen if the two parties are geographically separated & can’t meet?

Secondly, assume that you are designing a network like Bitcoin. Would you share your key with every other person? Also, how would you authenticate a user who is sending a message? In other words, how would you know that Alice is the one sending you the message and not anyone else? Public Key or Asymmetric Key Cryptography answers the above questions.

Public /Asymmetric Key Cryptography

Instead of a single key for encryption, Public Key Cryptography uses a pair of keys i.e Public Key and Private Key. These two keys are mathematically linked. Private key acts like a password and only the user store it. Public key acts as your address & everyone in the world knows about it. A simple analogy to visualize it is the private key is like your ATM pin, whereas the public key is like your bank account.

Anyone in the world can send you a message by encrypting with your public key. The encrypted message can be only decrypted by your private key. Since only you are aware of your private key, it’s guaranteed that no one else can decrypt the message sent to you. Same is the case when you want to message someone else, you would use that person’s public key to encrypt and send the message.

Public Key Cryptography process

Elliptic Curve Cryptography is a type of Public Key Cryptography. We will have a look at the fundamentals of ECC in the next sections. We will learn about Elliptic Curve, the operations performed on it, and the renowned trapdoor function.

Elliptic Curve

Elliptic Curve forms the foundation of Elliptic Curve Cryptography. It’s a mathematical curve given by the formula — y² = x³ + a*x² + b, where ‘a’ and ‘b’ are constants. Following is the diagram for the curve y² = x³ + 1.

Elliptic Curve

You can observe two unique characteristics of the above curve:-

The curve is symmetric about the X-axis. Every point on the curve lying above the X-axis has a reflection below it

If a non-vertical line is drawn, it can intersect the curve in at most 3 points

Operations on Elliptic Curve

Elliptic Curve defines addition operation where two points are chosen on the curve. A line is drawn between them and the intersection of this line with the curve is found. Further, the reflection of this point on X-axis becomes the result. Following is an illustration of the above operation.

Addition operation on Elliptic Curve

In the above diagram, two points P and Q are chosen. The line joining these two points meets the curve at point R. Reflection of point R on the X-axis is R’.

The process can now be repeated with the points P and R’. As illustrated below, the addition of these two points will result in S’ on the curve above the X-axis.

Addition of points P and R’, results in S’

This process can be repeated and is known as Elliptic Curve scalar multiplication or point multiplication.

Trapdoor function

Trapdoor function forms the cornerstone of Public Key Cryptography. In simple words, it’s a function that is easy to compute in one direction but computationally difficult in the opposite direction.

As a simple example is you need to find two prime numbers whose product is 39203. You will begin with the number 2, 3, 5, 7, etc until you find a prime number that divides 39203. But, if given that one of the numbers is 197, you can find the other by entering 39203 / 197 = 199.

This function in the above example can be made difficult by increasing the number of digits. Given two prime numbers, you can easily multiply and find the result. Yet, given a result, it becomes difficult (depending on the digits) to find two prime numbers such that their product equals the result.

The same concept is extended to an Elliptic Curve. We choose a point on the curve and multiply with itself ’n’ times. We can easily find the location of destination point given the starting point and ’n’. If you are only given the destination point & starting point, it becomes difficult to find the value of ’n’.

Elliptic curve Trapdoor function illustration

In the above diagram, if we start with P and n=2, we can reach S’. However, given the points P and S’, it’s nearly impossible to calculate the value of n.

Generation of Public & Private Keys in ECC

A pre-determined point is selected on the curve. This point is known as the Generation point (G). The private key is randomly generated and corresponds to the number ’n’. The generator point (G) must be multiplied with itself ’n’ times to find point K, which is the public key.

Multiplying Point G with itself

Adding a point G with itself is equivalent to drawing a tangent touching the curve at point G. This tangent intersects the curve at the point -2G. Reflection of the point -2G on X-axis is 2G. Multiplying 2G with itself results in 4G and so on and so forth, we can compute 8G, 16G, 32G, etc.

National Institue of Standards and Technology (NIST) has defined standards for elliptic curve with a set of constants. Bitcoin uses the secp256k1 which is y² = x³ + 7.

Why Elliptic Curve Cryptography?

ECC helps us achieve the same level of security as RSA with smaller key length. For eg: The security offered by a 256-bit ECC key is equivalent to a 3072-bit key using RSA.

Universal Security introduced a new concept of cryptographic carbon footprint. It compares the amount of energy required to break the Cryptographic algorithm with the amount of water the same energy could boil. Cracking a 228-bit RSA key requires energy sufficient to boil a teaspoon of water. While cracking a 228-bit ECC needs energy required to boil all the water on this earth.

ECC requires far fewer CPU cycles as compared to RSA. Implementing ECC on mobile devices, wearable technology, Bitcoin networks is far more efficient than using RSA. With ECC, we can achieve optimisation of 10% on storage and bandwidth.

Practical Applications of ECC

ECC is widely adopted in day to day life. Following are a few applications:-

Bitcoin networks use ECDSA (Elliptic Curve Digital Signature Algorithm) for authentication transactions

SSL/TLS for secure communication between the client and the server

Used by governments to secure internal communication

References