Lecture 2: Perfect Ciphers (in Theory, not Practice)

Slides:



Advertisements
Similar presentations
Cryptography encryption authentication digital signatures
Advertisements

Lecture 2: Basic Information Theory TSBK01 Image Coding and Data Compression Jörgen Ahlberg Div. of Sensor Technology Swedish Defence Research Agency (FOI)
CMSC 414 Computer (and Network) Security Lecture 4 Jonathan Katz.
CS 6262 Spring 02 - Lecture #7 (Tuesday, 1/29/2002) Introduction to Cryptography.
SI485i : NLP Day 2 Probability Review. Introduction to Probability Experiment (trial) Repeatable procedure with well-defined possible outcomes Outcome.
1 Codes, Ciphers, and Cryptography-Ch 2.3 Michael A. Karls Ball State University.
Great Theoretical Ideas in Computer Science.
Introduction to Cryptography and Security Mechanisms: Unit 5 Theoretical v Practical Security Dr Keith Martin McCrea
Introduction to Cryptography and Security Mechanisms Dr Keith Martin McCrea
Ref. Cryptography: theory and practice Douglas R. Stinson
CMSC 414 Computer and Network Security Lecture 4 Jonathan Katz.
CMSC 414 Computer and Network Security Lecture 2 Jonathan Katz.
Foundations of Network and Computer Security J J ohn Black Lecture #3 Aug 28 th 2009 CSCI 6268/TLEN 5550, Fall 2009.
Princeton University COS 433 Cryptography Fall 2005 Boaz Barak COS 433: Cryptography Princeton University Fall 2005 Boaz Barak Lecture 2: Perfect Secrecy.
CSE331: Introduction to Networks and Security Lecture 17 Fall 2002.
Intro To Encryption Exercise 1. Monoalphabetic Ciphers Examples:  Caesar Cipher  At Bash  PigPen (Will be demonstrated)  …
Shannon ’ s theory part II Ref. Cryptography: theory and practice Douglas R. Stinson.
Coding, Information Theory (and Advanced Modulation) Prof. Jay Weitzen Ball 411
Lecture 2: Basic Information Theory Thinh Nguyen Oregon State University.
CryptographyPerfect secrecySlide 1 Today What does it mean for a cipher to be: –Computational secure? Unconditionally secure? Perfect secrecy –Conditional.
Lecture 2.2: Private Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
Princeton University COS 433 Cryptography Fall 2005 Boaz Barak COS 433: Cryptography Princeton University Fall 2005 Boaz Barak Lecture 2: Perfect Secrecy.
Information Theory and Security
CS526Topic 2: Classical Cryptography1 Information Security CS 526 Topic 2 Cryptography: Terminology & Classic Ciphers.
Computer Security CS 426 Lecture 3
Foundations of Cryptography Lecture 2 Lecturer: Moni Naor.
Chapter 2 – Classical Encryption Techniques
Cantor’s Legacy: Infinity And Diagonalization Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 25Apr 13, 2004Carnegie.
CMSC 414 Computer and Network Security Lecture 3 Jonathan Katz.
Chapter 12 Cryptography (slides edited by Erin Chambers)
Cryptography Week-6.
Cryptanalysis. The Speaker  Chuck Easttom  
CS526Topic 3: One-time Pad and Perfect Secrecy 1 Information Security CS 526 Topic 3 Cryptography: One-time Pad, Information Theoretic Security, and Stream.
EE5552 Network Security and Encryption block 4 Dr. T.J. Owens CEng MIET Dr T. Itagaki MIET, MIEEE, MAES.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 9: Cryptography.
Chapter 2 Basic Encryption and Decryption. csci5233 computer security & integrity 2 Encryption / Decryption encrypted transmission AB plaintext ciphertext.
Section 2.2: Affine Ciphers; More Modular Arithmetic Practice HW (not to hand in) From Barr Textbook p. 80 # 2a, 3e, 3f, 4, 5a, 7, 8 9, 10 (Use affinecipherbreaker.
Lecture 19 Page 1 CS 111 Online Symmetric Cryptosystems C = E(K,P) P = D(K,C) E() and D() are not necessarily the same operations.
David Evans CS551: Security and Privacy University of Virginia Computer Science Lecture 2: Breaking Unbreakable Ciphers.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 12: Decrypting Work Circle Fractal.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 2: Orders of Growth
One-Time Pad Or Vernam Cipher Sayed Mahdi Mohammad Hasanzadeh Spring 2004.
Lec. 5 : History of Cryptologic Research II
Topic 21 Cryptography CS 555 Topic 2: Evolution of Classical Cryptography CS555.
1 Chapters 6-8. UNIT 2 VOCABULARY – Chap 6 2 ( 2) THE NOTATION “P” REPRESENTS THE TRUE PROBABILITY OF AN EVENT HAPPENING, ACCORDING TO AN IDEAL DISTRIBUTION.
Cryptography and Network Security (CS435) Part Two (Classic Encryption Techniques)
Cryptography Lecture 7: RSA Primality Testing Piotr Faliszewski.
How Computers Work … and how you can work them. Art 315 Lecture 03 Dr. J Parker Fall 2010.
CSCI-100 Introduction to Computing Privacy & Security Part II.
Cryptography Part 1: Classical Ciphers Jerzy Wojdyło May 4, 2001.
Classical Crypto By: Luong-Sorin VA, IMIT Dith Nimol, IMIT.
Traditional Symmetric-Key Ciphers
Computer Security Cryptography. Cryptography Now and Before  In the past – mainly used for confidentiality  Today –Still used for confidentiality –Data.
1 Information Theory Nathanael Paul Oct. 09, 2002.
COMPSCI 102 Introduction to Discrete Mathematics.
CS555Spring 2012/Topic 31 Cryptography CS 555 Topic 3: One-time Pad and Perfect Secrecy.
David Evans CS551: Security and Privacy University of Virginia Computer Science Lecture 4: Dissin’ DES The design took.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Lecture 4 Page 1 CS 236 Online Basic Encryption Methods Substitutions –Monoalphabetic –Polyalphabetic Permutations.
Bringing Together Paradox, Counting, and Computation To Make Randomness! CS Lecture 21 
Lecture 3 Page 1 CS 236 Online Introduction to Cryptography CS 236 On-Line MS Program Networks and Systems Security Peter Reiher.
CS526Topic 2: Classical Cryptography1 Information Security CS 526 Topic 2 Cryptography: Terminology & Classic Ciphers.
Cryptography Lecture 3 Arpita Patra © Arpita Patra.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 23: Intractable Problems (Smiley Puzzles.
CHAPTER 14 ENCRYPTION AND DECRYPTION Sajina Pradhan
Lecture 3 Page 1 CS 236 Online Basic Encryption Methods Substitutions –Monoalphabetic –Polyalphabetic Permutations.
Basic Encryption Methods
Information-Theoretic Secrecy
Lecture 2: Perfect Ciphers (in Theory, not Practice)
Cryptography Lecture 4.
Presentation transcript:

David Evans http://www.cs.virginia.edu/evans Lecture 2: Perfect Ciphers (in Theory, not Practice) Shannon was the person who saw that the binary digit was the fundamental element in all of communication. That was really his discovery, and from it the whole communications revolution has sprung. R G Gallager I just wondered how things were put together. Claude Shannon Claude Shannon, 1916-2001 CS588: Cryptology University of Virginia Computer Science David Evans http://www.cs.virginia.edu/evans

University of Virginia CS 588 Menu Survey Results Perfect Ciphers Entropy and Unicity 25 January 2005 University of Virginia CS 588

Survey Responses Majors: Cognitive Science, Computer Science (13), Computer Engineering (2), Economics, Math Year: Third year: 6, Fourth Year: 10, Grad: 1, 2005: 1 Midterm: March 3: 12, March 15: 3, March 17: 2, March 22: 1 Broken in?: No: 13, Yes: 5 Full answers are on the course web site 25 January 2005 University of Virginia CS 588

What was the coolest thing you learned last semester? “i've been sitting here for like five minutes trying to think of something. perhaps that aristotle (or perhaps plato) hates bands that sell out.” “hmm.... I learned there was a huge molasses explosion at the Boston harbor in the early 20th century.... not really all that cool i guess because a lot of people died but still pretty interesting.” 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Break In Story In high-school the administrators installed a fairly restrictive rights-control program called "FoolProof". It was so restrictive, however, that my AP Comp. Sci class was unable to compile and run programs on the main HD forcing us to use a floppy disk for our source and intermediate files, which was painfully slow as projects increased in size. Having unsuccessfully lobbied to have restrictions lifted so we could compile and run programs on a temporary directory. I tried to convince them that there were more eloquent and flexible security programs out there. So, I did a little research on the version of FoolProof being used. It turns out that this version of FoolProof had two major security flaws: 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Break In Story 1) A "backdoor" password used by tech support that is hardcoded into the executable and 2) The password information is stored in plaintext within main memory some number of bytes into one of its main data structures which was marked by an ascii string which was some sort of constant containing the version information. So, I acquired a utility which would allow me to browse and search the contents of physical memory determined what this ascii string would be for the given version of FoolProof and searched memory. Sure enough I came up with a match and about 8 bytes later a plaintext ascii string: "WhatAFool" 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Polling Protocol 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Last Time Big keyspace is not necessarily a strong cipher Claim: One-Time Pad is perfect cipher In theory: depends on perfectly random key, secure key distribution, no reuse In practice: usually ineffective (VENONA, Lorenz Machine) Today: what does is mean to be a perfect cipher? 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Ways to Convince “I tried really hard to break my cipher, but couldn’t. I’m a genius, so I’m sure no one else can break it either.” “Lots of really smart people tried to break it, and couldn’t.” Mathematical arguments – key size (dangerous!), statistical properties of ciphertext, depends on some provably (or believed) hard problem Invulnerability to known cryptanalysis techniques (but what about undiscovered techniques?) Show that ciphertext could match multiple reasonable plaintexts without knowing key Simple monoalphabetic secure for about 10 letters of English: XBCF CF FWPHGW This is secure Spat at troner 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Claude Shannon Master’s Thesis [1938] – boolean algebra in electronic circuits “Mathematical Theory of Communication” [1948] – established information theory “Communication Theory of Secrecy Systems” [1945/1949] (linked from notes) Invented rocket-powered Frisbee, could juggle four balls while riding unicycle 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Entropy Amount of information in a message: H(M) =  Prob [Mi] log ([1 / Prob [Mi]) over all possible messages Mi n i=1 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Entropy If there are n equally probable messages, H(M) =  1/n log n = n * (1/n log n)) = log n Base of log is alphabet size, so for binary: H(M) = log2 n where n is the number of possible meanings n i=1 25 January 2005 University of Virginia CS 588

Entropy Example M = months of the year H(M) = log2 12  3.6 (need 4 bits to encode a year) 25 January 2005 University of Virginia CS 588

Rate Absolute rate: how much information can be encoded R = log2 Z (Z=size of alphabet) REnglish = Actual rate of a language: r = H(M) / N M is a source of N-letter messages r of months spelled out using 8-bit ASCII: log2 26  4.7 bits / letter = log2 12 / (8 letters * 8 bits/letter)  0.06 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Rate of English r(English) is about .28 letters/letter (1.3 bits/letter) [Book uses 1.5] How can one estimate this? How many meaningful 20-letter messages in English? r = H(M) / N .28 = H(M)/20 H(M) = 5.6 = log26 n n = 265.6 ~ 83 million (of 2*1028 possible) Probability that 20-letters are sensible English is About 1 in 2 * 1020 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Redundancy Redundancy (D) is defined: D = R – r Redundancy in English: D = 1 - .28 = .72 letters/letter D = 4.7 – 1.3 = 3.4 bits/letter Each letter is 1.3 bits of content, and 3.4 bits of redundancy. (~72%) 7-bit ASCII (as in PS1, problem 5) D = 7 – 1.3 = 5.7 81% redundancy, 19% information 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Unicity Distance Entropy of cryptosystem: (K = number of possible keys) H(K) = logAlphabet Size K if all keys equally likely H(64-bit key) = log2 264 = 64 Unicity distance is defined as: U = H(K)/D Expected minimum amount of ciphertext needed for brute-force attack to succeed. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Unicity Examples Monoalphabetic Substitution H(K) = log2 26!  87 D = 3.4 (redundancy in English) U = H(K)/D  25.5 Intuition: if you have 25 letters, probably only matches one possible plaintext. D = 0 (random bit stream) U = H(K)/D = infinite 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Unicity Distance Probabilistic measure of how much ciphertext is needed to determine a unique plaintext Does not indicate how much ciphertext is needed for cryptanalysis If you have less than unicity distance ciphertext, can’t tell if guess is right. As redundancy approaches 0, hard to cryptanalyze even simple cipher. 25 January 2005 University of Virginia CS 588

Shannon’s Theory [1945] Message space: { M1, M2,..., Mn } Assume finite number of messages Each message has probability p(M1) + p(M2) + ... + p(Mn) = 1 Key space: { K1, K2,..., Kl } (Based on Eli Biham’s notes) 25 January 2005 University of Virginia CS 588

Perfect Cipher: Definition Ka A perfect cipher: there is some key that maps any message to any ciphertext with equal probability. For any i, j: p (Mi|Cj) = p (Mi) M1 C1 Kb C2 M2 ... ... Mn Cn 25 January 2005 University of Virginia CS 588

Conditional Probability Prob [B | A] = The probability of B, given that A occurs Prob [ coin flip is tails ] = ½ Prob [ coin flip is tails | last coin flip was heads ] = ½ Prob [ today is Monday | yesterday was Sunday] = 1 Prob [ today is a weekend day | yesterday was a workday] = 1/5 25 January 2005 University of Virginia CS 588

Calculating Conditional Probability P [B | A ] = Prob [ A  B ] Prob [ A ] Prob [ coin flip is tails | last coin flip was heads ] = Prob [ coin flip is tails and last coin flip was heads ] Prob [ last coin flip was heads ] = (½ * ½) / ½ = ½ 25 January 2005 University of Virginia CS 588

P (today is a weekend day | yesterday was a workday) = P (today is a weekend day and yesterday was a workday) / P (yesterday was a workday) = P (today is a weekend day) * P(yesterday was a workday) / P (yesterday was a workday) = 2/7 * 5/7 / 5/7 = 2/7 Wrong! P(A  B) = P(A) * P(B) only if A and B are independent events 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Perfect Cipher Definition:  i, j: P (Mi|Cj) = P (Mi) A cipher is perfect iff:  M, C P (C | M) = P (C) Or, equivalently:  M, C P (M | C) = P (M) 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Perfect Cipher  M, C P (C | M) = P (C)  M, C P (C) =  P(K) such that EK(M) = C Or:  C  P(K) is independent of M such that EK(M) = C K K Without knowing anything about the key, any ciphertext is equally likely to match any plaintext. 25 January 2005 University of Virginia CS 588

Example: Monoalphabetic Random monoalphabetic substitution for one letter message:  C,M: P (C) = P (C | M) = 1/26. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Example: One-Time Pad For each bit: P(Ci = 0) = P(Ci = 0 | Mi = 0) = P (Ci = 0 | Mi = 1) = ½ since Ci = Ki  Mi P (Ki  Mi = 0) = P (Ki = 1) * P (Mi = 1) + P (Ki = 0) * P (Mi = 0) Truly random K means P (Ki = 1) = P (Ki = 0) = ½ = ½ * P (Mi = 1) + ½ * P (Mi = 0) = ½ * (P (Mi = 1) + P (Mi = 0)) = ½ All key bits are independent, so: P(C) = P(C | M) QED. 25 January 2005 University of Virginia CS 588

Perfect Cipher Keyspace Theorem Theorem: If a cipher is perfect, there must be at least as many keys (l) are there are possible messages (n). 25 January 2005 University of Virginia CS 588

Proof by Contradiction Suppose there is a perfect cipher with l < n. (More messages than keys.) Let C0 be some ciphertext with P(C0) > 0. There exist m messages M such that M = DK(C0 ) n - m messages M0 such that M0  DK(C0 ) We know 1  m  l < n so n - m > 0 and there is at least one message M0. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Proof, cont. Consider the message M0 where M0  DK(C0 ) for any K. So, P (C0 | M0) = 0. In a perfect cipher, P (C0 | M0) = P (C0) > 0. Contradiction! It isn’t a perfect cipher. Hence, all perfect ciphers must have l  n. 25 January 2005 University of Virginia CS 588

Example: Monoalphabetic Random monoalphabetic substitution is not a perfect cipher for messages of up to 20 letters: l = 26! n = 2620 l < n its not a perfect cipher. In previous proof, could choose C0 = “AB” and M0 = “ee” and P (C0 | M0) = 0. 25 January 2005 University of Virginia CS 588

Example: Monoalphabetic Is random monoalphabetic substitution a perfect cipher for messages of up to 2 letters? l = 26! n = 262 l  n. No! Showing l  n does not prove its perfect. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Summary Cipher is perfect:  i, j: p (Mi|Cj) = p (Mi) Given any ciphertext, the probability that it matches any particular message is the same. Equivalently,  i, j: p (Ci|Mj) = p (Ci) Given any plaintext, the probability that it matches any particular ciphertext is the same. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Imperfect Cipher To prove a cipher is imperfect either: Find a ciphertext that is more likely to be one message than another Show that there are more messages than keys Implies there is some ciphertext more likely to be one message than another even if you can’t find it. 25 January 2005 University of Virginia CS 588

University of Virginia CS 588 Charge Problem Set 1: due Feb 3 All other questions covered (as much as we will cover them in class) already Next time: Classical ciphers (Nate Paul) 25 January 2005 University of Virginia CS 588