Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cryptography 1 CS432. Overview  What is cryptography and cryptology?  The main components of a crypto system.  Problems solved by cryptography.  Basic.

Similar presentations


Presentation on theme: "Cryptography 1 CS432. Overview  What is cryptography and cryptology?  The main components of a crypto system.  Problems solved by cryptography.  Basic."— Presentation transcript:

1 Cryptography 1 CS432

2 Overview  What is cryptography and cryptology?  The main components of a crypto system.  Problems solved by cryptography.  Basic concepts: symmetric cryptography, asymmetric cryptography, digital signatures.  Types of algorithms and related concepts.

3 Cryptography and Cryptology  Encryption: transformation of intelligible, understandable information into unintelligible form to disguise its meaning and intent from intruders.  Decryption: The inverse transformation of encrypted information into intelligible form  Both encryption and decryption are based on keys. It should be difficult or impossible to decrypt a message without knowing the key.  Cryptography: encryption + decryption.  Cryptanalysis: analyzing encrypted information with the intent of recovering the original plain information, without knowing the key.  Cryptology: cryptography + cryptanalysis.

4 The Encryption and Decryption Process  The encryption model

5 The major components of a crypto system (the model)  Plain text: the original message before encryption.  Encryption Algorithm: the algorithm used to transform the plaintext into unintelligible form (the cipher text).  The cipher text: the encrypted text.  Encryption key: the encryption process is always based on a key.  Decryption Algorithm: used to transforms cipher text back to plaintext.  The Decryption key: the key used in the decryption process. All algorithms must be public; only the keys are secret.

6 Intruders and Cryptanalysis  It is assumed that there is an intruder who listens to all communications and he may copy or delete any message An active intruder modifies some messages and re-inserts them An active intruder modifies some messages and re-inserts them A passive intruder just listens A passive intruder just listens  To decrypt a message without having a key, an intruder practices the art of cryptanalysis

7 What Does Cryptography Solve?  Confidentiality Ensure that nobody can get knowledge of what you transfer even if listening to the whole conversation Ensure that nobody can get knowledge of what you transfer even if listening to the whole conversation  Integrity Ensure that message has not been modified during the transmission Ensure that message has not been modified during the transmission  Authenticity You can verify that you are talking to the entity you think you are talking to You can verify that you are talking to the entity you think you are talking to  Identity You can verify who is the specific individual behind that entity You can verify who is the specific individual behind that entity  Non-repudiation The individual behind that asset cannot deny being associated with it The individual behind that asset cannot deny being associated with it

8 Symmetric Encryption “An introduction to cryptography” “AxCvGsmWe#4^, sdgfMwir3:dkJeTs Y8R\s@!q3%” “An introduction to cryptography” Clear-text input Clear-text output Cipher-text Same key (shared secret) EncryptionDecryption DES DES

9 Asymmetric Encryption “An introduction to cryptography” “Py75c%bn&*)9|f De^bDzjF@g5=& nmdFgegMs” “An introduction to cryptography” Clear-text Input Clear-text Output Cipher-text Different keys Encryption Decryption RSA RSA

10 Asymmetric Encryption  Things to remember about asymmetric keys: The relation between the two keys is unknown and from one key you cannot gain knowledge of the other, even if you have access to clear-text and cipher-text The relation between the two keys is unknown and from one key you cannot gain knowledge of the other, even if you have access to clear-text and cipher-text The two keys are interchangeable. All algorithms make no difference between public and private key. When a key pair is generated, any of the two can be public or private The two keys are interchangeable. All algorithms make no difference between public and private key. When a key pair is generated, any of the two can be public or private g$5knvMd’rk vegMs” Clear text ? Encryption

11 Example: Confidentiality Different keys Recipient’s public key Recipient’s private key private public Encryption Decryption “An introduction to cryptography” “Py75c%bn&*)9|f De^bDzjF@g5=& nmdFgegMs” “An introduction to cryptography” Clear-text Input Clear-text Output Cipher-text

12 Example: Authenticity Different keys Sender’s public key Sender’s private key private public Encryption Decryption “An introduction to cryptography” “Py75c%bn&*)9|f De^bDzjF@g5=& nmdFgegMs” “An introduction to cryptography” Clear-text Input Clear-text Output Cipher-text

13 Creating a Digital Signature 3kJfgf*£$& Py75c%bn This is the document created by Gianni Message or File Digital Signature Message Digest Calculate a short message digest from even a long input using a one-way message digest function (hash) Signatory's private key priv GenerateHash SHA, MD5 AsymmetricEncryption RSA This is the document created by Ahmed 3kJfgf*£$& Signed Document (Typically 128 bits)

14 Verifying a Digital Signature RSA This is the document created by Ahmed 3kJfgf*£$& Signed Document Py75c%bn Message Digest GenerateHash Gianni's public key (from certificate) AsymmetricDecryption pub Digital Signature Py75c%bn ? Compare ?

