Slide 1

Slide 1 text

Public Key Cryptography Bachelorseminar “Ausgewählte Kapitel der Informatik” Jan Sprinz LMU 31.10.2019 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 1 / 19

Slide 2

Slide 2 text

Cryptography cryp · tog · ra · phy “Practice of the enciphering and deciphering of messages in secret code in order to render them unintelligible to all but the intended receiver.” (Encyclopedia Britannica 2017) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 2 / 19

Slide 3

Slide 3 text

Motivation: Why encrypt anything? Figure 1: Communication between two parties, “Alice” and “Bob”. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 3 / 19

Slide 4

Slide 4 text

Motivation: Why encrypt anything? Figure 1: Communication between two parties, “Alice” and “Bob”. Why Alice and Bob? Representing parties “A” and “B” in a transmission “Fictional characters commonly used as placeholder names in cryptology” (Wikipedia 2019) First introduced by Rivest, Shamir, and Adleman (1978) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 3 / 19

Slide 5

Slide 5 text

Motivation: Why encrypt anything? Figure 2: Eavesdropping by a third party, “Eve”, on the communication between two peers, “Alice” and “Bob”. (cf. Wikipedia 2019) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 4 / 19

Slide 6

Slide 6 text

Motivation: Why encrypt anything? Figure 3: Man-in-the-middle attack: A malicious third party, “Mallory”, hijacks the communication between two peers, “Alice” and “Bob”. (cf. Wikipedia 2019) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 5 / 19

Slide 7

Slide 7 text

The secure system Requirements 1 Confidentiality: No unauthorized person should be able to read messages. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 6 / 19

Slide 8

Slide 8 text

The secure system Requirements 1 Confidentiality: No unauthorized person should be able to read messages. 2 Integrity: No unauthorized party should be able to modify messages. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 6 / 19

Slide 9

Slide 9 text

The secure system Requirements 1 Confidentiality: No unauthorized person should be able to read messages. 2 Integrity: No unauthorized party should be able to modify messages. 3 Authenticity: All parties need to be verifiable. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 6 / 19

Slide 10

Slide 10 text

The secure system Requirements 1 Confidentiality: No unauthorized person should be able to read messages. 2 Integrity: No unauthorized party should be able to modify messages. 3 Authenticity: All parties need to be verifiable. 4 Key Management: The keys need to be securely created, stored, and distributed. cf. Ernst, Schmidt, and Beneken (2016), 138 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 6 / 19

Slide 11

Slide 11 text

Traditional cipher system Figure 4: Traditional cipher system for the secure transmission of a message X using a key k and an encryption algorithm T, as well as a decryption algorithm T−1. Own graphic based on Dewdney (2001), 251 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 7 / 19

Slide 12

Slide 12 text

Traditional cipher system Figure 4: Traditional cipher system for the secure transmission of a message X using a key k and an encryption algorithm T, as well as a decryption algorithm T−1. Own graphic based on Dewdney (2001), 251 Example: caesar code Replace each letter of the message with the kth letter after it (cf. Ernst, Schmidt, and Beneken 2016, 140). Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 7 / 19

Slide 13

Slide 13 text

Traditional cipher system: Example: Caesar code Example: X = SECRET; k = 4 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 8 / 19

Slide 14

Slide 14 text

Traditional cipher system: Example: Caesar code Example: X = SECRET; k = 4 Encryption T = xi → xi+(kMODn) k = 0 S E C R E T k = 1 T F D S F U k = 2 U G E T G V k = 3 V H F U H W k = 4 W I G V I X Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 8 / 19

Slide 15

Slide 15 text

Traditional cipher system: Example: Caesar code Example: X = SECRET; k = 4 Encryption T = xi → xi+(kMODn) k = 0 S E C R E T k = 1 T F D S F U k = 2 U G E T G V k = 3 V H F U H W k = 4 W I G V I X Decryption T−1 = xi → xi−(kMODn) k = 0 W I G V I X k = 1 V H F U H W k = 2 U G E T G V k = 3 T F D S F U k = 4 S E C R E T Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 8 / 19

Slide 16

Slide 16 text

Limitations of traditional cipher systems The key needs to be known to all involved parties and no one else ⇒ the key needs to be communicated over a secure channel Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 9 / 19

Slide 17

Slide 17 text

Limitations of traditional cipher systems The key needs to be known to all involved parties and no one else ⇒ the key needs to be communicated over a secure channel The system does not scale Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 9 / 19

Slide 18

Slide 18 text

Limitations of traditional cipher systems The key needs to be known to all involved parties and no one else ⇒ the key needs to be communicated over a secure channel The system does not scale The key is a single point of failure, and is stored in multiple locations Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 9 / 19

Slide 19

Slide 19 text

Public Key Cryptography: Concept Figure 5: Public key cipher system. Own graphic based on Diffie and Hellman (1976), 647 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 10 / 19

Slide 20

