SlideShare une entreprise Scribd logo
1  sur  54
Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
30-1  INTRODUCTION Let us introduce the issues involved in cryptography. First, we need to define some terms; then we give some taxonomies. Definitions Two Categories Topics discussed in this section:
Figure 30.1  Cryptography components
Figure 30.2  Categories of cryptography
Figure 30.3  Symmetric-key cryptography
In symmetric-key cryptography, the same key is used by the sender (for encryption)  and the receiver (for decryption). The key is shared. Note
Figure 30.4  Asymmetric-key cryptography
Figure 30.5  Keys used in cryptography
Figure 30.6  Comparison between two categories of cryptography
30-2  SYMMETRIC-KEY CRYPTOGRAPHY Symmetric-key cryptography started thousands of years ago when people needed to exchange secrets (for example, in a war). We still mainly use symmetric-key cryptography in our network security.  Traditional Ciphers Simple Modern Ciphers Modern Round Ciphers Mode of Operation Topics discussed in this section:
Figure 30.7  Traditional ciphers
A substitution cipher replaces one symbol with another. Note
The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.1 Solution The cipher is probably monoalphabetic because both occurrences of L’s are encrypted as O’s.
The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.2 Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.
The shift cipher is sometimes referred to as the Caesar cipher. Note
Use the shift cipher with key = 15 to encrypt the message “HELLO.” Solution We encrypt one character at a time. Each character is shifted 15 characters down. Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also encrypted to A. And O is encrypted to D. The cipher text is  WTAAD . Example 30.3
Use the shift cipher with key = 15 to decrypt the message “WTAAD.” Solution We decrypt one character at a time. Each character is shifted 15 characters up. Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted to L. The second A is decrypted to L. And, finally, D is decrypted to O. The plaintext is  HELLO . Example 30.4
A transposition cipher reorders (permutes) symbols in a block of symbols. Note
Figure 30.8  Transposition cipher
Encrypt the message “HELLO MY DEAR,” using the key shown in Figure 30.8. Solution We first remove the spaces in the message. We then divide the text into blocks of four characters. We add a bogus character Z at the end of the third block. The result is HELL OMYD EARZ. We create a three-block ciphertext  ELHLMDOYAZER . Example 30.5
Using Example 30.5, decrypt the message “ELHLMDOYAZER”. Solution The result is HELL OMYD EARZ. After removing the bogus character and combining the characters, we get the original message “ HELLO MY DEAR .” Example 30.6
Figure 30.9  XOR cipher
Figure 30.10  Rotation cipher
Figure 30.11  S-box
Figure 30.12  P-boxes: straight, expansion, and compression
Figure 30.13  DES
Figure 30.14  One round in DES ciphers
Figure 30.15  DES function
Figure 30.16  Triple DES
Table 30.1  AES configuration
AES has three different configurations with respect to the number of rounds and key size. Note
Figure 30.17  AES
Figure 30.18  Structure of each round
Figure 30.19  Modes of operation for block ciphers
Figure 30.20  ECB mode
Figure 30.21  CBC mode
Figure 30.22  CFB mode
Figure 30.23  OFB mode
30-3  ASYMMETRIC-KEY CRYPTOGRAPHY An asymmetric-key (or public-key) cipher uses two keys: one private and one public. We discuss two algorithms: RSA and Diffie-Hellman. RSA Diffie-Hellman Topics discussed in this section:
Figure 30.24  RSA
In RSA,  e  and  n  are announced to the public;  d  and    are kept secret. Note
Bob chooses 7 and 11 as p and q and calculates  n = 7 · 11 = 77. The value of    = (7 − 1) (11 − 1) or 60. Now he chooses two keys, e and d. If he chooses e to be 13, then d is 37. Now imagine Alice sends the plaintext 5 to Bob. She uses the public key 13 to encrypt 5. Example 30.7
Example 30.7 (continued) Bob receives the ciphertext 26 and uses the private key 37 to decipher the ciphertext: The plaintext  5  sent by Alice is received as plaintext  5  by Bob.
Jennifer creates a pair of keys for herself. She chooses  p = 397 and q = 401. She calculates n = 159,197 and    = 396 · 400 = 158,400. She then chooses e = 343 and  d = 12,007. Show how Ted can send a message to Jennifer if he knows e and n. Example 30.8
Solution Suppose Ted wants to send the message “ NO ” to Jennifer. He changes each character to a number (from 00 to 25) with each character coded as two digits. He then concatenates the two coded characters and gets a four-digit number. The plaintext is 1314. Ted then uses e and n to encrypt the message. The ciphertext is 1314 343  = 33,677 mod 159,197. Jennifer receives the message 33,677 and uses the decryption key d to decipher it as 33,677 12,007  = 1314 mod 159,197. Jennifer then decodes 1314 as the message “NO”. Figure 30.25 shows the process. Example 30.8 (continuted)
Figure 30.25  Example 30.8
Let us give a realistic example. We randomly chose an integer of 512 bits. The integer p is a 159-digit number.  Example 30.9 The integer q is a 160-digit number.
We calculate n. It has 309 digits:  Example 30.9 (continued) We calculate   . It has 309 digits:
We choose e = 35,535. We then find d. Example 30.9 (continued) Alice wants to send the message “THIS IS A TEST” which can be changed to a numeric value by using the 00–26 encoding scheme (26 is the space character).
The ciphertext calculated by Alice is C = P e , which is. Example 30.9 (continued) Bob can recover the plaintext from the ciphertext by using P = C d , which is The recovered plaintext is  THIS IS A TEST  after decoding.
The symmetric (shared) key in the  Diffie-Hellman protocol is K = g xy  mod p. Note
Let us give a trivial example to make the procedure clear. Our example uses small numbers, but note that in a real situation, the numbers are very large. Assume g = 7 and   p = 23. The steps are as follows: 1.  Alice chooses x = 3 and calculates R 1  = 7 3  mod 23 = 21. 2.  Bob chooses y = 6 and calculates R 2  = 7 6  mod 23 = 4. 3.  Alice sends the number 21 to Bob. 4.  Bob sends the number 4 to Alice. 5.  Alice calculates the symmetric key K = 4 3  mod 23 = 18. 6.  Bob calculates the symmetric key K = 21 6  mod 23 = 18. The value of K is the same for both Alice and Bob;  g xy  mod p = 7 18  mod 23 = 18. Example 30.10
Figure 30.27  Diffie-Hellman idea
Figure 30.28  Man-in-the-middle attack

