Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 24: Return of ROCA

David Evans
November 21, 2017

Class 24: Return of ROCA

cs2102: Discrete Mathematics
University of Virginia, Fall 2017

See course site for notes:
https://uvacs2102.github.io

David Evans

November 21, 2017
Tweet

More Decks by David Evans

Other Decks in How-to & DIY

Transcript

  1. Class 24: Return of ROCA Attack cs2102: Discrete Mathematics |

    F17 uvacs2102.github.io David Evans University of Virginia
  2. Recap (last class): Diffie-Hellman-Merkle Key Exchange " = " mod

    * = * mod Picks secret Picks secret Public values: (primitive root), (large prime) "* = * " mod *" = " * mod As long as discrete log problem is “hard”, eavesdropper cannot learn anything useful about "* from , , " = " mod , * = *mod .
  3. Encryption 7 Encrypt Decrypt Plaintext Ciphertext Plaintext Insecure Channel Key

    Key Symmetric Crypto: channel encrypted with shared secret key. MightBeEvil.org Client (Browser) Server
  4. Symmetric Encryption 8 Jefferson’s Cipher Wheel (1802) “on the periphery

    of each, and between the black lines, put all the letters of the alphabet, not in their established order, but jumbled, & without order, so that no two shall be alike.”
  5. Modern Symmetric Encryption 9 AES Round 128 or more key

    bits ~1017 J needed for most efficient possible brute force attack Very inexpensive: instructions built in to most processors
  6. Modern Symmetric Encryption 10 AES Round 128 or more key

    bits ~1017 J needed for most efficient possible brute force attack Very inexpensive: instructions built in to most processors
  7. 11 “virginia.edu”, = … = ... signed by Certificate Authority

    Verify and Decrypt: 7 9 () = Verify signature on certificate Server Recap (before Halloween): Is D-H-M Key Exchange enough to solve digital signatures?
  8. Asymmetry Required Need a function f that is: Easy to

    compute: given x, easy to compute f (x) Hard to invert: given f (x), hard to compute x Has a trap-door: given f (x) and t, easy to compute x 12
  9. Asymmetric (Public Key) Encryption: Confidentiality 13 Encrypt Decrypt Plaintext Ciphertext

    Plaintext Bunny’s Public Key Bunny’s Private Key Insecure Channel Asymmetric Crypto: Armadillo obtains Bunny’s Public Key, and can send private messages to Bob.
  10. 14 Encrypt Decrypt Plaintext Ciphertext Plaintext Bunny’s Public Key Bunny’s

    Private Key Insecure Channel Signatures: Bunny signs a message with her Private Key; Armadillo verifies signature with Bunny’s Public Key. Asymmetric (Public Key) Encryption: Confidentiality Signatures
  11. 19 RSA Cryptosystem 9 = 9 mod = mod Encryption

    using public key (, ): Decryption using private key and public :
  12. 20 Correctness of RSA Cryptosystem 9 = 9 mod =

    mod Correctness property: for all messages ∈ , =
  13. 21 Correctness of RSA Cryptosystem 9 = 9 mod =

    mod Correctness property: for all messages ∈ , = 7 9 () = (9mod ) = 9 mod = For RSA to be correct, and must be chosen to ensure this property!
  14. 22 Ensuring Correctness 7 9 () = (9mod ) =

    9 mod = 9 mod = 9 EF mod = 1 Divide by Euler Fermat
  15. Fermat’s Little Theorem GEF ≡ 1 (mod ) If is

    not divisible by : mod , 2 mod , … , − 1 mod = {1, 2, … , − 1 } × 2 × ⋯ × − 1 ≡ 1 × 2 × … × ( − 1) mod − 1 ! GEF ≡ − 1 ! mod GEF ≡ 1 mod
  16. = number of numbers between 1 and that are relatively

    prime to . If is prime, = − 1. If is composite, (maybe) hard to compute .
  17. Euler’s Theorem Euler R(S) ≡ 1 mod For and relatively

    prime: Case 1: is prime = − 1 So, R(S) ≡ 1 mod by Fermat’s Little Theorem
  18. Euler’s Theorem Euler R(S) ≡ 1 mod For and relatively

    prime: Case 2: is not prime =number of numbers between 1 and that are relatively prime to
  19. Euler Case 2: is not prime =number of numbers between

    1 and that are relatively prime to
  20. Euler’s Theorem Euler R(S) ≡ 1 mod For and relatively

    prime: Case 2: is not prime =number of numbers between 1 and that are relatively prime to . = set of those numbers = { F , V , … , R S } = multiply each in by (mod ) = { F mod , V mod , … , R(S) mod }
  21. Euler’s Theorem Euler Case 2: is not prime = set

    of those numbers = { F , V , … , R S } = multiply each in by (mod ) = { F mod , V mod , … , R(S) mod } Since and are relatively prime, is relatively prime to all X, X is relatively prime to , So: = .
  22. Euler’s Theorem Euler Case 2: is not prime = set

    of numbers < relatively prime to = { F , V , … , R S } = = { F mod , V mod , … , R(S) mod } So, product() = product():
  23. Euler’s Theorem Euler Case 2: is not prime = set

    of numbers < relatively prime to = { F , V , … , R S } = = { F mod , V mod , … , R(S) mod } So, product() = product(): F ×V × ⋯ × R S = F mod × ⋯ ×R S mod F ×V × ⋯ × R S = R S F ×V × ⋯ ×R S mod 1 ≡ R S mod
  24. 38 Correctness of RSA Cryptosystem 9 = 9 mod =

    mod 7 9 () = (9mod ) = 9 mod = Euler’s Theorem For and relatively prime: R(S) ≡ 1 mod
  25. Totient of Product of Primes? = for primes and =

    − 1 − − 1 − − 1 numbers between 1 and numbers divisible by numbers divisible by
  26. Totient of Product of Primes? = for primes and =

    − 1 − − 1 − − 1 = − + + 1 = − 1 − 1
  27. 42 9 = 9 mod = mod 7 9 ()

    = (9mod ) = 9 mod = Euler’s Theorem For and relatively prime: R(S) ≡ 1 mod = = − 1 − 1
  28. 43 7 9 () = (9mod ) = 9 mod

    = Euler’s Theorem For and relatively prime: R(S) ≡ 1 mod = = − 1 − 1 e⋅R(S) ≡ 1 mod e⋅R S gF ≡ mod Pick , such that: ≡ 1 mod
  29. 44 9 = 9 mod = mod 7 9 ()

    = (9mod ) = 9 mod = Euler’s Theorem For and relatively prime: R(S) ≡ 1 mod = = − 1 − 1 relatively prime to ≡ 1 mod ( − 1)( − 1) ≡ EF mod ( − 1)( − 1)
  30. Summary: RSA Cryptosystem ≡ EF mod ( − 1)( −

    1) 9 = 9 mod = mod = ( and are prime) Pick , public exponent
  31. Asymmetry Required Need a function f that is: Easy to

    compute: given x, easy to compute f (x) Hard to invert: given f (x), hard to compute x Has a trap-door: given f (x) and t, easy to compute x 46
  32. Easy (Enough) to Compute Easy to compute: 47 9 =

    9 mod Using fast exponentiation, compute mod about log2 multiplications
  33. Hard to Invert 48 Given ( ), and , hard

    to compute M. ≡ EF mod ( − 1)( − 1)
  34. Hard to Invert 49 Given ( ), and , hard

    to compute M. If attacker can factor = , easy to find : = EF ( – 1)( – 1) All other attacks seem to be equivalent to factoring .
  35. Hard to Invert 51 Given ( ), and , hard

    to compute M. If attacker can factor = , easy to find : = EF ( – 1)( – 1) All other attacks seem to be equivalent to factoring . No one seems to know a fast way to factor in general, except with a quantum computer (and building a large one seems pretty hard).
  36. Hard to Invert 52 Given ( ), and , hard

    to compute M. If attacker can factor = , easy to find : = EF ( – 1)( – 1) All other attacks seem to be equivalent to factoring . No one seems to know a fast way to factor, except with a quantum computer (and building a large one seems pretty hard). RSA paper, 1977
  37. Generating RSA Keys Pick two large primes: , Generate modulus:

    = Pick public exponent: Compute secret exponent: = EF mod − 1 − 1 Publish public key: (, ) Store secret key securely: Destroy and
  38. Generating RSA Keys (1) Pick two large primes: , (2)

    Generate modulus: = (3) Pick public exponent: (4) Compute secret exponent: = EF mod − 1 − 1 (5) Publish public key: (, ) (6) Store secret key securely: Which is the hardest step?
  39. How many guesses? To find a prime around , need

    about log guesses. = number of primes up ≤ ≈ log
  40. Finding Large Random Primes “Hard” way: def find_prime_above(k): p =

    k while not is_prime(p): p += 1 return p Problems with the hard way: 1. Expensive to compute: is_prime is fairly expense, expect about log () guesses 2. Might pick a “bad” prime: also need − 1 and + 1 having large prime factors, etc.
  41. Finding Large Random Primes Infineon’s way (RSALib): pick random ∈

    ℤ (about 37 bits) pick random ∈ ℤ (62 bits for 512-bit RSA) v = product of first primes = 2 ×3 ×5 × ⋯ ×v = v + (65537" v ) (for RSA-512, = 39)