SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
Understanding Cryptography – A Textbook for
Students and Practitioners
by Christof Paar and JanPelzl
www.crypto-textbook.com
Chapter 5 – More About Block Ciphers
ver. November 26, 2010
These slides were prepared by Amir Moradi, Christof Paar and Jan Pelzl
And modified by Sam Bowne
Last modified 10-2-17
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl2
Some legal stuff (sorry): Terms of Use
• The slides can used free of charge. All copyrights for the
slides remain with Christof Paar and Jan Pelzl.
• The title of the accompanying book “Understanding
Cryptography” by Springer and the author’s names must
remain on each slide.
• If the slides are modified, appropriate credits to the book
authors and the book title must remain within the slides.
• It is not permitted to reproduce parts or all of the slides in
printed form whatsoever without written consent by the
authors.
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl3
Contents
• 5.1 Encryption with Block Ciphers: Modes of Operation
• Electronic Code Book mode (ECB)
• Cipher Block Chaining mode (CBC)
• Output Feedback mode (OFB)
• Cipher Feedback mode (CFB)
• Counter mode (CTR)
• Galois Counter Mode (GCM)
• 5.2 Exhaustive Key Search Revisited
• 5.3 Increasing the Security of Block Ciphers
Modular Arithmetic: Multiplication and Multiplicative Inverses
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl5
Block Ciphers
• A block cipher is much more than just an encryption
algorithm, it can be used ...
• to build different types of block-based encryption
schemes
• to realize stream ciphers
• to construct hash functions
• to make message authentication codes
• to build key establishment protocols
• to make a pseudo-random number generator
• ...
• The security of block ciphers also can be increased by
• key whitening
• multiple encryption
5.1 Encryption with Block Ciphers:
Modes of Operation
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl7
Encryption with Block Ciphers
• There are several ways of encrypting long plaintexts, e.g., an e-mail or a
computer file, with a block cipher (“modes of operation”)
• Electronic Code Book mode (ECB)
• Cipher Block Chaining mode (CBC)
• Output Feedback mode (OFB)
• Cipher Feedback mode (CFB)
• Counter mode (CTR)
• Galois Counter Mode (GCM)
• All of the 6 modes provide confidentiality
• They may also provide authenticity and integrity:
• Is the message really coming from the original sender? (authenticity)
• Was the ciphertext altered during transmission? (integrity)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl8
Block Size
•ECB and CBC require plaintext that's an exact
multiple of the block size
•Otherwise, plaintext must be padded
•CFB, OFB and CTR modes use a block cipher to
create a stream cipher
•Error on page 124: CFB -> CBC (Link Ch 5a)
Block Size
• ECB and CBC require plaintext that's an exact multiple of the
block size
•CBC in Python
Block Size
• CFB, OFB and CTR modes use a block cipher to create a stream
cipher
• Works for CFB and CTR but not OFB
A Bug in Python
• Link Ch 4d
5.1.1 Electronic Codebook Mode (ECB)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Electronic Code Book mode (ECB)
• Messages which exceed b bits are partitioned into b-bit blocks
• Each Block is encrypted separately
• Image from Wikipedia (Link Ch 5a)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Electronic Code Book mode (ECB)
• Image from Wikipedia (Link Ch 5a)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl15
ECB Advantages
•No block synchronization between sender and
receiver is required
•OK if some blocks are lost in transit
•Bit errors caused by noisy channels only affect the
corresponding block but not succeeding blocks
•Block cipher operating can be parallelized
•Advantage for high-speed implementations
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl16
ECB Disadvantages
•ECB encrypts highly deterministically
•Identical plaintexts result in identical ciphertexts
•An attacker recognizes if the same message has been
sent twice
•Simply by looking at the ciphertext: traffic analysis
•Plaintext blocks are encrypted independently of previous
blocks
•An attacker may reorder ciphertext blocks which
results in valid plaintext
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Substitution Attack on ECB
• Once a particular plaintext to ciphertext block mapping xi → yi is known, a
sequence of ciphertext blocks can easily be manipulated
• Consider an electronic bank transfer
• the encryption key between the two banks does not change too frequently
• The attacker sends $1.00 transfers from his account at bank A to his
account at bank B repeatedly
• He can check for ciphertext blocks that repeat, and he stores blocks 1,3
and 4 of these transfers
• He now simply replaces block 4 of other transfers with the block 4 that he
stored before
• all transfers from some account of bank A to some account of bank B are
redirected to go into the attacker’s B account!17
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Example of encrypting bitmaps in ECB mode
• Identical plaintexts are mapped to identical ciphertexts
• Statistical properties in the plaintext are preserved in the ciphertext
18
Example of encrypting bitmaps in ECB mode
Project 8
5.1.2 Cipher Block Chaining Mode (CBC)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Block Chaining mode (CBC)
•There are two main ideas behind the CBC mode:
•The encryption of all blocks are “chained together”
•ciphertext yi depends not only on block xi but on all
previous plaintext blocks as well
•The encryption is randomized by using an
initialization vector (IV)
21
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Block Chaining mode (CBC)
• Image from Wikipedia (Link Ch 5a)
22
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Block Chaining mode (CBC)
• Image from Wikipedia (Link Ch 5a)
23
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl24
Substitution Attack on CBC
• Consider the last example (electronic bank transfer)
• If the IV is properly chosen for every wire transfer, the attack
will not work at all
• If the IV is kept the same for several transfers, the attacker
would recognize the transfers from his account at bank A to
back B
• If we choose a new IV every time we encrypt, the CBC mode
becomes a probabilistic encryption scheme, i.e., two
encryptions of the same plaintext look entirely different
• It is not needed to keep the IV secret! It can be sent in
plaintext.
• But it should be unpredictable
5.1.3 Outbook Feedback Mode (OFB)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Output Feedback mode (OFB)
• It is used to build a synchronous stream cipher from a block cipher
• The key stream is not generated bitwise but instead in a blockwise fashion
• The output of the cipher gives us key stream bits Si with which we can encrypt
plaintext bits using the XOR operation
• Image from Wikipedia (Link Ch 5a)
26
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Output Feedback mode (OFB)
• Image from Wikipedia (Link Ch 5a)
27
5.1.4 Cipher Feedback Mode (CFB)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Feedback mode (CFB)
• It uses a block cipher as a building block for an asynchronous
stream cipher
similar to the OFB mode
• The key stream Si is generated in a blockwise fashion and is also a
function of the ciphertext
• As a result of the use of an IV, the CFB encryption is also
nondeterministic
• It can be used in situations where short plaintext blocks are to be
encrypted
29
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Feedback mode (CFB)
• Image from Wikipedia (Link Ch 5a)
30
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Cipher Feedback mode (CFB)
• Image from Wikipedia (Link Ch 5a)
31
5.1.5 Counter Mode (CTR)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Counter mode (CTR)
• It uses a block cipher as a stream cipher (like the OFB and CFB
modes)
• The key stream is computed in a blockwise fashion
• The input to the block cipher is a counter which assumes a different
value every time the block cipher computes a new key stream block
• Unlike CFB and OFB modes, the CTR mode can be parallelized since
the 2nd encryption can begin before the 1st one has finished
• Desirable for high-speed implementations, e.g., in network routers
33
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Counter mode (CTR)
• Image from Wikipedia (Link Ch 5a)
34
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Counter mode (CTR)
• Image from Wikipedia (Link Ch 5a)
35
5.1.6 Galois Counter Mode (GCM)
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl38
Galois Counter Mode (GCM)
• Encrypts data in CTR mode, but also computes a Message
Authentication Code (MAC)
• By making use of GCM, two additional services are provided:
• Message Authentication
• the receiver can make sure that the message was really created
by the original sender
• Message Integrity
• the receiver can make sure that nobody tampered with the
ciphertext during transmission
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Galois
Counter
Mode (GCM)
• Image from Wikipedia
(Link Ch 5b)
39
Chapter 5 of
Understanding
Cryptography by
Christof Paar
and Jan Pelzl
5.2 Exhaustive Key Search Revisited
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Exhaustive Key Search Revisited
• For DES, a 56-bit key encrypts a 64-bit block
• Only one key can decrypt a block
• In AES, a 128-bit or longer key encrypts a 128-bit block
• Only one key can decrypt a block
• If a cipher has a longer block size than key size, there's more than
one key that deciphers that block
• So several blocks must be tested to find the correct key
41
5.3 Increasing the Security of Block
Ciphers
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl43
Increasing the Security of Block Ciphers
• In some situations we wish to increase the security of
block ciphers
• e.g., if a cipher such as DES is available in
hardware or software for legacy reasons in a given
application
• For AES, there are already three security levels
• 128, 192, or 256-bit keys
• No realistic attacks known for any of those levels
• No reason to increase the security with these
methods
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl44
Increasing the Security of Block Ciphers
• Two approaches are possible
• Multiple encryption
•theoretically much more secure, but
sometimes in practice increases the security
very little
• Key whitening
•Adding two additional keys
5.3.1 Double Encryption and
Meet-in-the-Middle Attack
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Double Encryption
• A plaintext x is first encrypted with a key kL
• and the resulting ciphertext is encrypted again using a second key kR
• Assuming a key length of k bits, an exhaustive key search would
require 2k·2k = 22k encryptions or decryptions
46
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Meet-in-the-Middle Attack
• A Meet-in-the-Middle attack requires only 2k+2k = 2k+1 operations!
• It also requires 2k records of data storage for a look-up table
• Double encryption is not much more secure then single encryption!
47
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Meet-in-the-Middle Attack
• Phase I
• Brute-force the left half
• Save a table of middle values for each kL
• Phase II
• Brute-force the right half
• Find the kR value that matchs one of the middle values; that
determines kL
• Double encryption is not much more secure than single encryption!
number of encryptions and decryptions = 2k +2k = 2k+1
number of storage locations = 2k
48
5.3.2 Triple Encryption
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Triple Encryption
• Encrypt a block three times with three different keys
50
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Triple Encryption
• Meet-in-the-middle attack has one side with kL
• The other side has kR1 and kR2
51
Triple encryption effectively doubles the key length
5.3.3 Key Whitening
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Key Whitening
• Makes block ciphers such as DES much more resistant against brute-force
attacks
• In addition to the regular cipher key k, two whitening keys k1 and k2 are used
to XOR-mask the plaintext and ciphertext
53
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Key Whitening
• DESX uses key whitening to make DES stronger
• In addition to the regular cipher key k, adds a whitening key k1
• k2 is calculated from key k and k1
• Even advanced attacks still take 288 calculations
• AES already includes key whitening
• Using a subkey before the first round and after the last round
54
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
Quantum Computers
• Can crack a 128-bit key with only 264 calculations (Grover's algorithm)
• This is why AES has 192-bit and 256-bit modes
• They should still be unbreakable even when quantum computers become
available
• AES will remain secure
• Factoring a number becomes MUCH faster
• Exponential time changes to polynomial time (Schor's algorithm, link Ch
5c)
• Algorithms like RSA may become insecure, even for long keys
55
Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl56
Lessons Learned
• There are many different ways to encrypt with a block cipher. Each mode of operation has
some advantages and disadvantages
• Several modes turn a block cipher into a stream cipher
• There are modes that perform encryption together together with authentication, i.e., a
cryptographic checksum protects against message manipulation
• The straightforward ECB mode has security weaknesses, independent of the underlying
block cipher
• The counter mode allows parallelization of encryption and is thus suited for high speed
implementations
• Double encryption with a given block cipher only marginally improves the resistance against
brute-force attacks
• Triple encryption with a given block cipher roughly doubles the key length
• Triple DES (3DES) has an effective key length of 112 bits
• Key whitening enlarges the DES key length without much computational overhead.
Modular Arithmetic
Multiplication and Multiplicative Inverses
Modulus 9
0 mod 9 = 0
1 mod 9 = 1
2 mod 9 = 2
3 mod 9 = 3
4 mod 9 = 4
5 mod 9 = 5
6 mod 9 = 6
7 mod 9 = 7
8 mod 9 = 8
0
1
2
3
5
6
8
7
4
9 mod 9 = 0
10 mod 9 = 1
11 mod 9 = 2
12 mod 9 = 3
13 mod 9 = 4
14 mod 9 = 5
15 mod 9 = 6
16 mod 9 = 7
17 mod 9 = 8
Modulus 9
2 * 9 mod 9 = (2 mod 9) * (0 mod 9) = 2 * 0 = 0
2 * 10 mod 9 = (2 mod 9) * (10 mod 9) = 2 * 1 = 2
0
1
2
3
5
6
8
7
4
Modulus 9
2 * 9 mod 9 = (2 mod 9) * (0 mod 9) = 2 * 0 = 0
2 * 10 mod 9 = (2 mod 9) * (10 mod 9) = 2 * 1 = 2
2 * 5 mod 9 = (2 mod 9) * (5 mod 9) = 2 * 5 = 10 = 1
5 is the multiplicative inverse of 2, mod 9
0
1
2
3
5
6
8
7
4
Modulus 9
6 * 1 mod 9 = 6
6 * 2 mod 9 = 3
6 * 3 mod 9 = 0
6 * 4 mod 9 = 6
6 * 5 mod 9 = 3
6 * 6 mod 9 = 0
6 * 7 mod 9 = 6
6 * 8 mod 9 = 3
6 has no inverse mod 9
0
1
2
3
5
6
8
7
4
Modulus 9
7 * 1 mod 9 = 7
7 * 2 mod 9 = 5
7 * 3 mod 9 = 3
7 * 4 mod 9 = 1
4 is the multiplicative inverse of 7 mod 9
0
1
2
3
5
6
8
7
4
Modulus 4
0 mod 4 = 0
1 mod 4 = 1
2 mod 4 = 2
3 mod 4 = 3
4 mod 4 = 0
5 mod 4 = 1
12 mod 4 = 0
13 mod 4 = 1
0
1
2
3
CNIT 141: 5. More About Block Ciphers + Modular Arithmetic 2

Contenu connexe

Tendances

Network security R.Rathna Deepa 2nd M.sc.,Computer Science
Network security R.Rathna Deepa 2nd M.sc.,Computer ScienceNetwork security R.Rathna Deepa 2nd M.sc.,Computer Science
Network security R.Rathna Deepa 2nd M.sc.,Computer ScienceRathnaDeepa1
 
Modern symmetric cipher
Modern symmetric cipherModern symmetric cipher
Modern symmetric cipherRupesh Mishra
 
CRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYCRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYKathirvel Ayyaswamy
 
Network Security UNIT-II
Network Security UNIT-IINetwork Security UNIT-II
Network Security UNIT-IIrathnadeepa2
 
Block Cipher and its Design Principles
Block Cipher and its Design PrinciplesBlock Cipher and its Design Principles
Block Cipher and its Design PrinciplesSHUBHA CHATURVEDI
 
Cryptographic algorithms
Cryptographic algorithmsCryptographic algorithms
Cryptographic algorithmsAnamika Singh
 
Block Cipher Modes of Operation And Cmac For Authentication
Block Cipher Modes of Operation And Cmac For AuthenticationBlock Cipher Modes of Operation And Cmac For Authentication
Block Cipher Modes of Operation And Cmac For AuthenticationVittorio Giovara
 
Symmetric ciphers questions and answers
Symmetric ciphers questions and answersSymmetric ciphers questions and answers
Symmetric ciphers questions and answersprdpgpt
 
Next generation block ciphers
Next generation block ciphersNext generation block ciphers
Next generation block ciphersRoman Oliynykov
 
AES by example
AES by exampleAES by example
AES by exampleShiraz316
 
I mage encryption using rc5
I mage encryption using rc5I mage encryption using rc5
I mage encryption using rc5Suramrit Singh
 
Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Mohamed Loey
 
Network Security - Block cipher
Network Security - Block cipherNetwork Security - Block cipher
Network Security - Block cipherAshish Duggal
 

Tendances (20)

Unit 2
Unit 2Unit 2
Unit 2
 
Ch05
Ch05Ch05
Ch05
 
Symmetric
SymmetricSymmetric
Symmetric
 
Symmetric encryption
Symmetric encryptionSymmetric encryption
Symmetric encryption
 
Network security R.Rathna Deepa 2nd M.sc.,Computer Science
Network security R.Rathna Deepa 2nd M.sc.,Computer ScienceNetwork security R.Rathna Deepa 2nd M.sc.,Computer Science
Network security R.Rathna Deepa 2nd M.sc.,Computer Science
 
Modern symmetric cipher
Modern symmetric cipherModern symmetric cipher
Modern symmetric cipher
 
CRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYCRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITY
 
Cryptography
CryptographyCryptography
Cryptography
 
Network Security UNIT-II
Network Security UNIT-IINetwork Security UNIT-II
Network Security UNIT-II
 
RC4&RC5
RC4&RC5RC4&RC5
RC4&RC5
 
Block Cipher and its Design Principles
Block Cipher and its Design PrinciplesBlock Cipher and its Design Principles
Block Cipher and its Design Principles
 
Cryptographic algorithms
Cryptographic algorithmsCryptographic algorithms
Cryptographic algorithms
 
Block Cipher Modes of Operation And Cmac For Authentication
Block Cipher Modes of Operation And Cmac For AuthenticationBlock Cipher Modes of Operation And Cmac For Authentication
Block Cipher Modes of Operation And Cmac For Authentication
 
Symmetric ciphers questions and answers
Symmetric ciphers questions and answersSymmetric ciphers questions and answers
Symmetric ciphers questions and answers
 
Next generation block ciphers
Next generation block ciphersNext generation block ciphers
Next generation block ciphers
 
AES by example
AES by exampleAES by example
AES by example
 
I mage encryption using rc5
I mage encryption using rc5I mage encryption using rc5
I mage encryption using rc5
 
Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1
 
Network Security - Block cipher
Network Security - Block cipherNetwork Security - Block cipher
Network Security - Block cipher
 
An effective RC4 Stream Cipher
An effective RC4 Stream CipherAn effective RC4 Stream Cipher
An effective RC4 Stream Cipher
 

Similaire à CNIT 141: 5. More About Block Ciphers + Modular Arithmetic 2

Ciphers modes
Ciphers modesCiphers modes
Ciphers modesAsad Ali
 
Block Cipher and Operation Modes
Block Cipher  and Operation Modes Block Cipher  and Operation Modes
Block Cipher and Operation Modes SHUBHA CHATURVEDI
 
Comparative analysis on different DES model
Comparative analysis on different DES modelComparative analysis on different DES model
Comparative analysis on different DES modelSaeed Siddik
 
SymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdfSymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdfMohammedMorhafJaely
 
Information and data security block cipher operation
Information and data security block cipher operationInformation and data security block cipher operation
Information and data security block cipher operationMazin Alwaaly
 
Data Encryption Standard (DES)
Data Encryption Standard (DES)Data Encryption Standard (DES)
Data Encryption Standard (DES)Haris Ahmed
 
DES-lecture (1).ppt
DES-lecture (1).pptDES-lecture (1).ppt
DES-lecture (1).pptMrsPrabhaBV
 
block ciphermodes of operation.pptx
block ciphermodes of operation.pptxblock ciphermodes of operation.pptx
block ciphermodes of operation.pptxDEEPAK948083
 
Block cipher modes of operation
Block cipher modes of operation Block cipher modes of operation
Block cipher modes of operation harshit chavda
 
Information Security
Information SecurityInformation Security
Information Securityraxosz
 
Topic21 Elect. Codebook, Cipher Block Chaining.pptx
Topic21 Elect. Codebook, Cipher Block Chaining.pptxTopic21 Elect. Codebook, Cipher Block Chaining.pptx
Topic21 Elect. Codebook, Cipher Block Chaining.pptxShimoFcis
 
Module 2.pptx
Module 2.pptxModule 2.pptx
Module 2.pptxseethal9
 
Block cipher modes of operations
Block cipher modes of operationsBlock cipher modes of operations
Block cipher modes of operationsAkashRanjandas1
 

Similaire à CNIT 141: 5. More About Block Ciphers + Modular Arithmetic 2 (20)

Ciphers modes
Ciphers modesCiphers modes
Ciphers modes
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
 
Block Cipher and Operation Modes
Block Cipher  and Operation Modes Block Cipher  and Operation Modes
Block Cipher and Operation Modes
 
Comparative analysis on different DES model
Comparative analysis on different DES modelComparative analysis on different DES model
Comparative analysis on different DES model
 
SymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdfSymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdf
 
Information and data security block cipher operation
Information and data security block cipher operationInformation and data security block cipher operation
Information and data security block cipher operation
 
Block Cipher
Block CipherBlock Cipher
Block Cipher
 
Data Encryption Standard (DES)
Data Encryption Standard (DES)Data Encryption Standard (DES)
Data Encryption Standard (DES)
 
DEC algorithm
DEC algorithmDEC algorithm
DEC algorithm
 
13528 l8
13528 l813528 l8
13528 l8
 
DES-lecture (1).ppt
DES-lecture (1).pptDES-lecture (1).ppt
DES-lecture (1).ppt
 
block ciphermodes of operation.pptx
block ciphermodes of operation.pptxblock ciphermodes of operation.pptx
block ciphermodes of operation.pptx
 
Block cipher modes of operation
Block cipher modes of operation Block cipher modes of operation
Block cipher modes of operation
 
Information Security
Information SecurityInformation Security
Information Security
 
Topic21 Elect. Codebook, Cipher Block Chaining.pptx
Topic21 Elect. Codebook, Cipher Block Chaining.pptxTopic21 Elect. Codebook, Cipher Block Chaining.pptx
Topic21 Elect. Codebook, Cipher Block Chaining.pptx
 
Module 2.pptx
Module 2.pptxModule 2.pptx
Module 2.pptx
 
Block cipher modes of operations
Block cipher modes of operationsBlock cipher modes of operations
Block cipher modes of operations
 
4.ppt
4.ppt4.ppt
4.ppt
 
Encryption
EncryptionEncryption
Encryption
 
ch06.ppt
ch06.pptch06.ppt
ch06.ppt
 

Plus de Sam Bowne

3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities Sam Bowne
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the ApplicationSam Bowne
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)Sam Bowne
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic CurvesSam Bowne
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-HellmanSam Bowne
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1Sam Bowne
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android ApplicationsSam Bowne
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3Sam Bowne
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard ProblemsSam Bowne
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)Sam Bowne
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis MethodologySam Bowne
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated EncryptionSam Bowne
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)Sam Bowne
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)Sam Bowne
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream CiphersSam Bowne
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data CollectionSam Bowne
 