Contenu connexe

Tendances (20)

Chapter 22
Chapter 22Chapter 22
Chapter 22
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
 
Data Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITSData Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITS
 
Chapter 4 - Digital Transmission
Chapter 4 - Digital TransmissionChapter 4 - Digital Transmission
Chapter 4 - Digital Transmission
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Chap 05
Chap 05Chap 05
Chap 05
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Chapter 8: Switching
Chapter 8: SwitchingChapter 8: Switching
Chapter 8: Switching
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Ch22
Ch22Ch22
Ch22
 
Chapter 26
Chapter 26Chapter 26
Chapter 26
 
Routing in Multicast Communication
Routing in Multicast CommunicationRouting in Multicast Communication
Routing in Multicast Communication
 
Ch6 1 v1
Ch6 1 v1Ch6 1 v1
Ch6 1 v1
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Error Detection and Correction - Data link Layer
Error Detection and Correction - Data link LayerError Detection and Correction - Data link Layer
Error Detection and Correction - Data link Layer
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
 
Subnetting (FLSM & VLSM) with examples
Subnetting (FLSM & VLSM) with examplesSubnetting (FLSM & VLSM) with examples
Subnetting (FLSM & VLSM) with examples
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
OSI and TCP/IP Reference Model - Ramesh Kumar, Convergence Labs
OSI and TCP/IP Reference Model - Ramesh Kumar, Convergence LabsOSI and TCP/IP Reference Model - Ramesh Kumar, Convergence Labs
OSI and TCP/IP Reference Model - Ramesh Kumar, Convergence Labs
 

En vedette

Parcial Dep I
Parcial Dep IParcial Dep I
Parcial Dep IAdalberto
 
Mapa conceptual Hector Bracho
Mapa conceptual Hector BrachoMapa conceptual Hector Bracho
Mapa conceptual Hector Brachohjbm5
 
Nuevas Direccciones De Correo 12 Junio 2009
Nuevas Direccciones De Correo 12 Junio 2009Nuevas Direccciones De Correo 12 Junio 2009
Nuevas Direccciones De Correo 12 Junio 2009Adalberto
 
Differentiated Instruction
Differentiated InstructionDifferentiated Instruction
Differentiated InstructionRoland Darby
 
Luis hernandez 12_03_15
Luis hernandez 12_03_15Luis hernandez 12_03_15
Luis hernandez 12_03_15Albertohm19
 
