Lecture 04 - AES - Block Cipher Operations
Lecture 04 - AES - Block Cipher Operations
NT219 - CRYPTOGRAPHY
Today:
• Block cipher security
• 2DES, 3DES
• AES
• Block cipher Operation
Reading:
• CS Chapter 6, 7
NT219 – Cryptography
v.2020.1
[email protected] 2
Learning objectives
Overview
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 3
Block ciphers Security
DES security
Important points:
• Very open, public process
• No secret modifications More trust!
• Not rushed
NT219 – Cryptography
v.2020.1
[email protected] 7
AES Encryption Process
AES
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 8
AES Encryption Process
AES
in0
in1
in4
in5
in8
in9
in12
in13
s0,0
s1,0
s0,1
s1,1
s0,2
s1,2
s0,3
s1,3
○ Input: 128-bit block (is depicted as
in2 in6 in10 in14 s2,0 s2,1 s2,2 s2,3
a 4*4 square matrix of bytes)
in3 in7 in11 in15 s3,0 s3,1 s3,2 s3,3
s1,0
s0,1
s1,1
s0,2
s1,2
s0,3
s1,3
out0 out4 out8 out12
k1
k2
k5
k6
k9
k10
k13
k14
○ Key is also depicted as a square
k3 k7 k11 k15
matrix of bytes.
• Then expanded into an array of key
w0 w1 w2 • • • w42 w43 schedule words
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 9
AES Parameters
AES
○ The cipher consists of N rounds, where the number of rounds depends on the key length: 10
rounds for a 16-byte key, 12 rounds for a 24-byte key, and 14 rounds for a 32-byte key
○ The first N - 1 rounds consist of four distinct transformation functions: SubBytes, ShiftRows,
MixColumns, and AddRoundKey, which are described subsequently.
○ The final round contains only three transformations, and there is an initial single transformation
(AddRoundKey) before the first round, which can be considered Round 0
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 10
AES cipher in more detail
AES
○ Efficiency
• Works on byte/word units: Efficient in software!
• Widespread standard → special fast CPU instructions now
• Intel AES-NI instructions: over 10 gigabits/sec on a single core!
• OpenSSL
NT219 – Cryptography
v.2020.1
[email protected] 12
Block Cipher Modes
Encrypt muliple blocks
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 13
Electronic Codebook (ECB) Mode
Encrypting plaintext longer than one block
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 14
Cipher Block Chaining (CBC) Mode
How to overcome the security deficiencies of ECB?
○ IV must be random
• Transmit with ciphertext
• the specific choice of IV is unimportant
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 15
Cipher Block Chaining (CBC) Mode
Limitations
○ Questions
• If transmission error in ciphertext block, how
many errors in recovered plaintext?
• If 500 MB encrypted, how can you decrypt
the second half?
• What if input is not a multiple of block size?
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 16
Padding
What if input is not a multiple of block size?
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 17
Quiz
ECB and CBC
○ Encrypt the following image in two modes: ECB and CBC (You will do in Lab 2)
A B
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 18
Cipher Feedback (CFB) Mode (s-bit)
s-bit CFB encryption
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 19
Cipher Feedback (CFB) Mode (s-bit)
s-bit CFB decryption
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 20
Output Feedback (OFB) Mode
Similar in structure to CFB
○ The nonce (IV) must be unique to each execution. Why?
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 21
Counter (CTR) Mode
Block cipher makes a “pseudo random one-time pad”
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 23
Key terms
Things to remember
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 24
Homework 03 à Lab 2: Block cipher operations
Learn by practice
○ Work in team.
○ Tasks: SEED Lab - Secret-Key Encryption
• Description: https://seedsecuritylabs.org/Labs_20.04/Crypto/Crypto_Encryption/
Mandatory tasks:
• Task 2: Encryption using Different Ciphers and Modes
• Task 3: Encryption Mode – ECB vs. CBC
• Task 4: Padding
• Task 5: Error Propagation – Corrupted Cipher Text
Optional (bonus points)
• Task 6: Initial Vector (IV)
• Task 7: Programming using the Crypto Library
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 25
For next class…
Looking ahead
NT219 – Cryptography
v.2020.1
04. Block cipher Operation [email protected] 26
Today end,
Congrats!
Hoa Nguyen-Thanh
[email protected]
NT219 - Cryptography