CSCE 222 Lecture 34

From Notes
Jump to navigation Jump to search

(and 35)« previous | Friday, April 29, 2011 | next »


RSA Public Key Encryption

RSA stands for last names of inventors

RSA invented to solve problem of easy crackability of bitstreams. Basically It establishes a common secret between two parties. But before we begin…

Euler's Totient Function

Denoted by φ:

φ(n)=np|n(11p)

When the product ranges over all primes p that divide n (prime factorization).

Example

Suppose n is a product of two distinct primes p and q, then:

φ(pq)=pq(11p)(11q)=(p1)(q1)


Key Generation

Alice selects two distinct large (2000 bits) prime numbers p and q, and computes their product n=pq.

She selects an odd integer e>0 such that gcd(e,φ(n))=1

She then computes positive integers d and k such that edkφ(n)=1.

In other words, ed1modφ(n)

She publishes the pair P=(e,n) (p and q are kept secret because factoring n is very difficult to do)

Encryption and Decryption

Overview: Suppose we want to send Alice a message. This message is chopped into blocks of 1024 bits and encrypt it using the public key. To decrypt it, Alice uses her private key.

Process:

  1. For simplicity, we'll assume that the message is encoded as an integer M in the range [2,n).
  2. If Bob wants to send the message M to Alice, he gets the public key P=(e,n)
  3. and raises it to the e, modulo n: C=Memodn
  4. alice uses her secret key (d,n) and raises it to the d power:
    CdMedMmodn


Correctness of RSA

Why does this work?

Prerequisites:


The RSA Algorithm States:

  • Let n=pq be a product of two distinct primes p and q.
  • Let e,d,k+ such that ed=1+kφ(n).
MedMmodn

Proof

By the Chinese Remainder Theorem, we can show that

MedMmodpMedMmodq

since gcd(p,q)=1 are distinct primes.

By Fermat's Little Theorem,

M0modpMedMmodpM≢0modpMp11modp

Hence,

MedM1+kφ(n)MedM(Mp1)k(q1)MedMmodp