Chapter Four
Chapter Four
College of Engineering
Department of Software Engineering
Data Security
Academic year 2018-2019
4th Year Material
Chapter Four
The criteria defined by NIST for selecting AES fall into three areas:
i. Security: The main emphasis was on security, NIST explicitly
demanded a 128 bit key, this criterion focused on resistance to
cryptanalysis attacks other than brute force attack.
2
Rounds
AES is a non-Feistel cipher that encrypts and decrypts a data block of
128 bits. It uses 10, 12, or 14 rounds. The key size, which can be 128,
192, or 256 bits, depends on the number of rounds.
The encryption algorithm and decryption algorithm are similar but the
round keys are applied in the reverse order.
The figure in the next page, shows the relationship between the
number of rounds and the key size, which means that we can have
three different AES versions; they are referred as AES-128, AES-192,
and AES-256. However, the round keys, which are created by the key-
expansion algorithm are always 128 bits, the same size as the plaintext
or ciphertext block.
3
Rounds
The number of round keys generated by the key expansion algorithm
is always one more than the number of round. In other words, we have
number of round keys = number of round (Nr)+ 1
We refer to the round keys as K0, K1, K2,……..,KNr .
4
General Design of AES encryption cipher
5
Data Units
AES uses five units of measurement to refer to data: bits, bytes, words,
blocks, and state. The bit is the smallest and atomic unit.
7
Data units used in AES
8
Block to state and state to block transformation
9
Homework
Q1 Change the plaintext to state, if you’re using AES encryption and
the plaintext is “AES uses a matrix”.
10
Structure of Each Round
Each round, except the last, uses four transformations that are
invertible. The last round has only three transformations.
11
Structure of each round at the encryption site
12
Sub Bytes
To substitute a byte, we interpret the byte as two hexadecimal digits.
The left digit defines the row and the right digit defines the column of
the substitution table. The two hexadecimal digits at the junction of the
row and the column are the new byte.
13
Sub Bytes transformations
14
Sub Byte transformation table
15
InvSub Byte transformation table
16
Homework
Q1 Transform the state bye using the Sub Bytes transformation?
17
Shift Rows
In the encryption, the shifting is to the left and the number of shifts
depends on the row number (0, 1, 2 or 3) of the state matrix. This
means the row 0 is not shifted at all and the last row is shifted three
bytes.
In the decryption, the shifting is to the right. The number is the same
the row number (0, 1, 2, and 3) of the state matrix
18
Mix Columns
The mixing transformation changes the contents of each byte by taking
four bytes at a time and combining them to recreate four new bytes. To
guarantee that each new byte is different (even if all four bytes are the
same), the combination process first multiples each byte with a
different constant and then mixes them.
19
Mixing bytes using matrix multiplication
20
Add Round Key
Proceeds one column at a time, Add Round Key adds a round key
word with each state column matrix, so the operation in add round key
is matrix addition.
21
Key Expansion
To create round keys for each round, AES uses a key expansion
process. If the number of rounds is Nr , the key-expansion routine
creates Nr + 1 128 bit round keys from one single 128-bit cipher key.
The first round key is used for pre-round transformation; the
remaining round keys are used for the last transformation at the end of
each round.
The key expansion routine creates round keys word by word, where a
word is an array for four bytes. The routine creates 4 x (Nr + 1) words
that are called w0, w1, w2, ……, w4 (Nr + 1) – 1
22
Key Expansion
The 44 words key are made from the original key, the processes for the
other two versions are the same with some slight changes.
23
Key Expansion
The process is as follows:
1. The first four words (w0, w1, w2, w3) are made from the cipher key.
The cipher key is thought of as an array of 16 bytes (k0 to k15). The
first four bytes (k0 to k3) become w0; the next four bytes (k4 to k7)
become w1; and son on.
2. The rest of words (wi for i=4 to 43) are made as follow:
a) If (i mod 4) 0, wi= wi-1 wi-4. This means each word is made from
the one at the left and the one at the top.
b) If (i mod 4) = 0, wi=t wi-4. Here t, a temporary word, is the result
of applying two routines SubWord and Rotword on wi-1 and XORing
the result with a round constant, Rcon. In other words we have,
t = SubWord (RotWord (wi-1)) Rconi/4
24
Key Expansion
The RotWord (rotate word) routine is similar to the shift rows
transformation, but it is applied to only one row. The routine takes a
word as an array of four bytes and shifts each byte to the left with
wrapping.
25
Rcon constants AES-128 Version
26
Homework
Q1 Explain key expansion in AES 192 and AES 256?
27
Analysis of AES
AES was designed after DES. Most of the known attacks on DES were
already tested on AES.
Statistical attacks
Numerous tests have failed to do statistical analysis of the ciphertext.
Because strong diffusion and confusion provided by the combination of
the Sub Byte, Shift Rows and Mix Columns transformations remove any
frequency pattern in the plaintext.