44
“Introduction to Block Ciphers“ Seminar “Block Cipher Cryptanalysis“ Summer 2011 Tim Syben 18.04.2011

“Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

Embed Size (px)

Citation preview

Page 1: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

“Introduction to Block Ciphers“

Seminar

“Block Cipher Cryptanalysis“

Summer 2011

Tim Syben

18.04.2011

Page 2: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 2Introduction to Block Ciphers

Agenda

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 3: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 3

Block Cipher

• Symmetric key cipher

• Operates on fixed-length groups of bits (block)

• Typical block size: 64 bit or 128 bit

Symmetric encryption [can06]

Page 4: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 4

Anatomy of a Block Cipher

General approach of most block cipher designs:

• Round function

• Repeated several times (rounds)

• First round takes n-bit plaintext as input

• Last round outputs n-bit cipher text

• Each round depends on a roundkey

• Derived from k-bit secret key (key schedule)

• Has to be bijective

Two Examples

1. Feistel ciphers

2. SP Networks

Page 5: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 5

Feistel Cipher vs. SP Network

Feistel cipher and SP network [can06]

Page 6: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 6Introduction to Block Ciphers

Feistel Cipher

Examples of Block Ciphers using a Feistel structure:

• DES

• Published 1977

• Designed by IBM

• Blowfish

• Published 1992

• Designed by Bruce Schneier

• RC5

• Published 1994

• Designed by Ron Rivest

Page 7: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 7Introduction to Block Ciphers

SP Network

Examples of Block Ciphers using a SP Network structure:

• AES (Rijndael)

• Published 1998

• Designed by Vincent Rijmen and Joan Daemen

• CAST-128

• Published 1996

• Designed by Carlisle Adams and Stafford Tavares

• IDEA

• Published 1991

• Designed by Xuejia Lai and James Massey

Page 8: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 8Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 9: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 9

Stream Cipher

• Symmetric key cipher

• Input is a continuous stream of plaintext

• Single bit will be encrypted one by one

Stream encryption [can06]

Page 10: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 10

Stream Cipher

Examples:

• One Time Pad

• 1917

• A5/1

• Developed 1987

• Used in the GSM standard

Stream encryption [can06]

Page 11: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 11

Block Cipher vs. Stream Cipher

Block encryption (ECB) [can06]

Stream encryption [can06]

Page 12: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 12Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 13: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 13

Modes of Operation

• Defines a way how to encrypt arbitrary-length messages using a block cipher

• Devide message into blocks – encrypt each of them independently

• Last block has to be extended to match block size

• Padding

• Some modes need an additional input value

• Initialisation vector

Page 14: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 14

Padding

• Various padding schemes

• Zero Padding

… | 1100 0110 1001 0101 1011 0101 0000 0000 |

… | 1A 45 AE 56 9B DD 5D FF | 26 14 FC FC 00 00 00 00 |

• Ansi X.923

… | 1A 45 AE 56 9B DD 5D FF | 26 14 FC FC 00 00 00 04 |

• ISO 11026

… | 1A 45 AE 56 9B DD 5D FF | 26 14 FC FC 81 A6 23 04 |

Page 15: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 15

Padding

• Good padding scheme

• Generate random bits/bytes

• End of message is clear

• Choice of padding scheme affects the security

Page 16: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 16

Initialization Vector

• Fixed-size input value

• Requires to be random or pseudorandom

• A good initialization vector should be

• Unique

• Unpredictable

Page 17: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 17Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 18: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 18

Electronic Code Book (ECB)

Pictures from Wikimedia Commons

Page 19: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 19

Electronic Code Book (ECB)

• Advantages

• En-/decryption of each block could

be parallelized

• Disadvantages

• Two blocks with identical plaintext

produces identical ciphertext

• Bit error in one block affect the

whole block

• Plaintext patterns are still visible

after encryption

Page 20: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 20

Electronic Code Book (ECB)

Other mode encryptionECB-Mode encryptionOriginal

Page 21: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 21

Summary

• Most naive mode of operation

• En-/decryption of a block does not depend on the successor or predecessor

• Not suitable for encryption of messages bigger than one block

Electronic Code Book (ECB)

Page 22: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 22Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 23: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 23

Cipher Block Chaining (CBC)