La curva de la felicidad
La curva de la felicidad  La curva de la felicidad
La curva de la felicidad dafevi
 
Maestria Diversidad 1 ComparacióN Entre
Maestria Diversidad 1  ComparacióN EntreMaestria Diversidad 1  ComparacióN Entre
Maestria Diversidad 1 ComparacióN EntreAdalberto
 
Evolution Of A Company Tte
Evolution Of A Company TteEvolution Of A Company Tte
Evolution Of A Company TteAlan Desrocher
 
Reverse Path Visibility with Agent-to-Agent Tests
Reverse Path Visibility with Agent-to-Agent TestsReverse Path Visibility with Agent-to-Agent Tests
Reverse Path Visibility with Agent-to-Agent TestsThousandEyes
 
UX: Más allá del wireframe
UX: Más allá del wireframeUX: Más allá del wireframe
UX: Más allá del wireframeSoftware Guru
 
IX-F Database for Automation
IX-F Database for AutomationIX-F Database for Automation
IX-F Database for AutomationInternet Society
 
Operating System Concepts - Ch05
Operating System Concepts - Ch05Operating System Concepts - Ch05
Operating System Concepts - Ch05Wayne Jones Jnr
 

En vedette (20)

Parcial Dep I
Parcial Dep IParcial Dep I
Parcial Dep I
 
Mapa conceptual Hector Bracho
Mapa conceptual Hector BrachoMapa conceptual Hector Bracho
Mapa conceptual Hector Bracho
 
Amanda Richter
Amanda RichterAmanda Richter
Amanda Richter
 
Nuevas Direccciones De Correo 12 Junio 2009
Nuevas Direccciones De Correo 12 Junio 2009Nuevas Direccciones De Correo 12 Junio 2009
Nuevas Direccciones De Correo 12 Junio 2009
 
Differentiated Instruction
Differentiated InstructionDifferentiated Instruction
Differentiated Instruction
 
Banco de Imagens
Banco de ImagensBanco de Imagens
Banco de Imagens
 
Luis hernandez 12_03_15
Luis hernandez 12_03_15Luis hernandez 12_03_15
Luis hernandez 12_03_15
 
La curva de la felicidad
La curva de la felicidad  La curva de la felicidad
La curva de la felicidad
 
Maestria Diversidad 1 ComparacióN Entre
Maestria Diversidad 1  ComparacióN EntreMaestria Diversidad 1  ComparacióN Entre
Maestria Diversidad 1 ComparacióN Entre
 
Evolution Of A Company Tte
Evolution Of A Company TteEvolution Of A Company Tte
Evolution Of A Company Tte
 
Brochure-Web
Brochure-WebBrochure-Web
Brochure-Web
 
Reverse Path Visibility with Agent-to-Agent Tests
Reverse Path Visibility with Agent-to-Agent TestsReverse Path Visibility with Agent-to-Agent Tests
Reverse Path Visibility with Agent-to-Agent Tests
 
UX: Más allá del wireframe
UX: Más allá del wireframeUX: Más allá del wireframe
UX: Más allá del wireframe
 
Efecto Power clip en corel draw X3
Efecto Power clip en corel draw X3Efecto Power clip en corel draw X3
Efecto Power clip en corel draw X3
 
Financial services
Financial servicesFinancial services
Financial services
 
History of Criminology
History of CriminologyHistory of Criminology
History of Criminology
 
Ch25
Ch25Ch25
Ch25
 
IX-F Database for Automation
IX-F Database for AutomationIX-F Database for Automation
IX-F Database for Automation
 
Operating System Concepts - Ch05
Operating System Concepts - Ch05Operating System Concepts - Ch05
Operating System Concepts - Ch05
 
Plan estratégico 2.016-2.020
Plan estratégico 2.016-2.020Plan estratégico 2.016-2.020
Plan estratégico 2.016-2.020
 

Similaire à Chapter 30 - Cry

Similaire à Chapter 30 - Cry (20)

30 Cryptography
30 Cryptography30 Cryptography
30 Cryptography
 
1network security encryption_methods-1
1network security encryption_methods-11network security encryption_methods-1
1network security encryption_methods-1
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #Cryptography
 
Unit 3
Unit 3Unit 3
Unit 3
 
Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02
 
Network security
Network securityNetwork security
Network security
 
