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

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

Example

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


Key Generation

Alice selects two distinct large (2000 bits) prime numbers and , and computes their product .

She selects an odd integer such that

She then computes positive integers and such that .

In other words,

She publishes the pair ( and are kept secret because factoring 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 in the range [2,n).
  2. If Bob wants to send the message to Alice, he gets the public key
  3. and raises it to the , modulo :
  4. alice uses her secret key Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (d,n)} and raises it to the Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle d} power:
    Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle C^d \equiv M^{ed} \equiv M \mod{n}}


Correctness of RSA

Why does this work?

Prerequisites:


The RSA Algorithm States:

  • Let Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n=pq} be a product of two distinct primes Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle p} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle q} .
  • Let Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle e, d, k \in \mathbb{Z}^+} such that Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle ed=1+k\varphi(n)} .

Proof

By the Chinese Remainder Theorem, we can show that

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} M^{ed} & \equiv M \mod{p} \\ M^{ed} & \equiv M \mod{q} \end{align}}

since Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{gcd}(p,q)=1} are distinct primes.

By Fermat's Little Theorem,

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{matrix} M \equiv 0 \mod{p} \quad \longrightarrow \quad M^{ed} \equiv M \mod{p} \\ M \not\equiv 0 \mod{p} \quad \longrightarrow \quad M^{p-1} \equiv 1 \mod{p} \end{matrix} }

Hence,