JEO

EXPLAINS

RSA

Ron Rivest

Adi Shamir

Len Adleman

Ronald Rivest Adi Shamir Len Adleman

What is the RSA Algorithm?

RSA is an asymmetric cryptosystem.

Cryptosystems are ways to encrypt and decrypt data.

lock asymmetry key

Asymmetric is Opposed to Symmetric

In asymmetric cryptosystems, there is one key for encryption and another key for decryption.

In symmetric cryptosystems, the same key is used for both encryption and decryption.

lock with key symmetry lock with key
Alice, Bob, and Eve
Alice and Bob
Alice, Bob, Eve asymmetric

Asymmetric = More Secure

How does it work?

BIG PRIME NUMBERS

Start with p and q, which are distinct prime numbers

n = p * q

φ(n) = (p - 1) * (q - 1)

Choose e such that 1 ≤ e < φ(n) and gcd(e, φ(n)) = 1

Find d, where d ≡ e-1 (mod φ(n)), meaning (d * e) % φ(n) === 1

Example: p = 2, q = 17

n = 2 * 17 = 34

φ(n) = (2 - 1) * (17 - 1) = 1 * 16 = 16

Choose e such that 1 ≤ e < φ(n) and gcd(e, φ(n)) = 1,

let’s pick e = 3

Find d, where d ≡ e-1 (mod φ(n)), meaning (d * e) % φ(n) === 1

11 * 3 = 33

33 % 16 = 1

d = 11

The public key is (3, 34). The private key is (11, 34).

key example

Where is RSA actually used?

Secure Shell (SSH) - used for remote command line interfaces like pushing to GitHub repositories via your local terminal

Transport Layer Security (TLS) - used for secure web browsing (any website that uses https like when you’re doing online banking)

Pretty Good Privacy (PGP) - used for encrypted emails like when Edward Snowden reached out to Laura Poitras to whistleblow about the NSA spying on everyone

choose two different prime numbers