Asymmetric Cryptography.pptx
Asymmetric Cryptography.pptxAsymmetric Cryptography.pptx
Asymmetric Cryptography.pptx
 
Hill code
Hill codeHill code
Hill code
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Rsa cryptosystem
Rsa cryptosystemRsa cryptosystem
Rsa cryptosystem
 
ch-03.ppt
ch-03.pptch-03.ppt
ch-03.ppt
 
G029037043
G029037043G029037043
G029037043
 
Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03
 
Stallings Kurose and Ross
Stallings Kurose and RossStallings Kurose and Ross
Stallings Kurose and Ross
 
Novel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaNovel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsa
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentation
 
1329 n 9460
1329 n 94601329 n 9460
1329 n 9460
 

Plus de Wayne Jones Jnr (20)

Chapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File TransferChapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
 
Ch23
Ch23Ch23
Ch23
 
Ch21
Ch21Ch21
Ch21
 
Ch20
Ch20Ch20
Ch20
 
Ch19
Ch19Ch19
Ch19
 
Ch18
Ch18Ch18
Ch18
 
Ch17
Ch17Ch17
Ch17
 
Ch16
Ch16Ch16
Ch16
 
Ch15
Ch15Ch15
Ch15
 
Ch14
Ch14Ch14
Ch14
 
Ch13
Ch13Ch13
Ch13
 
Ch12
Ch12Ch12
Ch12
 
Ch10
Ch10Ch10
Ch10
 
Ch09
Ch09Ch09
Ch09
 
Ch08
Ch08Ch08
Ch08
 
Ch07
Ch07Ch07
Ch07
 
Ch06
Ch06Ch06
Ch06
 
Ch32
Ch32Ch32
Ch32
 
Ch31
Ch31Ch31
Ch31
 
Chapter 29 - Mutimedia
Chapter 29 - MutimediaChapter 29 - Mutimedia
Chapter 29 - Mutimedia
 