Slide 20 text

Usecase: Signing Figure 6: “Alice” encrypts a message with her private key a. Everyone receiving the message can verify its authenticity by decrypting it with her public key a . Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 11 / 19

Slide 21

Slide 21 text

Usecase: Secure communication Figure 7: “Alice” encrypts a message with Bob’s public key b . Only Bob can decrypt it with his private key b. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 12 / 19

Slide 22

Slide 22 text

Usecase: Signed secure communication Figure 8: “Alice” encrypts a message with her private key a and Bob’s public key b . Bob can verify the authenticity of the message by decrypting with Alice’s public key and a and his private key b. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 13 / 19

Slide 23

Slide 23 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 24

Slide 24 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 25

Slide 25 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 26

Slide 26 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Avoiding security by obscurity “The reader is urged to find a way to ‘break’ the system. Once the method has withstood all attacks for a sufficient length of time it may be used with a reasonable amount of confidence.” (Rivest, Shamir, and Adleman 1978, 126) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 27

Slide 27 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Avoiding security by obscurity “The reader is urged to find a way to ‘break’ the system. Once the method has withstood all attacks for a sufficient length of time it may be used with a reasonable amount of confidence.” (Rivest, Shamir, and Adleman 1978, 126) Encryption is broken if. . . The private key is leaked Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 28

Slide 28 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Avoiding security by obscurity “The reader is urged to find a way to ‘break’ the system. Once the method has withstood all attacks for a sufficient length of time it may be used with a reasonable amount of confidence.” (Rivest, Shamir, and Adleman 1978, 126) Encryption is broken if. . . The private key is leaked The encryption system itself is cracked cf. Dewdney (2001), 255 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 29

Slide 29 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Avoiding security by obscurity “The reader is urged to find a way to ‘break’ the system. Once the method has withstood all attacks for a sufficient length of time it may be used with a reasonable amount of confidence.” (Rivest, Shamir, and Adleman 1978, 126) Encryption is broken if. . . The private key is leaked The encryption system itself is cracked cf. Dewdney (2001), 255 Our cryptosystem is broken if. . . Our problem is not NP-complete Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 30

Slide 30 text

Requirements and challenges Computing private key k and public key k k and k need to be easy to generate k must be easy to compute from k k must be difficult to compute from k cf. Dewdney (2001), 252 Avoiding security by obscurity “The reader is urged to find a way to ‘break’ the system. Once the method has withstood all attacks for a sufficient length of time it may be used with a reasonable amount of confidence.” (Rivest, Shamir, and Adleman 1978, 126) Encryption is broken if. . . The private key is leaked The encryption system itself is cracked cf. Dewdney (2001), 255 Our cryptosystem is broken if. . . Our problem is not NP-complete Someone proves that P == NP cf. Dewdney (2001), 255 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 14 / 19

Slide 31

Slide 31 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 32

Slide 32 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 33

Slide 33 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 34

Slide 34 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key second part of the public key: e 1 < e < φ(n) coprime of n and φ(n) with φ(n) = (p − 1)(q − 1) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 35

Slide 35 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key second part of the public key: e 1 < e < φ(n) coprime of n and φ(n) with φ(n) = (p − 1)(q − 1) coprimes: set of integers that only share 1 as a factor Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 36

Slide 36 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key second part of the public key: e 1 < e < φ(n) coprime of n and φ(n) with φ(n) = (p − 1)(q − 1) coprimes: set of integers that only share 1 as a factor a message m < n is encrypted using the following formula c = me MOD n Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 37

Slide 37 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key second part of the public key: e 1 < e < φ(n) coprime of n and φ(n) with φ(n) = (p − 1)(q − 1) coprimes: set of integers that only share 1 as a factor a message m < n is encrypted using the following formula c = me MOD n the private key is the integer d : 1 = ed MOD φ(n) Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 38

Slide 38 text

RSA cf. Dewdney (2001), 255 Underlying principle based on the factorization problem: find a non-trivial factor for an n-bit number In practice the keys are generated from two prime factors p and q the product n = pq becomes the first part of the public key second part of the public key: e 1 < e < φ(n) coprime of n and φ(n) with φ(n) = (p − 1)(q − 1) coprimes: set of integers that only share 1 as a factor a message m < n is encrypted using the following formula c = me MOD n the private key is the integer d : 1 = ed MOD φ(n) the message can be decrypted by computing cd MOD n = m. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 15 / 19

Slide 39

Slide 39 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 40

Slide 40 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 41

Slide 41 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 3 Calculate φ(n), the number of coprimes of n: 1, 3, 5, 9, 11, 13 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 42

Slide 42 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 3 Calculate φ(n), the number of coprimes of n: 1, 3, 5, 9, 11, 13 φ(n) = φ(14) = (p − 1)(q − 1) = (2 − 1)(7 − 1) = 6 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 43