Pictures from Wikimedia Commons

Page 24: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 24

• Advantages

• Decryption could be parallelized

• Different initialization vectors

• Different ciphertext

• Plaintext patterns are blurred

• Disadvantages

• Encryption has to be done sequential

• Bit error in one block effects two

blocks

Cipher Block Chaining (CBC)

Page 25: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 25

Summary

• CBC-Mode was invented to eliminate the disadvantages of the ECB-Mode

• Equal messages produce different cipher text by using different initialization

vectors

• Encryption of a plaintext block depends on this block and its predecessor

Cipher Block Chaining (CBC)

Page 26: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 26Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 27: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 27

Output Feedback Mode (OFB)

Pictures from Wikimedia Commons

Page 28: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 28

• Advantages

• Keystream can be pre-computed

• No padding

• Bit error only affect one bit

• Disadvantages

• Keystream computation cannot be

parallelized

• Reusing of key an initialization vector

is dangerous

• Bit-flipping attacks are easy

Output Feedback Mode (OFB)

Page 29: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 29

Summary

• Combines a block cipher with a stream cipher

• Needs an initialization vector

• Uses same function for encryption and decryption

• Makes it possible to choose the faster function

• Makes it possible to use one-way-functions

• Pre-calculation possible

Output Feedback Mode (OFB)

Page 30: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 30Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 31: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 31

Cipher Feedback Mode (CFB)

Pictures from Wikimedia Commons

Page 32: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 32

• Advantages

• No padding

• Bit error only affects one bit

• Decryption can be parallelized

• Disadvantages

• Bit-flipping attacks are easy

• Encryption cannot be parallelized

• No pre-computation of the keystream

Cipher Feedback Mode (CFB)

Page 33: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 33

Summary

• Similar to OFB-Mode

• Combines a block cipher with a stream cipher

• Needs an initialization vector

• Uses same function for encryption an decryption

• Makes it possible to choose the faster function

• Makes it possible to use one-way-functions

• Encryption of a plaintext block depends on its predecessors

Cipher Feedback Mode (CFB)

Page 34: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 34Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 35: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 35

Counter Mode (CTR)

Pictures from Wikimedia Commons

Page 36: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 36

• Advantages

• En-/decryption of each block could

be parallelized

• No padding

• Keystream can be pre-computed

• Can be done in parallel

• Disadvantages

• Bit-flipping attacks are easy

• Reusing of key and nonce/counter is

dangerous

Counter Mode (CTR)

Page 37: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 37

Summary

• Combines a block cipher with a stream cipher

• Just as in the ECB mode en-/decryption of a block does not depend on the

successor or predecessor

Counter Mode (CTR)

Page 38: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 38Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 39: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 39

Summary

Now, we should all be able to give a short answer to these questions:

• What is a block cipher?

• What are the differences between a block cipher and a stream cipher?

• For what do we need Modes of operation?

Page 40: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 40

Summary

And we all know 5 modes of operation:

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

Page 41: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 41Introduction to Block Ciphers

Overview

• Block Cipher

• Stream Cipher

• Modes of Operation

• Electronic Code Book (ECB)

• Cipher Block Chaining (CBC)

• Output Feedback Mode (OFB)

• Cipher Feedback Mode (CFB)

• Counter Mode (CTR)

• Summery

• Conclusion

Page 42: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 42

Conclusion

Security of a block cipher always depends on:

• Choice of the cipher itself

• Choice of mode of operation

• Choice of padding scheme

• Choice of initialization vector

Page 43: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

18.04.2011 Introduction to Block Ciphers 43

References

• [kat08] J. Katz and Y. Lindell – Introduction to Modern Cryptography,

Chapman & Hall/CRC, 2008

• [wob01] Reinhard Wobst – Abenteuer Kryptologie, Addison-Wesley, 2001

• [can06] Christophe de Canniere, Alex Biryukov and Bart Preneel – „An

Introduction of Block Cipher Cryptanalysis“, Proceedings of the IEEE,

02.2006

Page 44: “Introduction to Block Ciphers“ - uni-bonn.de · 18.04.2011 Introduction to Block Ciphers 4 ... J. Katz and Y. Lindell –Introduction to Modern Cryptography, ... Introduction

Thank you!

Questions?