Dernier

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Dernier (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Chapter 30 - Cry

  • 1. Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 2. 30-1 INTRODUCTION Let us introduce the issues involved in cryptography. First, we need to define some terms; then we give some taxonomies. Definitions Two Categories Topics discussed in this section:
  • 3. Figure 30.1 Cryptography components
  • 4. Figure 30.2 Categories of cryptography
  • 5. Figure 30.3 Symmetric-key cryptography
  • 6. In symmetric-key cryptography, the same key is used by the sender (for encryption) and the receiver (for decryption). The key is shared. Note
  • 7. Figure 30.4 Asymmetric-key cryptography
  • 8. Figure 30.5 Keys used in cryptography
  • 9. Figure 30.6 Comparison between two categories of cryptography
  • 10. 30-2 SYMMETRIC-KEY CRYPTOGRAPHY Symmetric-key cryptography started thousands of years ago when people needed to exchange secrets (for example, in a war). We still mainly use symmetric-key cryptography in our network security. Traditional Ciphers Simple Modern Ciphers Modern Round Ciphers Mode of Operation Topics discussed in this section:
  • 11. Figure 30.7 Traditional ciphers
  • 12. A substitution cipher replaces one symbol with another. Note
  • 13. The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.1 Solution The cipher is probably monoalphabetic because both occurrences of L’s are encrypted as O’s.
  • 14. The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.2 Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.
  • 15. The shift cipher is sometimes referred to as the Caesar cipher. Note
  • 16. Use the shift cipher with key = 15 to encrypt the message “HELLO.” Solution We encrypt one character at a time. Each character is shifted 15 characters down. Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also encrypted to A. And O is encrypted to D. The cipher text is WTAAD . Example 30.3
  • 17. Use the shift cipher with key = 15 to decrypt the message “WTAAD.” Solution We decrypt one character at a time. Each character is shifted 15 characters up. Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted to L. The second A is decrypted to L. And, finally, D is decrypted to O. The plaintext is HELLO . Example 30.4
  • 18. A transposition cipher reorders (permutes) symbols in a block of symbols. Note
  • 19. Figure 30.8 Transposition cipher
  • 20. Encrypt the message “HELLO MY DEAR,” using the key shown in Figure 30.8. Solution We first remove the spaces in the message. We then divide the text into blocks of four characters. We add a bogus character Z at the end of the third block. The result is HELL OMYD EARZ. We create a three-block ciphertext ELHLMDOYAZER . Example 30.5
  • 21. Using Example 30.5, decrypt the message “ELHLMDOYAZER”. Solution The result is HELL OMYD EARZ. After removing the bogus character and combining the characters, we get the original message “ HELLO MY DEAR .” Example 30.6
  • 22. Figure 30.9 XOR cipher
  • 23. Figure 30.10 Rotation cipher
  • 24. Figure 30.11 S-box
  • 25. Figure 30.12 P-boxes: straight, expansion, and compression
  • 27. Figure 30.14 One round in DES ciphers
  • 28. Figure 30.15 DES function
  • 29. Figure 30.16 Triple DES
  • 30. Table 30.1 AES configuration
  • 31. AES has three different configurations with respect to the number of rounds and key size. Note
  • 33. Figure 30.18 Structure of each round
  • 34. Figure 30.19 Modes of operation for block ciphers
  • 35. Figure 30.20 ECB mode
  • 36. Figure 30.21 CBC mode
  • 37. Figure 30.22 CFB mode
  • 38. Figure 30.23 OFB mode
  • 39. 30-3 ASYMMETRIC-KEY CRYPTOGRAPHY An asymmetric-key (or public-key) cipher uses two keys: one private and one public. We discuss two algorithms: RSA and Diffie-Hellman. RSA Diffie-Hellman Topics discussed in this section:
  • 41. In RSA, e and n are announced to the public; d and  are kept secret. Note
  • 42. Bob chooses 7 and 11 as p and q and calculates n = 7 · 11 = 77. The value of  = (7 − 1) (11 − 1) or 60. Now he chooses two keys, e and d. If he chooses e to be 13, then d is 37. Now imagine Alice sends the plaintext 5 to Bob. She uses the public key 13 to encrypt 5. Example 30.7
  • 43. Example 30.7 (continued) Bob receives the ciphertext 26 and uses the private key 37 to decipher the ciphertext: The plaintext 5 sent by Alice is received as plaintext 5 by Bob.
  • 44. Jennifer creates a pair of keys for herself. She chooses p = 397 and q = 401. She calculates n = 159,197 and  = 396 · 400 = 158,400. She then chooses e = 343 and d = 12,007. Show how Ted can send a message to Jennifer if he knows e and n. Example 30.8
  • 45. Solution Suppose Ted wants to send the message “ NO ” to Jennifer. He changes each character to a number (from 00 to 25) with each character coded as two digits. He then concatenates the two coded characters and gets a four-digit number. The plaintext is 1314. Ted then uses e and n to encrypt the message. The ciphertext is 1314 343 = 33,677 mod 159,197. Jennifer receives the message 33,677 and uses the decryption key d to decipher it as 33,677 12,007 = 1314 mod 159,197. Jennifer then decodes 1314 as the message “NO”. Figure 30.25 shows the process. Example 30.8 (continuted)
  • 46. Figure 30.25 Example 30.8
  • 47. Let us give a realistic example. We randomly chose an integer of 512 bits. The integer p is a 159-digit number. Example 30.9 The integer q is a 160-digit number.
  • 48. We calculate n. It has 309 digits: Example 30.9 (continued) We calculate  . It has 309 digits:
  • 49. We choose e = 35,535. We then find d. Example 30.9 (continued) Alice wants to send the message “THIS IS A TEST” which can be changed to a numeric value by using the 00–26 encoding scheme (26 is the space character).
  • 50. The ciphertext calculated by Alice is C = P e , which is. Example 30.9 (continued) Bob can recover the plaintext from the ciphertext by using P = C d , which is The recovered plaintext is THIS IS A TEST after decoding.
  • 51. The symmetric (shared) key in the Diffie-Hellman protocol is K = g xy mod p. Note
  • 52. Let us give a trivial example to make the procedure clear. Our example uses small numbers, but note that in a real situation, the numbers are very large. Assume g = 7 and p = 23. The steps are as follows: 1. Alice chooses x = 3 and calculates R 1 = 7 3 mod 23 = 21. 2. Bob chooses y = 6 and calculates R 2 = 7 6 mod 23 = 4. 3. Alice sends the number 21 to Bob. 4. Bob sends the number 4 to Alice. 5. Alice calculates the symmetric key K = 4 3 mod 23 = 18. 6. Bob calculates the symmetric key K = 21 6 mod 23 = 18. The value of K is the same for both Alice and Bob; g xy mod p = 7 18 mod 23 = 18. Example 30.10
  • 53. Figure 30.27 Diffie-Hellman idea
  • 54. Figure 30.28 Man-in-the-middle attack