Plus de Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 

Dernier

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Dernier (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

CNIT 141: 5. More About Block Ciphers + Modular Arithmetic 2

  • 1. Understanding Cryptography – A Textbook for Students and Practitioners by Christof Paar and JanPelzl www.crypto-textbook.com Chapter 5 – More About Block Ciphers ver. November 26, 2010 These slides were prepared by Amir Moradi, Christof Paar and Jan Pelzl And modified by Sam Bowne Last modified 10-2-17
  • 2. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl2 Some legal stuff (sorry): Terms of Use • The slides can used free of charge. All copyrights for the slides remain with Christof Paar and Jan Pelzl. • The title of the accompanying book “Understanding Cryptography” by Springer and the author’s names must remain on each slide. • If the slides are modified, appropriate credits to the book authors and the book title must remain within the slides. • It is not permitted to reproduce parts or all of the slides in printed form whatsoever without written consent by the authors.
  • 3. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl3 Contents • 5.1 Encryption with Block Ciphers: Modes of Operation • Electronic Code Book mode (ECB) • Cipher Block Chaining mode (CBC) • Output Feedback mode (OFB) • Cipher Feedback mode (CFB) • Counter mode (CTR) • Galois Counter Mode (GCM) • 5.2 Exhaustive Key Search Revisited • 5.3 Increasing the Security of Block Ciphers Modular Arithmetic: Multiplication and Multiplicative Inverses
  • 4.
  • 5. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl5 Block Ciphers • A block cipher is much more than just an encryption algorithm, it can be used ... • to build different types of block-based encryption schemes • to realize stream ciphers • to construct hash functions • to make message authentication codes • to build key establishment protocols • to make a pseudo-random number generator • ... • The security of block ciphers also can be increased by • key whitening • multiple encryption
  • 6. 5.1 Encryption with Block Ciphers: Modes of Operation
  • 7. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl7 Encryption with Block Ciphers • There are several ways of encrypting long plaintexts, e.g., an e-mail or a computer file, with a block cipher (“modes of operation”) • Electronic Code Book mode (ECB) • Cipher Block Chaining mode (CBC) • Output Feedback mode (OFB) • Cipher Feedback mode (CFB) • Counter mode (CTR) • Galois Counter Mode (GCM) • All of the 6 modes provide confidentiality • They may also provide authenticity and integrity: • Is the message really coming from the original sender? (authenticity) • Was the ciphertext altered during transmission? (integrity)
  • 8. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl8 Block Size •ECB and CBC require plaintext that's an exact multiple of the block size •Otherwise, plaintext must be padded •CFB, OFB and CTR modes use a block cipher to create a stream cipher •Error on page 124: CFB -> CBC (Link Ch 5a)
  • 9. Block Size • ECB and CBC require plaintext that's an exact multiple of the block size •CBC in Python
  • 10. Block Size • CFB, OFB and CTR modes use a block cipher to create a stream cipher • Works for CFB and CTR but not OFB
  • 11. A Bug in Python • Link Ch 4d
  • 13. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Electronic Code Book mode (ECB) • Messages which exceed b bits are partitioned into b-bit blocks • Each Block is encrypted separately • Image from Wikipedia (Link Ch 5a)
  • 14. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Electronic Code Book mode (ECB) • Image from Wikipedia (Link Ch 5a)
  • 15. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl15 ECB Advantages •No block synchronization between sender and receiver is required •OK if some blocks are lost in transit •Bit errors caused by noisy channels only affect the corresponding block but not succeeding blocks •Block cipher operating can be parallelized •Advantage for high-speed implementations
  • 16. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl16 ECB Disadvantages •ECB encrypts highly deterministically •Identical plaintexts result in identical ciphertexts •An attacker recognizes if the same message has been sent twice •Simply by looking at the ciphertext: traffic analysis •Plaintext blocks are encrypted independently of previous blocks •An attacker may reorder ciphertext blocks which results in valid plaintext
  • 17. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Substitution Attack on ECB • Once a particular plaintext to ciphertext block mapping xi → yi is known, a sequence of ciphertext blocks can easily be manipulated • Consider an electronic bank transfer • the encryption key between the two banks does not change too frequently • The attacker sends $1.00 transfers from his account at bank A to his account at bank B repeatedly • He can check for ciphertext blocks that repeat, and he stores blocks 1,3 and 4 of these transfers • He now simply replaces block 4 of other transfers with the block 4 that he stored before • all transfers from some account of bank A to some account of bank B are redirected to go into the attacker’s B account!17
  • 18. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Example of encrypting bitmaps in ECB mode • Identical plaintexts are mapped to identical ciphertexts • Statistical properties in the plaintext are preserved in the ciphertext 18
  • 19. Example of encrypting bitmaps in ECB mode Project 8
  • 20. 5.1.2 Cipher Block Chaining Mode (CBC)
  • 21. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Block Chaining mode (CBC) •There are two main ideas behind the CBC mode: •The encryption of all blocks are “chained together” •ciphertext yi depends not only on block xi but on all previous plaintext blocks as well •The encryption is randomized by using an initialization vector (IV) 21
  • 22. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Block Chaining mode (CBC) • Image from Wikipedia (Link Ch 5a) 22
  • 23. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Block Chaining mode (CBC) • Image from Wikipedia (Link Ch 5a) 23
  • 24. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl24 Substitution Attack on CBC • Consider the last example (electronic bank transfer) • If the IV is properly chosen for every wire transfer, the attack will not work at all • If the IV is kept the same for several transfers, the attacker would recognize the transfers from his account at bank A to back B • If we choose a new IV every time we encrypt, the CBC mode becomes a probabilistic encryption scheme, i.e., two encryptions of the same plaintext look entirely different • It is not needed to keep the IV secret! It can be sent in plaintext. • But it should be unpredictable
  • 26. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Output Feedback mode (OFB) • It is used to build a synchronous stream cipher from a block cipher • The key stream is not generated bitwise but instead in a blockwise fashion • The output of the cipher gives us key stream bits Si with which we can encrypt plaintext bits using the XOR operation • Image from Wikipedia (Link Ch 5a) 26
  • 27. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Output Feedback mode (OFB) • Image from Wikipedia (Link Ch 5a) 27
  • 28. 5.1.4 Cipher Feedback Mode (CFB)
  • 29. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Feedback mode (CFB) • It uses a block cipher as a building block for an asynchronous stream cipher similar to the OFB mode • The key stream Si is generated in a blockwise fashion and is also a function of the ciphertext • As a result of the use of an IV, the CFB encryption is also nondeterministic • It can be used in situations where short plaintext blocks are to be encrypted 29
  • 30. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Feedback mode (CFB) • Image from Wikipedia (Link Ch 5a) 30
  • 31. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Cipher Feedback mode (CFB) • Image from Wikipedia (Link Ch 5a) 31
  • 33. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Counter mode (CTR) • It uses a block cipher as a stream cipher (like the OFB and CFB modes) • The key stream is computed in a blockwise fashion • The input to the block cipher is a counter which assumes a different value every time the block cipher computes a new key stream block • Unlike CFB and OFB modes, the CTR mode can be parallelized since the 2nd encryption can begin before the 1st one has finished • Desirable for high-speed implementations, e.g., in network routers 33
  • 34. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Counter mode (CTR) • Image from Wikipedia (Link Ch 5a) 34
  • 35. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Counter mode (CTR) • Image from Wikipedia (Link Ch 5a) 35
  • 36.
  • 37. 5.1.6 Galois Counter Mode (GCM)
  • 38. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl38 Galois Counter Mode (GCM) • Encrypts data in CTR mode, but also computes a Message Authentication Code (MAC) • By making use of GCM, two additional services are provided: • Message Authentication • the receiver can make sure that the message was really created by the original sender • Message Integrity • the receiver can make sure that nobody tampered with the ciphertext during transmission
  • 39. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Galois Counter Mode (GCM) • Image from Wikipedia (Link Ch 5b) 39 Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl
  • 40. 5.2 Exhaustive Key Search Revisited
  • 41. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Exhaustive Key Search Revisited • For DES, a 56-bit key encrypts a 64-bit block • Only one key can decrypt a block • In AES, a 128-bit or longer key encrypts a 128-bit block • Only one key can decrypt a block • If a cipher has a longer block size than key size, there's more than one key that deciphers that block • So several blocks must be tested to find the correct key 41
  • 42. 5.3 Increasing the Security of Block Ciphers
  • 43. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl43 Increasing the Security of Block Ciphers • In some situations we wish to increase the security of block ciphers • e.g., if a cipher such as DES is available in hardware or software for legacy reasons in a given application • For AES, there are already three security levels • 128, 192, or 256-bit keys • No realistic attacks known for any of those levels • No reason to increase the security with these methods
  • 44. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl44 Increasing the Security of Block Ciphers • Two approaches are possible • Multiple encryption •theoretically much more secure, but sometimes in practice increases the security very little • Key whitening •Adding two additional keys
  • 45. 5.3.1 Double Encryption and Meet-in-the-Middle Attack
  • 46. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Double Encryption • A plaintext x is first encrypted with a key kL • and the resulting ciphertext is encrypted again using a second key kR • Assuming a key length of k bits, an exhaustive key search would require 2k·2k = 22k encryptions or decryptions 46
  • 47. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Meet-in-the-Middle Attack • A Meet-in-the-Middle attack requires only 2k+2k = 2k+1 operations! • It also requires 2k records of data storage for a look-up table • Double encryption is not much more secure then single encryption! 47
  • 48. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Meet-in-the-Middle Attack • Phase I • Brute-force the left half • Save a table of middle values for each kL • Phase II • Brute-force the right half • Find the kR value that matchs one of the middle values; that determines kL • Double encryption is not much more secure than single encryption! number of encryptions and decryptions = 2k +2k = 2k+1 number of storage locations = 2k 48
  • 50. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Triple Encryption • Encrypt a block three times with three different keys 50
  • 51. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Triple Encryption • Meet-in-the-middle attack has one side with kL • The other side has kR1 and kR2 51 Triple encryption effectively doubles the key length
  • 53. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Key Whitening • Makes block ciphers such as DES much more resistant against brute-force attacks • In addition to the regular cipher key k, two whitening keys k1 and k2 are used to XOR-mask the plaintext and ciphertext 53
  • 54. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Key Whitening • DESX uses key whitening to make DES stronger • In addition to the regular cipher key k, adds a whitening key k1 • k2 is calculated from key k and k1 • Even advanced attacks still take 288 calculations • AES already includes key whitening • Using a subkey before the first round and after the last round 54
  • 55. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl Quantum Computers • Can crack a 128-bit key with only 264 calculations (Grover's algorithm) • This is why AES has 192-bit and 256-bit modes • They should still be unbreakable even when quantum computers become available • AES will remain secure • Factoring a number becomes MUCH faster • Exponential time changes to polynomial time (Schor's algorithm, link Ch 5c) • Algorithms like RSA may become insecure, even for long keys 55
  • 56. Chapter 5 of Understanding Cryptography by Christof Paar and Jan Pelzl56 Lessons Learned • There are many different ways to encrypt with a block cipher. Each mode of operation has some advantages and disadvantages • Several modes turn a block cipher into a stream cipher • There are modes that perform encryption together together with authentication, i.e., a cryptographic checksum protects against message manipulation • The straightforward ECB mode has security weaknesses, independent of the underlying block cipher • The counter mode allows parallelization of encryption and is thus suited for high speed implementations • Double encryption with a given block cipher only marginally improves the resistance against brute-force attacks • Triple encryption with a given block cipher roughly doubles the key length • Triple DES (3DES) has an effective key length of 112 bits • Key whitening enlarges the DES key length without much computational overhead.
  • 57.
  • 58. Modular Arithmetic Multiplication and Multiplicative Inverses
  • 59. Modulus 9 0 mod 9 = 0 1 mod 9 = 1 2 mod 9 = 2 3 mod 9 = 3 4 mod 9 = 4 5 mod 9 = 5 6 mod 9 = 6 7 mod 9 = 7 8 mod 9 = 8 0 1 2 3 5 6 8 7 4 9 mod 9 = 0 10 mod 9 = 1 11 mod 9 = 2 12 mod 9 = 3 13 mod 9 = 4 14 mod 9 = 5 15 mod 9 = 6 16 mod 9 = 7 17 mod 9 = 8
  • 60. Modulus 9 2 * 9 mod 9 = (2 mod 9) * (0 mod 9) = 2 * 0 = 0 2 * 10 mod 9 = (2 mod 9) * (10 mod 9) = 2 * 1 = 2 0 1 2 3 5 6 8 7 4
  • 61. Modulus 9 2 * 9 mod 9 = (2 mod 9) * (0 mod 9) = 2 * 0 = 0 2 * 10 mod 9 = (2 mod 9) * (10 mod 9) = 2 * 1 = 2 2 * 5 mod 9 = (2 mod 9) * (5 mod 9) = 2 * 5 = 10 = 1 5 is the multiplicative inverse of 2, mod 9 0 1 2 3 5 6 8 7 4
  • 62. Modulus 9 6 * 1 mod 9 = 6 6 * 2 mod 9 = 3 6 * 3 mod 9 = 0 6 * 4 mod 9 = 6 6 * 5 mod 9 = 3 6 * 6 mod 9 = 0 6 * 7 mod 9 = 6 6 * 8 mod 9 = 3 6 has no inverse mod 9 0 1 2 3 5 6 8 7 4
  • 63. Modulus 9 7 * 1 mod 9 = 7 7 * 2 mod 9 = 5 7 * 3 mod 9 = 3 7 * 4 mod 9 = 1 4 is the multiplicative inverse of 7 mod 9 0 1 2 3 5 6 8 7 4
  • 64. Modulus 4 0 mod 4 = 0 1 mod 4 = 1 2 mod 4 = 2 3 mod 4 = 3 4 mod 4 = 0 5 mod 4 = 1 12 mod 4 = 0 13 mod 4 = 1 0 1 2 3