CSCE 465 Lecture 21

From Notes
Jump to navigation Jump to search

« previous | Tuesday, April 9, 2013 | next »


Public Key Cryptography

Invented and published in 1975

Much slower than Private Key and Hash functions.

Applications

  1. message integrity with digital signatures: sign with private key, verify with public key
    • only one person can sign the message: non-repudiation [1]
    • Only achievable with public key cryptography
  2. Communicating securely over an insecure channel: encrypt using public key, decrypt with private key
  3. Secure storage on an insecure medium (similar to above
  4. User Authentication: perform "operation" with private key, verify with public key.
  5. Key exchange for secret key cryptography


Algorithms

System Encryption/Decryption Digital Signatures Key Exchange
RSA Yes Yes Yes
Diffie-Hellman No No Yes
DSA No Yes No

Trapdoor One-Way Function

  • is easy to compute if and are known

RSA

(See MATH 470 Lecture 5#RSA→)

(See MATH 470 Lecture 6#RSA Review→)


Invented by Rivest, Shamir, and Adleman

Basis: factorization of large numbers is hard

Variable key length (1024 bits or greater)

Variable plaintext block size

  • plaintext block: smaller than key size
  • ciphertext block: same as key size

Setup

Find (using Miller-Rabin Algorithm) large primes and

  1. Let
  2. Compute (Euler's Totient function)
  3. Choose random relatively prime to (i.e. )
  4. Find
  5. Public key:
    Private key:
    (All other numbers must be kept private)

Operations

Encryption
Decryption
Signing
Verification
Key Negotiation
sends random number to , encrypted with 's public key
sends random number to , encrypted with 's public 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 A} 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 B} both decrypt received messages using their respective keys
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 A} 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 B} both compute 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 K = H(R_1 \oplus R_2)} and use that as the shared key.

Proof of Correctness

RSA works because 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 (m^d)^e = m^{d\,e} \equiv m^1 \equiv m \pmod{n}}

This is a side effect of having 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\,e \equiv 1 \pmod{\phi(n)}} 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 m < n}

Is RSA Secure?

Suppose you could factor 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 = p \, q} . Then RSA would be broken:

  • compute 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 \phi(n) = (p-1)(q-1)}
  • compute 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 = e^{-1} \pmod{\phi(n)}}

So to make 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} difficlut to factor,

  1. 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} should be similar length (about 500 bits if key is to be 1024 bits)
  2. 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-1)} 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-1)} should contain a large prime factor
  3. 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-1,q-1)} should be small
  4. d should be larger than 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 \sqrt[4]{n}}

Attacks

Probable-Message Attack

Using public 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 \left\langle e, n \right\rangle}

  1. Encrypt all possible plaintext messages
  2. Try to find a match between the ciphertext and one of the encrypted messages

This only works for small plaintext message sizes

Solution: Pad plaintext message with random text before encryption

  • PKCS #1 v1 specifies this padding format.

Timing Attacks

Recovers private key from running time of decryption algorithm.

Computing 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 m = c^d \pmod{n}} using repeated squaring algorithm:

m = 1
(k-1).downto(1) do |i|
  m = m*m % n
  if d[i] == 1
    m = m*c mod n       # !!! measure timing of this line
  end
end

Footnotes

  1. Alice cannot deny that she signed the message