15 Classification of Ciphers  Substitution ciphers Cesar’s cipher Cesar’s cipher Affine transformation ciphers Affine transformation ciphers  Transposition ciphers  One-time pad  Block ciphers  Exponentiation ciphers RSA RSA

16 Substitution Ciphers  Each symbol is replaced by another symbol (Example: with Latin alphabet, in monoalphabetic substitution, the key is a 26-letter string that represents the substituting permutation of the alphabet, so 26! keys are available) Case study: Caesar cipher (A -> D, B -> E, C->F, …Z->C ), or ord (s) = [ord(s) + 3] mod 26. Letters are packed in equal blocks to prevent cryptanalysis based on the word length

17 Case Study: Cesar’s Cipher Plaintext: 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 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Ciphertext: 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 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 THIS MESSAGE IS TOP SECRET 19 7 8 18 12 | 4 18 18 0 6 | 4 8 18 19 14 | 15 18 4 2 17 | 4 19| 22 10 11 21 15 | 7 21 21 3 9 | 7 11 21 22 17 | 18 21 7 5 20 | 7 22 WKLVP HVVDJ HLVWR SVHFU HW

18 Substitution Ciphers Substitution ciphers are easy to break with a relatively small amount of ciphertext, using statistical properties of the language (frequency of letters, bigrams, trigrams, etc.)

19 A Cryptanalysis Example Letter 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 Frequency 7 1 3 4 13 3 2 3 8 <1 <1 4 3 8 7 3 <1 8 6 9 3 1 1 <1 2 <1 The frequencies of occurrence of letters in English text: Letter 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 Frequency 1 0 4 5 1 3 0 0 0 1 0 1 1 1 0 7 2 2 2 3 0 0 1 2 3 2 Analysis of the frequencies of occurrence of letters in the ciphertext: Ciphertext: YFXMP CESPZ CJTDF DPQFW QZCPY NTASP CTYRX PDDLR PD (Suppose, we know that shift transformation cipher was used) Guess: P(7) = E(13) => 15 = 4 + k (mod 26) => k = 11. Plaintext: NUMBE RTHEO RYISU SEFUL FOREN CIPHE RINGM ESSAG ES (NUMBER THEORY IS USEFUL FOR ENCIPHERING MESSAGES)

20 Transposition Cipher  All symbols are reordered according to a permutation specified by the key Example: WISPER the key—must have no repeated symbols 6253 14 the relative order of each symbol in the key 6253 14 the relative order of each symbol in the key “CIS IS THE BEST COLLEGE IN TOWN” “CIS IS THE BEST COLLEGE IN TOWN” C I S I S T H E B E S T C O L L E G E I N T O W plaintext is written in rows of the key’s size N x x x x x the last row is padded 1 2 3 4 5 6 1 2 3 4 5 6 SOXLEIEEGTTHUTTMNY (ciphertext is written in columns permuted in the order of key’s symbols) SOXLEIEEGTTHUTTMNY (ciphertext is written in columns permuted in the order of key’s symbols) Transposition ciphers can also be broken by guessing the key size and using statistical analysis when the cryptanalyst knows that it is a transposition cipher.

21 Transposition Ciphers C I S I S T H E B E S T C O L L E G E I N T O W plaintext is written in rows of the key’s size N x x x x x the last row is padded WISPER 6253 14 SIITSCSEETBHEOLGLCOITWNEXXXXXN Cipher Text: SSEOX IEOIX IELTX TTGWX SBLNX CHCEN

22 Any bit sequence the size of plaintext can be a key. Each bit of plaintext is XOR-ed with the corresponding bit of the key to produce a bit of the ciphertext One-Time Pad Ciphers 011 10010(XOR) + = Plaintext: 001110011010010110 Key: 100100100111110110 Ciphertext: 101010111101100000 Example: One-time Pad is unbreakable; however key distribution is a big problem…

23 Block Ciphers (Affine Transformation)  Key: A is a square integer matrix of order n such that (|A|, 26) = 1 A is a square integer matrix of order n such that (|A|, 26) = 1 B is an n-vector of integers B is an n-vector of integers  The ciphertext is split into blocks of length n; the last block is padded  For each block P, compute C = (AP + B) (mod 26) C = (AP + B) (mod 26)

24 Exponentiation Ciphers Given:  p is a prime  The key, e > 0 satisfies: (e, p-1) = 1 Plaintext: 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 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1.Group the resulting numbers into blocks of 2m decimal digits, where m is the largest even integer such that the decimal value of each block is less than p 2.For each plaintext block, P, compute a ciphertext block C = P e (mod p) 3.To decipher, find d such that de ≡ 1 (mod p-1) and compute P = C d (mod p) C d ≡ P ed P ≡ P k(p-1)+1 ≡ [P (p-1) ] k P ≡ P (mod p) (By Fermat’s Little Theorem)

