Presentation is loading. Please wait.

Presentation is loading. Please wait.

IS 302: Information Security and Trust Week 3: From DES to AES 2012.

Similar presentations


Presentation on theme: "IS 302: Information Security and Trust Week 3: From DES to AES 2012."— Presentation transcript:

1 IS 302: Information Security and Trust Week 3: From DES to AES 2012

2 © Yingjiu Li 20072 Review –Kerckhoff principle –Attacks to cryptosystem –Caesar, Vigenere, Zimmerman, Vernam cipher –Confusion and diffusion

3 © Yingjiu Li 20073 Modern Symmetric Ciphers DES AES

4 © Yingjiu Li 20074 Block Ciphers vs Stream Ciphers Block ciphers –DES and AES… –For each block, perform multiple rounds of confusion and diffusion operations Stream ciphers –Vernam,… –Bit by bit operations

5 © Yingjiu Li 20075 DES 1972-1974 NBS call for proposal IBM’s DES  Horst Feistel’s Lucifer cipher 1976 US Federal standard 1990  DES design is optimal –Almost any change to DES weakens it May 26, 2002, DES was superseded by AES –brute force attack can easily break 56-bit DES key 1998 3DES  valid till 2030 –extensively used in banking industry

6 © Yingjiu Li 20076 Jeff Moser: http://www.moserware.com/2009/09/stick-figure- guide-to-advanced.html

7 © Yingjiu Li 20077

8 8

9 9

10 10

11 © Yingjiu Li 200711 One Round in Encoding 56-bits key  16 48-bits sub-key 64-bits blocks –Right half  left half –Left half mixed with encrypted right half  right half A round of encoding a block in DES (repeat 16 times) Left half blockRight half block New left half block New right half block substitution permutation Sub key f

12 © Yingjiu Li 200712 Overall Diagram f function http://en.wikipedia.org/wiki/Data_Encryption_Standard

13 © Yingjiu Li 200713 DES procedure visualization Cryptool: –Indiv. procedures  visualization of algorithms  DES –You need Java runtime environment at least version 1.6 http://java.sun.comhttp://java.sun.com –You also need to download and install the current version of ANIMAL animation software http://www.algoanim.info/Animal2/http://www.algoanim.info/Animal2/

14 © Yingjiu Li 200714 Multiple DESes Two-Key DES –Total key size is 56x2=112 bits; but the effective key size is only 57 bits only! Triple DES (3DES) –This is a secure solution with effective key size of 112 bits E Data K1 E K2 C E Data K1 D K2 C E K1

15 © Yingjiu Li 200715 DES encryption demo Cryptool  encrypt/decrypt  symmetric (modern) –DES (CBC) –3-DES (CBC)

16 © Yingjiu Li 200716 Security Concerns 56 bit key is too short –Can be broken on average in 2^55 ≈3.6*10^16 trials –Moore’s law: speed of processor doubles per 1.5 yr –1997: 3500 machines broke DES in about 4 months –1998: 1M dollar machine broke DES in about 4 days

17 © Yingjiu Li 200717

18 © Yingjiu Li 200718

19 © Yingjiu Li 200719

20 © Yingjiu Li 200720

21 © Yingjiu Li 200721

22 © Yingjiu Li 200722

23 © Yingjiu Li 200723

24 © Yingjiu Li 200724

25 © Yingjiu Li 200725 AES 1997 NIST call Final five –Rijndael(Joan Daemen and Vincent Rijmen),Joan DaemenVincent Rijmen –Serpent(Ross Anderson), –Twofish(Bruce Schneier), –RC6(Don Rivest, Lisa Yin), –MARS (Don Coppersmith, IBM) 2000 Rijndael won 2002 Rijndael became AES

26 © Yingjiu Li 200726 AES vs DES DESAES Date19761999 Block size64128 Key length56128, 192, 256 Number of rounds169,11,13 Encryption primitivesSubstitution, permutationSubstitution, shift, bit mixing Cryptographic primitivesConfusion, diffusion DesignOpen Design rationaleClosedOpen Selection processSecretSecret, but accept open public comment SourceIBM, enhanced by NSAIndependent cryptographers

27 © Yingjiu Li 2007http://en.wikipedia.org/wiki/Advance d_Encryption_Standard 27 High-Level Cipher Algorithm KeyExpansion (one 128/192/256-biy key to 10/12/14 128-bit subkeys) Initial Round –AddRoundKey (cipher key) Steps in each of 9/11/13 rounds (state: 4*4=16-array of bytes = 128 bit-block) –SubBytes — a non-linear substitution step where each byte is replaced with another according to a lookup table. –ShiftRows — a transposition step where each row of the state is shifted cyclically a certain number of steps. –MixColumns — a mixing operation which operates on the columns of the state, combining the four bytes in each column –AddRoundKey — each byte of the state is combined with the round key; each round key is derived from the cipher key using a key schedule. Final Round (no MixColumns) –SubBytes –ShiftRows –AddRoundKey How many rounds in total? How many round keys?

28 © Yingjiu Li 200728

29 © Yingjiu Li 200729

30 © Yingjiu Li 200730

31 © Yingjiu Li 200731

