CIT 380: Securing Computer Systems Symmetric Cryptography Topics 1. Modular Arithmetic 2. What is Cryptography? 3. Transposition Ciphers 4. Substitution Ciphers 1. Cæsar cipher 2. Vigènere cipher 5. Cryptanalysis: frequency analysis 6. Block Ciphers 7. AES and DES 8. Stream Ciphers Modular Arithmetic Congruence – a = b (mod N) iff a = b + kN – ex: 37=27 mod 10 b is the residue of a, modulo N – Integers 0..N-1 are the set of residues mod N Modulo 12 number system What is Cryptography? Cryptography: The art and science of keeping messages secure. Cryptanalysis: the art and science of decrypting messages. Cryptology: cryptography + cryptanalysis Terminology Plaintext: message P to be encrypted. Also called Plaintext cleartext. Encryption: altering a Encryption message to keep its Procedure contents secret. Ciphertext: encrypted message C. Ciphertext Cæsar cipher Plaintext is HELLO WORLD Change each letter to the third letter following it (X goes to A, Y to B, Z to C) – Key is 3, usually written as letter ‘D’ Ciphertext is KHOOR ZRUOG ROT 13 Cæsar cipher with key of 13 13 chosen since encryption and decryption are same operation Used to hide spoilers, punchlines, and offensive material online. Kerckhoff’s Principle Security of cryptosystem should only depend on 1. Quality of shared encryption algorithm E 2. Secrecy of key K Security through obscurity tends to fail ex: DVD Content Scrambling System Cryptanalysis Goals 1. Decrypt a given message. 2. Recover encryption key. Threat models vary based on 1. Type of information available to adversary 2. Interaction with cryptosystem. Cryptanalysis Threat Models ciphertext only: adversary has only ciphertext; goal is to find plaintext, possibly key. known plaintext: adversary has ciphertext, corresponding plaintext; goal is to find key. chosen plaintext: adversary may supply plaintexts and obtain corresponding ciphertext; goal is to find key. Brute Force Attack Exhaustive search of keyspace by decrypting ciphertext C with all possible keys K. – Must determine if DK(C) is a likely plaintext – Requires some knowledge of format (language, doc type) For N possible keys, – Worst case is N decryptions. – Mean case is N/2 decryptions. Example: DES has 56-bit keys – Average time to find key is 255 decryptions. Is 128 bits enough? 128-bit keyspace permits 2128 keys – 340,282,366,920,938,463,463,374,607,431,768,211,456 or – 3.4 x 1038 keys Cracking 1 trillion (1012) keys per second requires – 3.4 x 1026 seconds or – 1.08 x 1019 years Cracking 1 trillion keys per second on 1 billion CPUs – requires 1.08 x 1010 years = 10.8 billion years Classical Cryptography Sender and receiver share common key – Keys may be the same, or be trivial to derive from one another. – Sometimes called symmetric cryptography. P encrypt C decrypt P K K Brute Force vs. Cæsar Cipher Decryption key Candidate Brute Force attack (26-K) plaintext – Only 26 possible keys. 0 exxegoexsrgi 1 dwwdfndwrqfh – PC can try all in <1s. 2 cvvcemcvqpeg 3 buubdlbupodf 4 attackatonce 5 zsszbjzsnmbd 6 yrryaiyrmlac ... 23 haahjrhavujl 24 gzzgiqgzutik 25 fyyfhpfytshj General Simple Substitution Cipher Keys: All permutations of alphabet (26! keys) Encryption: Replace each plaintext letter x with K(x) Decryption: Replace each ciphertext letter y with K-1(y) Example: 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 K= F U B A R D H G J I L K N M P O S Q Z W X Y V T C E CRYPTO BQCOWP General Simple Substitution Security Exhaustive search impossible – Key space size is 26! =~ 4 x 1026 – Historically thought to be unbreakable. However, languages have different frequencies of letters digraphs (groups of 2 letters) trigraphs (groups of 3 letters) etc. Simple substitution ciphers preserve letter frequencies. English Letter Frequencies Additional Frequency Features Digraph frequencies – Common digraphs: EN, RE, ER, NT Trigraph frequencies – Common trigraphs: THE, AND, ING – Digraph and trigraph tables can be found at http://www.sttmedia.com/syllablefrequency- english The letter Q is followed only by U. Countering Frequency Analysis Primary weakness of simple substitution: – Each ciphertext letter corresponds to only one letter of plaintext. Solution: polyalphabetic substitution – Use multiple cipher alphabets. – Switch between cipher alphabets from character to character in the plaintext. Letter Frequency Distributions Vigènere Cipher Use phrase instead of letter as key. Example – Message THE BOY HAS THE BALL – Key VIG – Encipher using Cæsar cipher for each letter: key VIGVIGVIGVIGVIGV plain THEBOYHASTHEBALL cipher OPKWWECIYOPKWIRG Reproduction of CSA Cipher Disk Rotor Machines (1920s-1970s) Observation: If Vigènere key is very long, frequency analysis won’t work. Implement: multiple rounds of Vigènere substitution. – Machine contains multiple cylinders. – Each cylinder has 26 states (ciphers.) – Cylinders rotate to change states on different schedules. – m-cylinder machine has 26m substitution ciphers. One-Time Pad • A Vigenère cipher with a random key at least as long as the message. • Provably unbreakable. • Example ciphertext: DXQR. • Equally likely to correspond to – plaintext DOIT (key AJIY) – plaintext DONT (key AJDY) – and any other 4 letters. Binary One Time Pad Encrypt a message M with pad P to produce ciphertext C = M P where is the exclusive⊕ OR operator. Decrypt⊕ a ciphertext C with the same pad P M = C P ⊕ One Time Pad Problems 1. The one-time pad must be random. Software pseudo-random number generators are not random. Pad needs hardware randomness. 2. Transmission of long pads is difficult. The pad is just as long as all the messages you’ll ever send with it, so you’ve just moved the problem of transmitting secret messages to transmitting a secret pad. 3. Pad must always be kept secret. If pad is ever discovered, then attacker can decrypt old messages. Pads must be securely destroyed at end of use. Block Ciphers Encrypt groups (blocks) of chars at once. Improvement over single char substitution – Cryptanalysis must use digraph frequencies for two-char blocks. – Longer blocks are more difficult to analyze. – Modern ciphers are block ciphers. Example: Playfair Cipher, 1854 SP-Networks Combine Substitution+Permutation (transposition) – Confusion: adding unknown key values will confuse attacker about value of plaintext symbol. – Diffusion: Spread plaintext data throughout ciphertext. Designing for Security – Block Size – Number of rounds • Each input bit is XOR of several output bits from previous round. – Substitution algorithm Substitution Boxes Substitution can be done using a matrix, which acts as a lookup table for substituting one set of bits with another. Such tables are called substitution boxes, or S- boxes. Overview of the DES Block cipher (64 bit blocks) – 64-bit key is actually a – 56-bit key + 8 parity bits Product cipher – substitution + transposition 16 rounds (iterations) of encryption – round key generated from user key Feistel Function (F) Differential Cryptanalysis A chosen ciphertext attack – Biham and Shamir rediscovered in late 1980s – Examines pairs of plaintext with particular differences. – Requires 247 plaintext, ciphertext pairs. – Only 214 pairs required with 8 round DES. Revealed several properties – S-box designed to resist differential cryptanalysis. – IBM revealed knowledge of technique at design time. Linear cryptanalysis improves result – Linear approximation of DES. – Requires 243 plaintext, ciphertext pairs. – DES not designed to resist this technique. Electronic Code Book Mode Encrypt each block independently. E(block) = Cblock each time block appears Therefore attacker can build dictionary of blocks. ECB encryption of bitmap hides colors but image is still discernible. Cipher Block Chaining Mode XOR each block with previous ciphertext block. Random initialization vector (IV) used for 1st. CBC encryption of bitmap looks random. Cipher Block Chaining Mode Formula for CBC encryption (i=1 is 1st block) Formula for CBC decryption Triple DES Encrypt-Decrypt-Encrypt Mode (3 keys: k, k´, k´´) –1 – c = DESk(DESk´ (DESk’’(m))) – Middle decrypt allows backward compatibility if all keys are equal: k = k´= k´´ – Double-encryption vulnerable to meet-in-middle attack, reducing difficulty from 2112 to 257. DES is Insecure Brute force attacks can be completed in <1 day. – Distributed computing attacks. – RIVYERA FPGA-based parallel computer breaks DES in <1 day for a hardware cost of <$10,000. Linear cryptanalysis faster than brute force – Need 241 known plaintexts Advanced Encryption Standard (AES) Winner of open NIST competition (1997-2000) – Rijndael, designed by Joan Daemen and Vincent Rijmen. – Published as FIPS 197 in November 2001. 128-bit block cipher – 128-, 192-, or 256-bit keys. – 10, 12, or 14 rounds, depending on key size. Replacement for DES – DES vulnerable to brute force attacks due to 56-bit keys. – Triple DES is very slow. AES Round Structure Round keys derived from user key using AES key schedule. Each round transforms 128-bit state, Xi in 4 steps: 1. SubBytes: S-box substitution. 2. ShiftRows: permutation. 3. MixColumns: matrix multiplication. 4. AddRoundKey: XOR with round key for this round. AES Round Steps AES Cryptanalysis Biclique attack (2011) – Faster than brute force by a factor of 4 – So can break AES-128 with 2126.1 operations. Related key attacks (2009) – Requires 299.5 operations to break AES-256 – Requires 2176 operations to break AES-192 – Due to weak key scheduling for AES-256 – AES-128 is more secure than AES-256! Modern Block Ciphers Blowfish – 64-bit block cipher designed in 1993 – Variable key length: 32 to 448 bit – Weak key attacks exist Twofish (AES finalist) – 128-bit block cipher with up to 256 bit keys – Designed by Blowfish team, no known breaks Serpent (AES finalist) – 32-round 128-bit block cipher with up to 256 bit keys – Known attacks against reduced round versions Stream Ciphers Combine plaintext with cipher bitstream – Cipher generates stream of pseudo-random bits – Loosely inspired by one time pad.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages44 Page
-
File Size-