
CIT 480: Securing Computer Systems Symmetric Cryptography Topics 1. Modular Arithmetic 2. Transposition Ciphers 3. Substitution Ciphers 4. Cryptanalysis: frequency analysis 5. Block Ciphers 6. AES and DES 7. Stream Ciphers 8. Random Number Generation 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 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 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 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. 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. 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 Stream Ciphers Combine plaintext with cipher bitstream – Cipher generates stream of pseudo-random bits – Loosely inspired by one time pad. RC4 is most widely used stream cipher – Variable length key: 40 to 128 bits – Aircrack breaks 104-bit RC4 used in WEP in 1min – No known practical attacks against 128-bit, but – Much speculation that NSA can crack 128-bit RC4. Block cipher to stream cipher – Using block cipher in Counter Mode. – XOR counter mode data with plaintext. Importance of RNGs We need all those brilliant Belgian cryptographers to go "alright we know that these encryption algorithms we are using today work, typically it is the random number generators that are attacked as opposed to the encryption algorithms themselves. How can we make them [secure], how can we test them?“ -- Ed Snowden at SXSW Key Generation Goal: Ensure best attack against cipher is brute force. Solution: Given set of K potential keys, choose one randomly. – Selecting a random number between 0 and K–1. – Ex: For a 128-bit key, select number between 0 and 2128-1 Difficulty: generating random numbers – Hardware random number generators gather entropy from physical world but are expensive and limited in how many bits/second they product. – Software generated numbers are pseudo-random (PRNGs), that is, generated by an algorithm. – If starting with same seed, then PRNGs will produce the same sequence of numbers each time. Linear Congruential Generator nk = (ank–1 + b) mod m m Modulus (a large prime integer), maximum period a Multiplier (integer from 2..m-1) b Increment n0 Sequence initializer (seed) LCG Period The period of an LCG is at most m, the modulus. – Modulus only allows numbers 0 .. m-1 to be produced. – An LCG with a period of m is aid to have a full period. An LCG will have a full period for all seeds iff – b and m are relatively prime, – a-1 is divisible by all prime factors of m, – a-1 is a multiple of 4 if m is a multiple of 4 For production LCGs, m=232-1 common – a = 16807 is well studied full period multiplier LCGs are predictable, and thus not secure for crypto – Knowing just one LCG output allows prediction of next. Seeds for PR generation Input used to generate initial pseudo-random (PR) numbers. Seeds should be computationally infeasible to predict – Generate seed from random, not PR, data. – Size: 32 bits too small; only 232 combinations. Sequence is periodic, but starts from different point for each different seed. – Identical sequences produced for identical seeds. – Period needs to be large for security.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages48 Page
-
File Size-