“Just because you're
paranoid doesn't
mean they aren't
after you”
Joseph Heller, Catch-22
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
TRUST
Slide 12
Slide 12 text
HOW
DOES IT
WORK
Slide 13
Slide 13 text
HISTORY
Slide 14
Slide 14 text
SYMMETRIC KEY
ENCRYPTION
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
Symmetric Key Encryption
» Convert the clear alphabet into a cipher alphabet.
» A simple symmetric encryption key:
a b c d e f g h i j k l m n o p q r s t u v w x y z
| | | | | | | | | | | | | | | | | | | | | | | | | |
c d e f g h i j k l m n o p q r s t u v w x y z a b
"a secret massage".encrypt
# => "c ugetgv ocuucig"
Slide 17
Slide 17 text
Symmetric Key Decryption
» Convert the cipher alphabet into a clear alphabet.
» Decryption uses the same key, but in reverse.
c d e f g h i j k l m n o p q r s t u v w x y z a b
| | | | | | | | | | | | | | | | | | | | | | | | | |
a b c d e f g h i j k l m n o p q r s t u v w x y z
"c ugetgv ocuucig".decrypt
# => "a secret massage"
Slide 18
Slide 18 text
ROT13
a b c d e f g h i j k l m n o p q r s t u v w x y z
| | | | | | | | | | | | | | | | | | | | | | | | | |
n o p q r s t u v w x y z a b c d e f g h i j k l m
Slide 19
Slide 19 text
ROT13
a b c d e f g h i j k l m n o p q r s t u v w x y z
| | | | | | | | | | | | | | | | | | | | | | | | | |
n o p q r s t u v w x y z a b c d e f g h i j k l m
"Hello World".rot13.rot13.rot13.rot13
#=> "Hello World"
Slide 20
Slide 20 text
PUBLIC KEY
ENCRYPTION
Slide 21
Slide 21 text
MATH
Slide 22
Slide 22 text
Modulo
21 % 7
# => 0
23 % 7
# => 2
Slide 23
Slide 23 text
Mod-7
[0, 1, 2, 3, 4, 5, 6]
Slide 24
Slide 24 text
Greatest Common Divisor
a = 10; b = 4
a.gcd(b)
# => 2
Slide 25
Slide 25 text
Multiplicative Inverse
x * x⁻1 = 1
Slide 26
Slide 26 text
Multiplicative Inverse
3 * x⁻1 = 1 mod 11
Slide 27
Slide 27 text
Now for the
INTERESTING
stuff
Slide 28
Slide 28 text
GCD(4, 9) = 1
Slide 29
Slide 29 text
4 * x⁻1 = 1 % 9
Slide 30
Slide 30 text
4 * 7 = 28 = 1 % 9
Slide 31
Slide 31 text
ϕ
Slide 32
Slide 32 text
Euler's
Totient
Slide 33
Slide 33 text
For any prime number p
every number from 1 up to p − 1
has a GCD of 1 with p.
Slide 34
Slide 34 text
ϕ(p) = p - 1
Slide 35
Slide 35 text
RSA
Slide 36
Slide 36 text
Rivest
Shamir
Adleman
Slide 37
Slide 37 text
1. Key Generation
2. RSA Function Evaluation
Slide 38
Slide 38 text
» Large Prime Number Generation
» Calculate Modulus
» Pick a Public Key
» Calculate Private Key
p = 11
q = 13
n = p * q # 143
phi = p-1 * q-1 # 120
Slide 49
Slide 49 text
p = 11
q = 13
n = p * q # 143
phi = p-1 * q-1 # 120
e = 7 # Picked from [3..phi]
public_key = [e, n] # [7, 143]
Slide 50
Slide 50 text
Generate a Private Key
Slide 51
Slide 51 text
Generate a Private Key
“Given two integers have GCD of 1, then the smaller
nummer has a multiplicative inverse in the larger
mod-space.”
Slide 52
Slide 52 text
Generate a Private Key
“Given two integers have GCD of 1, then the smaller
nummer has a multiplicative inverse in the larger
mod-space.”
GCD(7, 120) = 1
Slide 53
Slide 53 text
x * x⁻1 = 1 mod y
Slide 54
Slide 54 text
e * d = 1 mod phi
Slide 55
Slide 55 text
e * d = 1 mod phi
7 * d = 1 mod 120
Slide 56
Slide 56 text
p = 11
q = 13
n = p * q # 143
phi = p-1 * q-1 # 120
e = 7 # Picked from [3..phi]
public_key = [e, n] # [7, 143]
d = extended_euclid(e, phi)
private_key = [d, n] # [103, 143]