25 Exponentiation Ciphers: An Example  p = 2633;  the key e = 29; (e, p-1) = (29, 2632) = 1;  Block length is 4 (m=2) Plaintext: 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 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 THIS IS AN EXAMPLE OF AN EXPONENTIATION CIPHER 1907 0818 0818 0013 0423 0012 1511 0414 0500 1304 2315 1413 0413 1908 0019 0814 1302 0815 0704 1723 1907 29 ≡ 2199 (mod 2633) 2199 1745 1745 1206 2437 2425 1729 1619 0935 0960 1072 1541 1701 1553 0735 2064 1351 1794 1841 1459 d = 2269 2269*2622 ≡ 1 (mod 2622) 2199 2269 ≡ 1907 (mod 2633)

26 One Immediate Application: The Diffie-Hellman Algorithm Problem: Establish common keys (for symmetric cryptography) to be used by two individuals so that intruders cannot discover them in a feasible amount of computer time. Let p be a large prime a be an integer relatively prime to p These are known to all! Pick k 1 relatively prime to p-1 Pick k 2 relatively prime to p-1 =

27 A Simple Example of a DH Exchange p =17 a = 2 k 1 = 3k 2 = 5 =

28 Modern Symmetric-Key Algorithms  Combine transpositions and substitutions and cascade them to make the algorithms very complex (to prevent cryptanalysis even when large amounts of ciphertext are available)  Often use block ciphers 4-bit transposition (T) SS SS SSTSTST Cascading into a product 4 to 2 encoder 2-bit substitution (S) T 2 to 4 decoder

29 Some Common Symmetric-Key Cryptographic Algorithms (after A. Tanenbaum) Cipher Key size (bits) Characteristics Rijndael128-256Best Triple DES 168 Second best Serpent, Twofish 128-256 Very strong IDEA128 Good (but patented) RC5128-256 RC41-2048 Some keys are weak DES56Weak

30 Public-Key Cryptography A (public key, private key) pair Publish the public key (= encryption key) Publish the public key (= encryption key) Keep the private key (= decryption key) secret Keep the private key (= decryption key) secret Two essential requirements: 1) 2) It is very hard (i.e, computationally infeasible) to obtain from To send a message M to you, I send To send a message M to you, I send You decrypt it, obtaining: You decrypt it, obtaining:

31 RSA (Rivest, Shamir, Adleman)  Parameters: p, q, n, z, d, e Choose, large (1024 bits) primes: p, q Choose, large (1024 bits) primes: p, q Compute n = pq, z = φ(n) = (p-1)(q-1) Compute n = pq, z = φ(n) = (p-1)(q-1) Choose the exponent e relatively prime to z Choose the exponent e relatively prime to z Find d: ed ≡ 1(mod z) Find d: ed ≡ 1(mod z)  Keys: public, (e, n); private, (d, n);  Encryption and decryption: Brake the plaintext into largest equal even-digit blocks (P) shorter than n bits Brake the plaintext into largest equal even-digit blocks (P) shorter than n bits Encrypt each block P by computing C = E(P) ≡ P e (mod n) Encrypt each block P by computing C = E(P) ≡ P e (mod n) Decrypt C by computing D(C) ≡ C d (mod n) ≡ P ed (mod n) ≡ P kφ(n)+1 (mod n) ≡ P kφ(n) P(mod n) ≡ P(mod n) Decrypt C by computing D(C) ≡ C d (mod n) ≡ P ed (mod n) ≡ P kφ(n)+1 (mod n) ≡ P kφ(n) P(mod n) ≡ P(mod n) Euler’s Theorem: If n > 0 and e and d are integers, such that (a, m) = 1, then a φ(m) ≡ 1 (mod m). The probability that P and n are not relatively prime is extremely low!

32 RSA: An Example  p = 43, q=59; n = 43*59 = 2357; φ(n) = 42*58 =2436  Exponent e = 13; (e, φ(n) ) = (13, 42*58) = 1;  Block length is 4 Plaintext: 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 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 PUBLIC KEY CRYPTOGRAPHY 1520 0111 0802 1004 2402 1724 1519 1406 1700 1507 2423 1520 13 ≡ 95 (mod 2537) 0095 1648 1410 1299 0811 2333 2132 0370 1185 1457 1084 937* 13 ≡ 1 (mod 2436) 0095 937 ≡ 1520 (mod 2537) d = 937 E(P) ≡ P e (mod n) P ≡ C d (mod n) Public key: (13, 2357) Private key: (937, 2357)

33 Properties of RSA  The algorithm is secure because of the difficulty of factoring N. Factoring a 500-digit number should take 10 25 years using a CPU with 1 microsecond instruction time  Encryption and decryption are inverse and commutative (an important property for digital signatures)  The algorithm is slow (compared to DES and other symmetric algorithms with much shorter keys) RSA may be prohibitively slow when dealing with large blocks of data. It is typically used for one-time session key distribution for a symmetric-key algorithm (such as triple-DES)


Download ppt "Cryptography 1 CS432. Overview  What is cryptography and cryptology?  The main components of a crypto system.  Problems solved by cryptography.  Basic."

Similar presentations


Ads by Google