Professional Documents
Culture Documents
Experiment 2 ICS
Experiment 2 ICS
2
PART A
(PART A: TO BE REFERRED BY STUDENTS)
A.1 Aim:
To study Advance Encryption Standards block cipher and it’s mode of operations
Task 1:
Simulate the working of Cipher Block Chaining (CBC) mode for Advance Encryption Standard
using Virtual Bombay.
A.2 Prerequisite:
Basic understanding of goals of security, cryptography.
A.3 Outcome:
A.4 Theory:
Interestingly, AES performs all its computations on bytes rather than bits. Hence, AES treats the
128 bits of a plaintext block as 16 bytes. These 16 bytes are arranged in four columns and four
rows for processing as a matrix −
Unlike DES, the number of rounds in AES is variable and depends on the length of the key. AES
uses 10 rounds for 128-bit keys, 12 rounds for 192-bit keys and 14 rounds for 256-bit keys. Each
of these rounds uses a different 128-bit round key, which is calculated from the original AES key.
The schematic of AES structure is given in the following illustration
Byte Substitution (SubBytes)
The 16 input bytes are substituted by looking up a fixed table (S-box) given in design. The result
is in a matrix of four rows and four columns.
Shiftrows
Each of the four rows of the matrix is shifted to the left. Any entries that ‘fall off’ are re-inserted
on the right side of row. Shift is carried out as follows −
First row is not shifted.
Second row is shifted one (byte) position to the left.
Third row is shifted two positions to the left.
Fourth row is shifted three positions to the left.
The result is a new matrix consisting of the same 16 bytes but shifted with respect to each
other.
MixColumns
Each column of four bytes is now transformed using a special mathematical function. This
function takes as input the four bytes of one column and outputs four completely new bytes,
which replace the original column. The result is another new matrix consisting of 16 new bytes.
It should be noted that this step is not performed in the last round.
Addroundkey
The 16 bytes of the matrix are now considered as 128 bits and are XORed to the 128 bits of the
round key. If this is the last round then the output is the cipher text. Otherwise, the resulting 128
bits are interpreted as 16 bytes and we begin another similar round.
Decryption Process
The process of decryption of an AES ciphertext is similar to the encryption process in the reverse
order. Each round consists of the four processes conducted in the reverse order
(Students must submit the soft copy as per following segments within two hours of the
practical. The soft copy must be uploaded on the Student Portal or emailed to the concerned lab
in charge faculties at the end of the practical in case the there is no Student Portal access
available)
B.3 Conclusion:
B.4 Questions of Curiosity
Q1. Which is the fastest mode of operation among four mode of operation?
ECB (Electronic Codebook) is essentially the first generation of the AES. It is the most
basic form of block cipher encryption.
CBC (Cipher Blocker Chaining) is an advanced form of block cipher encryption. With
CBC mode encryption, each ciphertext block is dependent on all plaintext blocks
processed up to that point. This adds an extra level of complexity to the encrypted data.
Advantages of CBC –
CBC works well for input greater than b bits.
CBC is a good authentication mechanism.
Better resistive nature towards cryptanalysis than ECB.
ECB (electronic code book) is basically raw cipher. For each block of input, you encrypt
the block and get some output. The problem with this transform is that any resident
properties of the plaintext might well show up in the ciphertext – possibly not as clearly –
that's what blocks and key schedules are supposed to protect againt, but analyzing the
patterns you may be able to deduce properties that you otherwise thought were hidden.
CBC mode is short for cipher block chaining. You have an initialization vector which
you XOR the first block of plaintext against. You then encrypt that block of plaintext.
The next block of plaintext is xor'd against the last encrypted block before you encrypt
this block.
Q3. What is importance of Initialization Vector (IV) and CTR? An initialization vector (IV)
is an arbitrary number that can be used along with a secret key for data
encryption. This number, also called a nonce, is employed only one time in any
session.
The main reason not to use ECB mode encryption is that it's not semantically secure — that is,
merely observing ECB-encrypted ciphertext can leak information about the plaintext (even
beyond its length, which all encryption schemes accepting arbitrarily long plaintexts will leak
to some extent).
Specifically, the problem with ECB mode is that encrypting the same block (of 8 or 16 bytes,
or however large the block size of the underlying cipher is) of plaintext using ECB mode
always yields the same block of ciphertext. This can allow an attacker to:
Q5. Suppose IV is not random. Then is CBC and OFB mode both secure
A block cipher mode specifies how to handle data that spans multiple blocks. Block
cipher modes are where block ciphers really shine. There are modes for (CPA-secure)
encryption, modes for data integrity, modes that achieve both privacy and integrity,
modes for hard drive encryption, modes that gracefully recover from errors in
transmission, modes that are designed to croak upon transmission errors, and so on.
There is something of a cottage industry of clever block cipher modes, each with their
own unique character and properties. Think of this chapter as a tour through the most
common modes.