32 © Yingjiu Li 200732 Follow Me Cryptool: AES procedures –Invid. Procedures  visualization of algorithms  AES –Web version: http://www.ccna-security.net/wp- content/uploads/2008/10/rijndael_ingles2004.s wfhttp://www.ccna-security.net/wp- content/uploads/2008/10/rijndael_ingles2004.s wf AES-128-CBC encryption –Encrypt/decrypt  symmetric (modern)  AES

33 © Yingjiu Li 200733 Four Modes of Block Ciphers How are multiple blocks processed? –ECB: Electronic Code Book –CBC: Cipher Block Chaining –CFB: Cipher Feedback –OFB: Output Feedback

34 © Yingjiu Li 200734 Electronic codebook (ECB) mode P1P2 P3 Enc C1C2 C3 K C1C2 C3 Dec P1P2 P3 K

35 © Yingjiu Li 2007 Cipher-block Chaining (CBC) Mode P1 IVP2 C1 P3 C2 Enc C1C2 C3 K C1C2 C3 Dec P1 IVP2 C1 P3 C2 K P1P2 P3 IVC1C2

36 © Yingjiu Li 200736 Original image ECB vs CBC Which mode would you choose? Which one is semantically secure? Encrypted with ECBEncrypted with CBC

37 © Yingjiu Li 200737 Hands-On Exercise AES Encryption and Decryption –OpenSSL –JCE Download Lab.doc and follow instructions

38 © Yingjiu Li 200738 Introduction:Javax.crypto.Cipher This class provides the functionality of a cryptographic cipher for encryption and decryption Methods: –getInstance(String algorithm ) Generates a Cipher object that implements the specified algorithm. –init(int opmode, Key key ) The cipher is initialized with a key for either encryption or decryption. –doFinal(byte[] input ) Encrypts or decrypts data depending on how this cipher was initialized. Further details:http://java.sun.com/j2se/1.4.2/docs/api/javax/crypto/Cipher.html http://java.sun.com/j2se/1.5.0/docs/api/javax/crypto/Cipher.htmlhttp://java.sun.com/j2se/1.4.2/docs/api/javax/crypto/Cipher.html http://java.sun.com/j2se/1.5.0/docs/api/javax/crypto/Cipher.html

39 © Yingjiu Li 200739 Example: AES Encryption The following sample encrypts a file “clear.txt”and save the output as a file named “encryptedfile”. // Create a cipher object with algorithm “AES”. Cipher cipher = Cipher.getInstance("AES"); //Set the Cipher object to ENCRYPT MODE //Initialise it with the encryption key “mykey”. //Previous example demostrated how to retrieve this key from a keystore. cipher.init(Cipher.ENCRYPT_MODE, mykey); //Create an input stream to read the file. File clr=new File(“clear.txt”); FileInputStream fi = new FileInputStream(clr); //Get the size of the file. long length = clr.length();…..cont’d

40 © Yingjiu Li 200740 Example: AES Encryption cont’d //Create a byte array with the size of the file. byte[] plaintext = new byte[(int) length]; //Read data into the byte array fi.read(plaintext); //Close file fi.close(); // Now encrypt the text and store it in the byte array ciphertext byte[] ciphertext = cipher.doFinal(plaintext); //Write encrypted text into the output file File enc=new File(“encryptedfile”) FileOutputStream fo = new FileOutputStream(enc); fo.write(ciphertext); fo.close();

41 © Yingjiu Li 200741 Example: AES Decryption The following sample decrypts a file “encryptedfile”and save the output as a file named “decryptedfile”. // Create a cipher object with algorithm “AES” Cipher cipher = Cipher.getInstance("AES"); //Set the Cipher object to DECRYPT MODE //Initialise it with the decryption key “mykey”. //Previous example demostrated how to retrieve this key from a keystore. cipher.init(Cipher.DECRYPT_MODE, mykey); //Create an input stream to read the file. File enc=new File(“encryptedfile”); FileInputStream fi = new FileInputStream(enc); //Get the size of the file. long length = enc.length();…..cont’d

42 © Yingjiu Li 200742 Example: AES Decryption cont’d //Create a byte array with the size of the file. byte[] ciphertext = new byte[(int) length]; //Read data into the byte array fi.read(ciphertext); //Close file fi.close(); // Now decrypt the text and store it in the byte array ciphertext byte[] plaintext = cipher.doFinal(ciphertext); //Write encrypted text into the output file File dec=new File(“decryptedfile”) FileOutputStream fo = new FileOutputStream(dec); fo.write(plaintexttext); fo.close();

43 © Yingjiu Li 200743 Review Questions Which of the following is stream cipher 1)DES 2) AES 3) Vernam What is effective key size for 4-DES 1)112 bits 2) 113 bits 3) 168 bits Increasing key size from 56 bits to 128 bits, how many times more effort an attacker needs to spend in brute force attack? 1)72 2) 2^72 3) 2^184

44 © Yingjiu Li 200744 Individual Assignment 1 (5%) Due in week 4 (please submit hardcopy during week 4 class) –Textbook 1.11 Exercises 3, 12, 15 (pages 32-33 in 3 rd edition, pages 34-36 in 4 th edition) –Textbook 2.13 Exercises 1, 13, 17, 19 (pages 91-93 in 3 rd edition, pages 94-97 in 4 th edition)


Download ppt "IS 302: Information Security and Trust Week 3: From DES to AES 2012."

Similar presentations


Ads by Google