Distributed Systems Ngywioggazhon Pystemp Cryptographic Systems
Total Page:16
File Type:pdf, Size:1020Kb
Distributed Systems Ngywioggazhon Pystemp Auesfnsicutiwf & Moiiunocaiwn Piqtoaoyp Introduction to Cryptography Paul Krzyzanowski [email protected] Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License. Page 1 Page 2 cryptography Cryptographic Systems κρυπός γραφία Authentication & Communication Protocols hidden writing A secret manner of writing, … Generally, the art of writing or solving ciphers. — Oxford English Dictionary Page 3 Page 4 Cryptography Security cryptology Cryptography may be a component of a secure system κρυπός λογια Adding cryptography may not make a system secure hidden speaking 1967 D. Kahn, Codebreakers p. xvi, Cryptology is the science that embraces cryptography and cryptanalysis, but the term ‘cryptology’ sometimes loosely designates the entire dual field of both rendering signals secure and extracting information from them. — Oxford English Dictionary Page 5 Page 6 1 Terms Terms: types of ciphers Plaintext (cleartext), message M • restricted cipher encryption, E(M) • symmetric algorithm produces ciphertext, C=E(M) • public key algorithm decryption: M=D(C) Cryptographic algorithm, cipher Page 7 Page 8 Restricted cipher The key Secret algorithm • Leaking • Reverse engineering – HD DVD (Dec 2006) and Blu-Ray (Jan 2007) – RC4 – All digital cellular encryption algorithms – DVD and DIVX video compression – Firewire – Enigma cipher machine – Every NATO and Warsaw Pact algorithm during Cold War Page 9 BTW, the above is a bump key. See http://en.wikipedia.org/wiki/Lock_bumping.Page 10 The key The key Source: en.wikipedia.org/wiki/Pin_tumbler_lock Source: en.wikipedia.org/wiki/Pin_tumbler_lock Page 11 Page 12 2 The key Symmetric algorithm Secret key • We understand how it works: – Strengths – Weaknesses C = EK(M ) • Based on this understanding, we can assess how much to trust the key & lock. M = DK(C ) Source: en.wikipedia.org/wiki/Pin_tumbler_lock Page 13 Page 14 Public key algorithm McCarthy’s puzzle (1958) Public and private keys The setting: • Two countries are at war C = E (M ) 1 public • One country sends spies to the other country M = Dprivate(C1 ) • To return safely, spies must give the border guards a password also: • Spies can be trusted C = E (M ) 2 private • Guards chat – information given to them may M = D (C ) public 2 leak Page 15 Page 16 McCarthy’s puzzle Solution to McCarthy’s puzzle Challenge Michael Rabin, 1958 How can a guard authenticate a person without Use one-way function, B = f (A) knowing the password? – Guards get B … • Enemy cannot compute A Enemies cannot use the guard’s knowledge to – Spies give A, guards compute f(A) introduce their own spies • If the result is B, the password is correct. Example function: Middle squares • Take a 100-digit number (A), and square it • Let B = middle 100 digits of 200-digit result Page 17 Page 18 3 One-way functions McCarthy’s puzzle example • Easy to compute in one direction Example with an 18 digit number • Difficult to compute in the other A = 289407349786637777 A2 = 83756614110525308948445338203501729110525308948445338 Examples: Middle square, B = 110525308948445338 Factoring: pq = N EASY find p,q given N DIFFICULT Given A, it is easy to compute B Discrete Log: Given B, it is extremely hard to compute A ab mod c = N EASY find b given a, c, N DIFFICULT Page 19 Page 20 More terms More terms • one-way function • Stream cipher – Rabin, 1958: McCarthy’s problem – Encrypt a message a character at a time – middle squares, exponentiation, … • [one-way] hash function • Block cipher – Encrypt a message a chunk at a time – message digest, fingerprint, cryptographic checksum, integrity check • encrypted hash – message authentication code – only possessor of key can validate message Page 21 Page 22 Yet another term Cryptography: what is it good for? • Digital Signature • Authentication – Authenticate, not encrypt message – determine origin of message – Use pair of keys (private, public) • Integrity – Owner encrypts message with private key – verify that message has not been modified – Sender validates by decrypting with public key – Generally use hash(message). • Nonrepudiation – sender should not be able to falsely deny that a message was sent • Confidentiality – others cannot read contents of the message Page 23 Page 24 4 Cryptographic toolbox • Symmetric encryption • Public key encryption • One-way hash functions Classic Cryptosystems • Random number generators Page 25 Page 26 Cæsar cipher Earliest documented military use of cryptography – Julius Caesar c. 60 BC – shift cipher: simple variant of a substitution cipher – each letter replaced by one n positions away modulo alphabet size n = shift value = key Substitution Ciphers Similar scheme used in India – early Indians also used substitutions based on phonetics similar to pig latin Last seen as ROT13 on Usenet to keep the reader from seeing offensive messages unwillingly Page 27 Page 28 Cæsar cipher Cæsar cipher A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T shift alphabet by n (6) Page 29 Page 30 5 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T G Page 31 Page 32 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GS GSW Page 33 Page 34 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GSWU GSWUN Page 35 Page 36 6 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GSWUNB GSWUNBU Page 37 Page 38 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GSWUNBUM GSWUNBUMZ Page 39 Page 40 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GSWUNBUMZF GSWUNBUMZFY Page 41 Page 42 7 Cæsar cipher Cæsar cipher MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T GSWUNBUMZFYU GSWUNBMUFZYUM Page 43 Page 44 Cæsar cipher Ancient Hebrew variant (ATBASH) MY CAT HAS FLEAS MY CAT HAS FLEAS A B C D E F G H I J K L M N O P Q R S T U V WX Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Y Z U V WX Y Z A B C D E F G H I J K L M N O P Q R S T Z Y XW V U T S R Q P O N M L K J I H G F E D C B A GSWUNBMUFZYUM NBXZGSZHUOVZH • Convey one piece of information for decryption: • c.