Cryptology
Cryptology
Cryptology
Turing machines. Newtonian mechanics. Computability. Heisenberg uncertainty principle. NP-completeness. Speed of light.
Enigma machine
"Cryptography used to be an obscure science, of little relevance to everyday life. Historically, it always had a special role in military and diplomatic communications. But in the Information Age, cryptography is about political power, and in particular, about the power relationship between a government and its people. It is about the right to privacy, freedom of speech, freedom of political association, freedom of the press, freedom from unreasonable search and seizure, freedom to be left alone." - Phil Zimmermann
This lecture. Exploit hard problems. Apply theory to cryptography. RSA cryptosystem.
! ! !
"It is insufficient to protect ourselves with laws. We need to protect ourselves with mathematics." -- Bruce Schneier
Cryptology
Cryptology: science of secret communication. Cryptography: science of creating secret codes. Cryptanalysis: science of code breaking.
A Better Approach
Security by obscurity. Rely on proprietary, ad hoc cryptographic schemes. Eventually reverse-engineered and cracked. Ex: CSS for DVD encryption, RIAA digital watermarking, GSM cell phones, Windows XP product activation, Adobe eBooks, Diebold AccuVote-TS machines, . . . .
! ! !
Goal: information security in presence of malicious adversaries. Confidentiality: keep communication private. Integrity: detect unauthorized alteration to communication. Authentication: confirm identity of sender. Authorization: establish level of access for trusted parties. Non-repudiation: prove that communication was received.
! ! ! ! !
A better approach. Leverage theory of hard problems. Show that breaking security system is equivalent to solving some of the world's greatest unsolved problems!
! !
Kerckhoffs' principle.
"Il faut qui'l must n'exige pas secret, et qui'l "The system not require secrecy puisse sans inconvenient entre les and can be stolen by the tomber enemy without mains de l'ennemi." causing trouble."
Analog Cryptography
Digital Cryptography
Our goal. Implement all tasks digitally and securely. Implement additional tasks that can't be done with physics!
! !
Task
Protect information Identification Contract Money transfer Public auction Poker Public election Public lottery Anonymous communication
Description
Code book, lock + key Driver's license, fingerprint, DNA Handwritten signature, notary Coin, bill, check, credit card Sealed envelope Cards with concealed backs Anonymous ballot Dice, coins Pseudonym, ransom note
Today. Give flavor of modern (digital) cryptography. Implement one of these tasks. Sketch a few technical details.
! ! !
Non-Encryption
Encryption. Most basic problem in cryptography. Alice wants to send Bob a private message m.
! !
Axiom 2. Players are computationally limited (poly-time). Axiom 3. Factoring is hard computationally. Not polynomial-time. "1-way trapdoor function."
! !
Theorem. Digital cryptography exists. Corollary. Can do all tasks on previous slide digitally.
Alice
Bob
Encryption
Encryption. Most basic problem in cryptography. Alice sends Bob an encrypted message E(m). Easy for Bob to recover original message m. Hard for Eve to learn anything about m.
! ! ! !
Alice
Bob
Alice
Bob
n=6
Alice wants to send n-bit message m to Bob. Alice computes and sends E(m) = m ^ k.
!
0 0
1 0
0 1
1 0
1 1
0 0
m E(m)
bitwise XOR
0 0
0 1
1 0
0 1
1 1
0 0
c D(c)
Disadvantages. Not easy to generate uniformly random keys. Need new key for each message. Signature? Rosenbergs sent to electric chair because Russian spy reused a one-time pad Non-repudiation? deal-breaker for e-commerce since Alice and Bob Key distribution?
! ! ! ! !
Other private key encryption schemes. Data Encryption Standard (DES). Advanced Encryption Standard (AES, Rijndael algorithm). Blowfish.
! ! !
14
15
VeriSign
locks
unlocks
Alice wants to transmit N-bit private message m to Bob. Alice encrypts message using Bob's public key: E(m).
!
Bob receives ciphertext c = E(m) from Alice. Bob decrypts message using his private key: D(c).
!
Alice
Bob
What are necessary conditions for security? Can encrypt message efficiently with public key. Can decrypt message efficiently with private key. Can not decrypt message efficiently with public key alone.
! ! !
16
17
Operating systems. Sun, Microsoft, Apple, Novell. Hardware. Cell phones, ATM machines, wireless Ethernet cards, Mondex smart cards, Palm Pilots, Palladium. Secure Internet communication. Browsers, S/MIME, SSL, S/WAN, PGP, Microsoft Outlook, etc.
Alice browses to https://whiteboard.cs.princeton.edu Alice's browser gets Bob's public key. Alice sends programming assignment. Bob's web server decrypts assignment.
Alice submits programming assignment to Bob via secure website
18
Number theory fact. If p and q are prime, there exist efficiently computable integers e and d such that for d all messages m: (me) ! m (mod N).
a ! b (mod N) means (a % N) == (b % N)
(m3)
187
! m (mod 319)
(e, N) (d, N)
19
Bob receives ciphertext c from Alice. Bob uses his secret key (d, N). Bob computes D(c) = cd (mod N).
! !
E(m) =
1003
! 232
Brute force: multiply a by itself, b times. Analysis of brute force. Suppose a, b, and N are n-bit integers. Problem 1: number of multiplications proportional to 2n. Problem 2: number of digits of intermediate value can be 2n. Exponential time and memory!
! ! ! !
D(E(m))
! D(me) ! (me)d ! m
128TB memory if N = 50
previous fact
20
21
RSA Details
How large should n = pq be? 2,048 bits for long term security. Too small # easy to break. Too large # time consuming to encrypt/decrypt.
! ! !
Q. How do I choose a large "random" prime number? A. Guess-and-check. Prime Number Theorem. (Hadamard, Valle Poussin, 1896). Number of primes between 2 and N $ N / ln N. Primes are plentiful: 10151 with % 512 bits. Will never run out, and no two people will pick same ones.
! ! !
Analysis of modular exponentiation. At most 2n multiply and mod operations. Intermediate numbers at most 2n digits long.
! !
22
23
RSA in Java
Key generation using:
java.math.BigInteger, java.security.SecureRandom.
SecureRandom random = new SecureRandom(); BigInteger BigInteger BigInteger BigInteger ONE p q phi = = = =
random n/2-bit prime new BigInteger("1"); BigInteger.probablePrime(n/2, random); BigInteger.probablePrime(n/2, random); (p.subtract(ONE)).multiply(q.subtract(ONE)); modulus public key private key
Semantic security. If you know Alice will send ATTACK or RETREAT you can encrypt ATTACK and RETREAT using Bob's public key, and check which one Alice sent. Timing attack. Alice gleans information about Bob's private key by measuring time it takes Bob to exponentiate. Modulus sharing. Bob: (d1, e1, N), Ben: (d2, e2, N). Bob can compute d2 given e2 ; Ben can compute d1 given e1.
! !
RSA function.
BigInteger rsa(BigInteger a, BigInteger b, BigInteger N) { return a.modPow(b, N); } built-in modular exponentiation (repeated squaring)
24
25
RSA Tradeoffs
Advantages. Solves key distribution problem. Extends to digital signatures, etc.
! !
Consequences of Cryptography
Crypto liberates (you = Alice or Bob). Freedom of privacy, speech, press, political association. Benefits both ordinary citizens and terrorists.
! !
Disadvantages. Security relies on decryption being "computationally inefficient." Not semantically secure. Decryption more expensive than private key schemes.
! ! !
Practical middle-ground hybrid system. Use AES, a private key encryption system. Use RSA to distribute AES keys.
! !
Crypto restricts (you = Eve, your computer = Alice or Bob). Ex: Trustworthy Computing, DRM. Establishes a secure identity and enable secure transactions. Restricts what user can do: play MP3 files, copy DVDs, run software, print documents, forward email.
! ! !
26
27
Announcements
Your Very Last Exam Wed April 27, 7:30 PM, right here Closed book, but You can bring one cheatsheet both sides of one (8.5 by 11) sheet, handwritten by you No calculators, laptops, Palm Pilots, cellphones, etc.
! ! ! !
Helpful review session Tuesday April 26, 7:30 PM, COS 105 Not a canned presentation Driven by your questions (so be sure to bring some)
! ! !
Covers almost entire course Lectures, precepts, assignments, readings But not: TOY or hardware topics
! !
28