Chapter2_212-4-SEC-IS-ClassCryptoA.pptx

Full Transcript

Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Course Cryptography (Classic & Modern) Dr. Ahmed AlMokhtar Ben Hmida, College...

Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Course Cryptography (Classic & Modern) Dr. Ahmed AlMokhtar Ben Hmida, College of Computer Science, King Khaled University 'KKU', KSA okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA No List of Topics Contact Hours 1. Review of number theory, Probability and Statistics Ch01 Maths 4 2. Security functions of cryptography Ch1 8 Intro & Ch2 Classical 3. Symmetric cryptography Ch3 8 4. Public key cryptography Ch4 8 5. Key generation, Management, Exchange and distribution 8 Ch5 6. Digital certificate Ch6 2 7. Hash functions Ch6 4 8. Digital signature Ch7 4 9. Collision resistance Ch7 2 10. Common Cryptographic Protocols and standards Ch8 4 11. Types of cryptographic attacks Ch9 4 okhtar BEN 12.HMIDA, Dr. & Full Professor, Cryptographic Head of ATMS Implementation Processing , Lab, Expert in Signal Ch10 failures CS4College at King Kh Cryptography (Classic) SEC2412-4 College of Computer Science King Khalid University Academic Year 2024/2025 Course Textbooks & Assessment Tasks  Cryptography: An Introduction by Nigel Smart, Essential Publisher : McGraw-Hill College, 2004, ISBN- References 10 :0077099877, ISBN-13 : 978-0077099879 02  Cryptography and network security: principles and practice (7th edition), Stallings, William, Pearson, 2017, ISBN: 9781292158587  Understanding Cryptography : A Textbook for Students and Practitioners, By Christof Paar , Jan Supportive Pelzl , Foreword by Bart Preneel, 2014, ISBN10: 3642446493 ISBN13: 9783642446498 References  Bruce Schneier, Applied Cryptography, John Wiley & 03 Sons, 1996, ISBN 0-471-11709-9 N HAMIDA, Dr. & Full Professor, Headof ATMS Cryptography on Wikipedia Laboratory, Expert in Signal Processing , CS College at King Khalid Uni Cryptography (Classic) SEC2412-4 College of Computer Science King Khalid University Academic Year 2024/2025 Course Textbooks & Assessment Tasks Percentage of Total # Assessment task* Week Due Assessment Score 1 Final Theory Exam Week 17-18 40% 2 Mid Theory Exam Week 7-8 20% 3 Quizzes, Theory Exam Week 4-14 20% (5% by 4) Assessment task* 4 Assignments Week 2-15 10% (5+5) 5 Assignment-Project Week 2-15 10% Total = 100% N HAMIDA, Dr. & Full Professor, Head of ATMS Laboratory, Expert in Signal Processing , CS College at King Khalid Uni Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Introduction to Cryptography Definition Main objectives Characteristics of a cryptosystem Symmetric cryotpgraphy Course Map Definition/property/principle Study of the DES algorithm Asymmetric cryotpgraphy Definition/property/principle Study of the RSA algorithm Digital signature Hashing okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA CHAPTER 2 : Classical Cryptography, Stream Cipher, Block Cipher, ECB, CBC, Caesar Cipher Stream Cipher, Block Cipher, ECB, CBC, Caesar Cipher  How to brake… okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA CHAPTER 2 : Classical Cryptography, Stream Cipher, Block Cipher, ECB, CBC, Caesar Cipher  Stream Cipher, Block Cipher, ECB, CBC,  Caesar Cipher  How to brake… okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Characteristi Primitives without keys cs of a Random sequences Cryptosyste Encryption with Symmetric key m Security Primitives Primitive with s Symmetric key Pseudo -random sequences Identification Primitives Primitives with Public key Identification Primitives Mokhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption method: Stream Cipher Processes input items continuously, producing one (encrypted) output item at a time. The key is as long as the data stream. Steps: Definition of key stream (which must respect the size of the text) Combination of the current key stream with the stream. The encryption function must also modify the state of the stream => Each character x of the Plain text is encrypted with a okhtar BEN HMIDA, Dr. & Full Professor, Head ofi ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption method: Stream Cipher Old Method For a Plain text P=x1 x2 x3 x4 x5 … and a key streams l=l1 l2 l3 l4 l5 … there is an encryption function and encryption algorithms such as: E: Encryption function C = El(P) C = El1(X1) El2(X2)… There are two modes : Syncronous & Self-synchronizing Syncronous cipher : The key stream does not depend on Plaintext. Self- synchronizing : the key stream depends on n preceding clear characters. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption method: Stream Cipher The XOR logic gate: the output goes HIGH (or “1”) if one – and only one – of its inputs are HIGH. XOR stands for Exclusive-OR. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Block Cipher : The text is divided into several blocks of Encryption fixed size. One block of Plain text is processed at a time, producing one block of encrypted data. method: Without memory : The same function and the same key is used to encrypt successive blocks. (Same algorithm used to encrypt Block all blocks) Clear block Cipher key Encryption function Encrypted block How to use: two modes ECB & CBC : Electronic Code Block (ECB): Each block of data is encrypted independently of the others encrypted blocks are not linked Cipher Block Chaining (CBC): The result of a step is used to modify the input data of the next step. encrypted blocks are linked okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Block Cipher is the symmetric key cipher used Encryption for converting the Plain text into cipher text. method: It uses a simple substitution process Block or sometimes the permutation process where Cipher the block of Plain text is substituted with arbitrary bit of cipher text. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption method: Block Cipher Electronic Code Block ‘ECB’ Ahmed AlMoktar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA DES–ECB (Electronic Code Book) Encryption Topology Objective: Encrypt an arbitrarily long message with the 64- bit encrypting DES black box. Plain text 64 bits 64 bits 64 bits 64 bits DES key DES key DES key DES key 64 bits 64 bits 64 bits 64 bits Cryptogram okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Advantages and Limitations of ECB  Lack of message integrity  Vulnerability to attack when the same key is used to encrypt multiple messages  Not suitable for encrypting large amounts of data or where strong security is required  Leaks a bit per block when used on messages longer than a single block.  Encrypts identical plaintext blocks into identical ciphertext blocks, revealing data patterns  Not recommended for use in cryptographic protocols  Each block is independent, so an error in one block does not affect others. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Initial Vector Block Cipher: Cipher Block Chaining (CBC) okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Advantages and Limitations of CBC a ciphertext block depends on all blocks before it any change to a plaintext block affects all following ciphertext blocks https://www.youtube.com/watch?v=C7vmouDOJYM&list=PLEiEAq2VkUU LgKbiq9J4z517w8RV3-yJe&ab_channel=Simplilearn Video that can be divided into 15mn… (1-15mn) okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA CHAPTER 2 : Classical Cryptography, Stream Cipher, Block Cipher, ECB, CBC, Cesar Cipher  Revision for Chapter 1  Stream Cipher, Block Cipher, ECB, CBC, Caesar Cipher  How to brake… okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Example of encryption by ECB Caesar’s Cipher The Caesar cipher is a simple encryption technique that was used by Julius Caesar to send secret messages to his allies. It works by shifting letters in Plaintext message by a certain number of positions, known as the “shift” or “key”. Ahmed Almokhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Example of encryption by ECB Caesar’s Cipher The Caesar Cipher technique is one of the earliest and simplest methods of encryption technique. It’s simply a type of substitution cipher, i.e., each letter of a given text is replaced by a letter with a fixed number of positions down the alphabet. For example with a shift of 1, A would be replaced by B, B would become C, and so on. The method is apparently named after Julius Caesar, who used it to communicate with his officials. Thus to cipher a given text we need an integer value, known as a shift which indicates the number of positions each letter of the text has been moved down. The encryption can be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A = 0, B = 1,…, Z = 25. Encryption of a letter by a shift n can be described mathematically as… okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption - Cipher Cipher is a method for encrypting messages Plain Text Encryption Cipher Text Decryption Plain Text Algorithm Algorithm Key A Key B Encryption algorithms are standardized & published The key which is an input to the algorithm is secret – Key is a string of numbers or characters – If same key is used for encryption & decryption the algorithm is called symmetric – If different keys are used for encryption & decryption the algorithm is called asymmetric okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Example of encryption by ECB - Caesar's Cipher Substitution encryption Replace each letter with the one that follows it by three. a becomes d, b becomes e, …, y becomes b, z becomes c no keys The algorithm can be described as follows: C = E(p) = (p+3) mod(26) Problems making cryptanalysis of this algorithm simple: Known encryption and decryption algorithm. Only 25 keys to try. The language of the clear message is known and easily identifiable. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Example of encryption by ECB - Caesar's Cipher Additive cipher We can easily prove that the encryption and decryption are inverse of each other because Plaintext created by Bob (P1) is the same as the one sent by Alice (P). P1 = (C − k) mod 26 = (P + k − k) mode 26 = P okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption by ECB - Caesar's SUBTITUTION Cipher Caesar Cipher is a method in which each letter in the alphabet is rotated by three letters as shown : ABCDEFGHIJKLMNOPQRSTUVWXYZ DEFGHIJKLMNOPQRSTUVWXYZABC Let us try to encrypt the message : Attack at Dawn Assignment: Each student will exchange a secret message with his/her closest neighbor about some other person in the class and the neighbor will decipher it. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption by ECB - Caesar's SUBTITUTION Cipher Encrypti Plain Text Cipher: Cipher Text Message: Message: on Attack at Dawn Caesar Cipher Algorithm Dwwdfn Dw Gdyq Key (3) Cipher Text Plain Text Decryptio Message: Cipher: Caesar Cipher Message: n Dwwdfn Dw Gdyq Algorithm Attack at Dawn Key (3) How many different keys are possible? okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Encryption by ECB - Caesar's SUBTITUTION Cipher A B C D E F G H I J K L M N O P R S T U WV X Y Z A B C D E F G H I J K L M N O P R S T U WV X Y Z Ahmed AlMokhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Application exercise: Caesar's cipher Transform the following message into an encrypted text according to Caesar's algorithm : “I am an KKU student” okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Application exercise: Caesar's cipher Encryption ‘Hello’ Use the additive cipher with key = 15 to encrypt the message “hello” Solution : We apply the encryption algorithm to the plaintext, character by character The result is “WTAAD”. Note that the cipher is monoalphabetic because two instances of the same plaintext character (l’s) are encrypted as the same character (A) okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Application exercise: Caesar's cipher Now Decryption Use the additive cipher with key = 15 to decrypt the message “WTAAD”. Solution : We apply Decryption algorithm to Plaintext character by character: The result is “hello”. Note that the operation is in modulo 26, which means that a negative result needs to be mapped to Z26 (for example −15 becomes 11). okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA CHAPTER 2 : Classical Cryptography, Stream Cipher, Block Cipher, ECB, CBC, Caesar Cipher  Revision for Chapter 1  Stream Cipher, Block Cipher, ECB, CBC,  Caesar Cipher  How to break… okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA How to break a substitution cipher? Letter Percentag Letter Percentag e e What is the most common letter in English text? A 8.2 N 6.7.E its frequency in the Plaintext ! B 1.5 O 7.5 C 2.8 P 1.9 “X” “L” “E” “H” D 4.2 Q 0.1 E 12.7 R 6.0 F 2.2 S 6.3 G 2.0 T 9.0 H 6.1 U 2.8 ABCDEFGH I JKLMNOPQRST I 7.0 V 1.0 U VWX Y Z J 0.1 W 2.4 K 0.8 X 0.1 Source: https://crypto.stanford.edu/~dabo/courses/OnlineCrypto/ L 4.0 Y 2.0 M 2.4 Z 0.1 okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Letter Percentag Letter Percentag e e A 8.2 N 6.7 B 1.5 O 7.5 C 2.8 P 1.9 D 4.2 Q 0.1 E 12.7 R 6.0 F 2.2 S 6.3 G 2.0 T 9.0 H 6.1 U 2.8 I 7.0 V 1.0 J 0.1 W 2.4 K 0.8 X 0.1 L 4.0 Y 2.0 M 2.4 Z 0.1 okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Bigra Percenta Bigra Percenta m ge m ge TH 3.15 HE 2.51 AN 1.72 IN 1.69 ER 1.54 RE 1.48 ES 1.45 ON 1.45 EA 1.31 TI 1.28 AT 1.24 ST 1.21 EN 1.20 ND 1.18 okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA The distribution of English letter frequencies is described in Table 1, or graphically in Fig. 1. As one can see the most common letters are E and T. Bigra Percenta Bigra Percenta m ge m ge It often helps to know second order statistics about the underlying language, such as which are TH 3.15 HE 2.51 the most common sequences of two or three letters, called bigrams and trigrams. AN 1.72 IN 1.69 ER 1.54 RE 1.48 The most common bigrams in English are given by this Table, with the associated approximate ES 1.45 ON 1.45 percentages. The most common trigrams are, in decreasing EA 1.31 TI 1.28 order, AT 1.24 ST 1.21 THE, ING, AND, HER, ERE, ENT, THA, NTH, EN 1.20 ND 1.18 WAS, ETH, FOR. Armed with this information about English, we okhtar are BEN now HMIDA, able to Dr. & Full Professor, examine and breakHead a of number Expert in Signal Processing , ATMS Lab, of CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Example UKBYBIPOUZBCUFEEBORUKBYBHOBBRFESPVKBWFOFERVNBCVBZPRUBOFERVNBCVBPCYYF VUFOFEIKNWFRFIKJNUPWRFIPOUNVNIPUBRNCUKBEFWWFDNCHXCYBOHOPYXPUBNCUBOYN RVNIWNCPOJIOFHOPZRVFZIXUBORJRUBZRBCHNCBBONCHRJZSFWNVRJRUBZRPCYZPUKBZP UNVPWPCYVFZIXUPUNFCPWRVNBCVBRPYYNUNFCPWWJUKBYBIPOUZBCUIPOUNVNIPUBRNC HOPYXPUBNCUBOYNRVNIWNCPOJIOFHOPZRNCRVNBCUNENVVFZIXUNCHPCYVFZIXUPUNFCP WZPUKBZPUNVR B 36  E NC 11  IN UKB 6  THE N 34 PU 10  AT RVN 6 UB 10 U 33  T UN 9 FZI 4 P 32 digram trigram  A s s C 26 okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA Cryptographic Objectives Obfuscation is the masking of an item to render it unreadable, yet still usable. When you encrypt something, you make it unreadable to all except those who possess the decryption key who can decrypt it and use it. There was a way to encrypt data in such a way that it can be used without needing to decrypt it; this is what is known as functional encryption. Perfect Forward Secrecy, also called Forward Secrecy (FS), refers to an encryption system that changes the keys used to encrypt and decrypt information frequently and automatically. This ongoing process ensures that even if the most recent key is hacked, a minimal amount of sensitive data is exposed. Protects past messages against future compromises of keys. okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kh Cryptography (Classic) College of Computer Science ; King Khalid University ; KKU - KSA okhtar BEN HMIDA, Dr. & Full Professor, Head of ATMS Lab, Expert in Signal Processing , CS College at King Kha Exercise in Symmetric Cryptography : Disposable Mask Mask = atgix Mask = atgix M = salut C= tusdr M = salut Encryption Decryption Invented by Gilbert Verman. Encryption is the only one that is theoretically impossible to break. The characters composing the key must be chosen completely randomly Each key, or "mask", should only be used once Encryption: (Order(message)+Order(mask))%26 Decryption : (Order(message)-Order(mask))%26 Abcde fghi j k l m n o p q r s t u v w x y z 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 26 Prerequiste : Plaintext: salut & Mask: atgix CONSTRAINT : the same size of the Plaintext and the Mask Solution : 1- Try to encrypt : salut Encryption: (Order(message)+Order(mask))%26 19+1=20%26=20 t Plaintext: salut & Mask: atgix 1+20=21%26=21 u 12+ 7= 19%26 = 19 s 9+21= 30%26= 4 d 24+20=44%26=18 r 2- Reverse Operation : Decryption : (Order(message)-Order(mask))%26 Encrypted-mask t: 20-1=19 +26 > 26 Message=s u : 21-20=1 +26 > 26 Message =a s : 19-7=12 >26 Message= l d : 4-9=-5+26=21 26 Message=s u : 21-20=1 +26 > 26 Message =a s : 19-7=12 >26 Message= l d : 4-9=-5+26=21

Use Quizgecko on...
Browser
Browser