Slide 43 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 3 Calculate φ(n), the number of coprimes of n: 1, 3, 5, 9, 11, 13 φ(n) = φ(14) = (p − 1)(q − 1) = (2 − 1)(7 − 1) = 6 4 Calculate e 1 < e < φ(n) coprime of n and φ(n) ⇒ e = 5 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 44

Slide 44 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 3 Calculate φ(n), the number of coprimes of n: 1, 3, 5, 9, 11, 13 φ(n) = φ(14) = (p − 1)(q − 1) = (2 − 1)(7 − 1) = 6 4 Calculate e 1 < e < φ(n) coprime of n and φ(n) ⇒ e = 5 5 Choose d : 1 = ed MOD φ(n), for example 11 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 45

Slide 45 text

RSA: Example: Generate key pair 1 Two prime numbers p = 2, q = 7 2 Calculate n = pq = 2 ∗ 7 = 14 3 Calculate φ(n), the number of coprimes of n: 1, 3, 5, 9, 11, 13 φ(n) = φ(14) = (p − 1)(q − 1) = (2 − 1)(7 − 1) = 6 4 Calculate e 1 < e < φ(n) coprime of n and φ(n) ⇒ e = 5 5 Choose d : 1 = ed MOD φ(n), for example 11 p q d e n 2 7 11 5 14 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 16 / 19

Slide 46

Slide 46 text

RSA: Example: Encrypt and Decrypt p q d e n m c 2 7 11 5 14 C = 3 E = 5 Encrypt c = me MOD n Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 17 / 19

Slide 47

Slide 47 text

RSA: Example: Encrypt and Decrypt p q d e n m c 2 7 11 5 14 C = 3 E = 5 Encrypt c = me MOD n c = 35 MOD 14 = 5 = E Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 17 / 19

Slide 48

Slide 48 text

RSA: Example: Encrypt and Decrypt p q d e n m c 2 7 11 5 14 C = 3 E = 5 Encrypt c = me MOD n c = 35 MOD 14 = 5 = E Decrypt m = cd MOD n Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 17 / 19

Slide 49

Slide 49 text

RSA: Example: Encrypt and Decrypt p q d e n m c 2 7 11 5 14 C = 3 E = 5 Encrypt c = me MOD n c = 35 MOD 14 = 5 = E Decrypt m = cd MOD n m = 511 MOD 14 = 3 = C Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 17 / 19

Slide 50

Slide 50 text

RSA: Is it secure? Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 51

Slide 51 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 52

Slide 52 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 53

Slide 53 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Computers are getting faster exponentially (moore’s law), so brute-forcing the key becomes easier Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 54

Slide 54 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Computers are getting faster exponentially (moore’s law), so brute-forcing the key becomes easier Yes There’s an infinite number of primes, so bigger factors can be used Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 55

Slide 55 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Computers are getting faster exponentially (moore’s law), so brute-forcing the key becomes easier Yes There’s an infinite number of primes, so bigger factors can be used Algorithms are still not efficient enough to make cracking encryption profitable Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 56

Slide 56 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Computers are getting faster exponentially (moore’s law), so brute-forcing the key becomes easier Yes There’s an infinite number of primes, so bigger factors can be used Algorithms are still not efficient enough to make cracking encryption profitable Quantum computers are still very experimental Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 57

Slide 57 text

RSA: Is it secure? No NP-completeness has never been proven, so there might highly efficient algorithms to solve the factorization problem Quantum computers allow for much more efficient factorization Computers are getting faster exponentially (moore’s law), so brute-forcing the key becomes easier Yes There’s an infinite number of primes, so bigger factors can be used Algorithms are still not efficient enough to make cracking encryption profitable Quantum computers are still very experimental In practice, bugs in implementations are a more likely attack vector cf. Ernst, Schmidt, and Beneken (2016), 164 Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 18 / 19

Slide 58

Slide 58 text

Bibliography Dewdney, Alexander K. 2001. The (New) Turing Omnibus: 66 Excurions in Computer Science. 1. paperbacks ed. Holt Paperback. New York, NY: Freemann. Diffie, W., and M. Hellman. 1976. “New Directions in Cryptography.” IEEE Transactions on Information Theory 22 (6): 644–54. Encyclopedia Britannica. 2017. “Cryptography.” April 13, 2017. https://www.britannica.com/topic/cryptography. Ernst, Hartmut, Jochen Schmidt, and Gerd Hinrich Beneken. 2016. Grundkurs Informatik. 6. Auflage. Lehrbuch. Wiesbaden: Springer Vieweg. Rivest, R. L., A. Shamir, and L. Adleman. 1978. “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems.” Commun. ACM 21 (2): 120–26. Wikipedia. 2019. “Alice and Bob.” Wikipedia. https://en.wikipedia.org/w/index.php?title=Alice_and_Bob&oldid=922042581. Jan Sprinz (LMU) Public Key Cryptography 31.10.2019 19 / 19