Graduate

GraduateDiscrete MathematicsCryptography


RSA and Elliptic Curve Cryptography


Coding and encryption are at the core of modern digital communications. The two most well-known methods for secure communications, RSA and Elliptic Curve Cryptography (ECC), are based on the principles of discrete mathematics. This article will go deeper into these cryptographic systems and help clarify how we use mathematical principles to encrypt data, so that it stays safe from curious eyes.

RSA cryptography

RSA is named after its developers, Ron Rivest, Adi Shamir, and Leonard Adleman, who introduced it in 1977. It is a form of public-key cryptography, which uses two keys – a public key used for encryption and a private key used for decryption.

Basic principles of RSA

The security of RSA depends on the difficulty of factoring large integers. It works like this:

  1. Key creation:
    • Choose two different prime numbers p and q.
    • Calculate n = p * q. The number n is used as the modulus for both public and private keys. Its length, usually expressed in bits, is the length of the key.
    • Calculate φ(n) = (p-1)(q-1).
    • Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1. The number e is the public exponent.
    • Define d as d ≡ e -1 (mod φ(n)), which means that d is the modular multiplicative inverse of e modulo φ(n).
    The public key is (e, n), and the private key is (d, n).
  2. Encryption:
    • The message M is encrypted with the recipient's public key: C ≡ M e (mod n), where C is the ciphertext.
  3. Decryption:
    • The ciphertext C is decrypted using the private key: M ≡ C d (mod n), giving back the original message M.

Illustrative examples

Suppose we choose prime numbers p = 61 and q = 53, then n = 61 * 53 = 3233.

The total is φ(n) = (61-1)(53-1) = 3120.

Choose e = 17, which is coprime to 3120.

To find d, the extended Euclidean algorithm gives d = 2753.

Encrypting a message

Let M = 65 encrypted messages C:

C = 65 17 mod 3233

Using fast exponentiation, we get C = 2790.

Decrypting the message

To retrieve M:

M = 2790 2753 mod 3233

Once again, using efficient computation we return to M = 65.

Security of RSA

The strength of RSA lies in the size of the modulus n. The larger the value, the more difficult it is to divide n into its prime components, p and q. This computational difficulty ensures the security of the private key. In addition, choosing a sufficiently large exponent e plays a role in making RSA robust against specific types of attacks.

Elliptic curve cryptography (ECC)

Elliptic curve cryptography is a modern method of cryptography. It uses the properties of elliptic curves over finite fields. ECC is praised for its efficiency as it provides security equivalent to RSA, but with much smaller key sizes.

Understanding elliptic curves

An elliptic curve is defined by the following equation:

y 2 = x 3 + ax + b

For cryptography purposes, we focus on elliptic curves over finite fields, especially fields of prime order.

y 2 = x 3 + ax + b over finite fields

Consider a finite field F p where p is a prime number. Then the elliptic curve consists of the points (x, y) that satisfy the curve equation, which includes a special point at infinity denoted as O

Point operations on elliptic curves

Operations on elliptic curves are governed by the rules of point addition and scalar multiplication. These operations operate under modular arithmetic of finite fields.

Adding digits

Given two points P = (x 1 , y 1) and Q = (x 2 , y 2), their sum R = P + Q = (x 3 , y 3) is calculated as follows:

  • If P ≠ Q, then use:
    λ = (y 2 - y 1) / (x 2 - x 1) mod px 3 = λ 2 - x 1 - x 2 mod py 3 = λ(x 1 - x 3) - y 1 mod p
  • If P = Q, then use:
    λ = (3x 1 2 + a) / 2y 1 mod px 3 = λ 2 - 2x 1 mod py 3 = λ(x 1 - x 3) - y 1 mod p

Scalar multiplication

This operation is important in ECC. If k is a scalar and P is a point on the curve, then kP is the result obtained by adding P to itself k times.

ECC key generation

ECC uses scalar multiplication to generate keys. Here is a simple outline of generating an elliptic curve key pair:

  1. Choose a prime number p and parameters a and b to define the curve.
  2. Choose the base point G in the curve.
  3. Select a random integer d as the private key.
  4. Calculate Q = dG, where Q is the public key.

Example of ECC public key generation

Consider an elliptic curve at F p where p = 17, a = 2, and b = 2. Let us choose G = (5,1).

Suppose d = 7, then we calculate:

Q = 7G = G + G + G + G + G + G + G

By repeatedly adding the points, we get Q

ECC security

The security of ECC is based on the Elliptic Curve Discrete Logarithm Problem (ECDLP). Given two points P and kP, determining k is computationally impossible. This is similar to the problem of factoring large prime numbers in RSA.

Comparison between RSA and ECC

While RSA and ECC serve the same purpose in terms of encrypting, signing, and verifying data, they do so through different mathematical principles. Here are some key differences:

  • Key size: ECC offers greater strength per bit than RSA, which means smaller keys for the same level of security.
  • Performance: ECC can be more efficient in terms of computational cost, especially for mobile devices and resource-limited environments.
  • Longevity: Since RSA will require larger key sizes to maintain security in the future, ECC is a more promising candidate for long-term cryptographic security.

Visual representation

Consider how these principles work in the graphical representation of an elliptic curve.

Hey

In this example, the blue curve represents an elliptic curve, while the point labeled O represents the point at infinity, an essential concept in elliptic curve arithmetic.

Both RSA and ECC represent important cryptographic achievements based on discrete mathematics. RSA relies heavily on integer factorization, while ECC relies on the geometric properties of elliptic curves. Together, they provide robust solutions for securing data in the digital age, each with its own unique strengths and applications.


Graduate → 10.3.3


U
username
0%
completed in Graduate


Comments