Sie sind auf Seite 1von 77

ICT Course: Information Security

Nguyen Minh Huong

ICT Department, USTH

September 17, 2019

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 1 / 76
Outline

Session 2: Introduction to Cryptography - Symmetric


Cryptography
1 Classification of the field of Cryptology
2 Basics of Symmetric Cryptology
3 Cryptanalysis
4 Historical cipher system
5 Symmetric ciphers
Stream ciphers
Block ciphers
Feistel Cipher
DES
AES
Mode of Operation
Exhaustive key search revisited
Increasing the security of Block cipher

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 2 / 76
Classification of the field of Cryptology

Classification of the field of Cryptology

Cryptology

Cryptography Cryptanalysis

Symmetric Ciphers Asymmetric Ciphers Related Protocols

Stream Block
Ciphers Ciphers

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 3 / 76
Basics of Symmetric Cryptology

Basics of Symmetric Cryptology

Trudy
(bad)

y y
Alice x Encryption Unsecured channel Decryption x Bob
(good) e() d() (good)

K K

Secured Channel
Key generator

x is called the plaintext


y is called the ciphertext
K is called the key
Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 4 / 76
Basics of Symmetric Cryptology

Encryption: y = eK (x)
Decryption: x = dK (y )
If same keys are used for encryption and decryption:
dK (y ) = dK (eK (x)) = x

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 5 / 76
Cryptanalysis

Cryptanalysis

Why we need Cryptanalysis?


The only way to assure a cipher is secure is to try and to break it
(and fail!)
Kerchhoff’s principle
A cryptosystem should be secure even if the attacker knows all details
about the system, with the exception of the secret key. In particular, the
system should be secure when the attacker knows the encryption and
decryption algorithms.

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 6 / 76
Cryptanalysis

Cryptanalysis Classification
Cryptanalysis

Classical Cryptanalysis Implementataion Attacks Social Engineering

Mathematical Brute-Force
Analysis Attack

Classical Cryptanalysis : recovering x or k from y


Implementation Attacks : try to extract a secret key from
side-channel analysis, e.g., power measurement, electromagnetic
radiation, etc.
Social engineering : obtain a secret key by involving humans, e.g.,
trick a user into giving her password
Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 7 / 76
Cryptanalysis

Brute-Force Attack (Exhaustive Key Search) against


Symmetric Ciphers

Requires at least 1 plaintext-ciphertext pair (x0 , y0 )


Check all possible keys K until: dK (y0 ) = x0
How many keys do we need?
Key length Key space Time for all keys searching
64 bits 264 few hours or days
128 bits 2128 decades without quantum computer
256 bits 2256 decades with quantum computer

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 8 / 76
Cryptanalysis

Substitution cipher

Historical cipher
Example for understanding Brute-force and analytical attacks
Encrypts letter rather than bits

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 9 / 76
Cryptanalysis

Example

Ciphertext:

Brute-forte Attack?
Analytical attack?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 10 / 76
Cryptanalysis

Example

Brute-forte attack: 240 per seconds − > How much time to break the
code?
Analytical: frequency counts

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 11 / 76
Historical cipher system

Historical cipher system

1 Shift (Ceasar) Cipher


2 Affine Cipher

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 12 / 76
Historical cipher system

Shift (Ceasar) Cipher - Example

plaintext = ictlab
ciphertext = lfwode
What is the rule?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 13 / 76
Historical cipher system

Shift Cipher - Description

Let k, x, y ∈ 0, 1, ..., 25
Encryption: y = ek (x) ≡ (x + k) mod 26
Decryption: x = dk (x) ≡ (y − k) mod 26
Question:
Keyspace = ?
Is it secure? (Any attack is possible?)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 14 / 76
Historical cipher system

Affine Cipher

A key is consisted of two parts: k = (a, b)


Let k, x, y ∈ 0, 1, ..., 25
Encryption: y = ek (x) ≡ (a.x + b) mod 26
Decryption: x = dk (x) ≡ (a−1 .(y − b)) mod 26
gcd(a,26)=1, then a = {1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25}
Keyspace =? Is it secure?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 15 / 76
Symmetric ciphers

Symmetric ciphers

Stream cipher vs. Block cipher


x1 y1
k
x2 y2
. .
. .
. .
xb yb

? cipher

b b

x1 x2... xb y1 y2... yb
? cipher

1 1

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 16 / 76
Symmetric ciphers

Stream Cipher-How it works

A key K of n bits is stretched into a long keystream S

StreamCipher (K ) = S

Stream cipher Encryption and Decryption


xi , yi , si ∈ {0, 1}: individual bits of plaintext, ciphertext and keystream
Encryption: yi = xi + si (mod 2)
Decryption: xi = yi + si (mod 2)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 17 / 76
Symmetric ciphers Stream ciphers

Stream ciphers

Modulo 2 addition is equivalent to XOR operation


Plaintext P, Ciphertext C

C =P ⊕S

P =C ⊕S

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 18 / 76
Symmetric ciphers Stream ciphers

A5/1 cipher

designed for hardware, used in GSM


Key of 64 bits initially fills in 3 Linear Feedback Shift Registers
(LFSRs):
X 19 bits
Y 22 bits
Z 23 bits
How to obtain every single keystream bit?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 19 / 76
Symmetric ciphers Stream ciphers

A5/1 - Keystream generator

X x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18



Å
Keystream bits
Y y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 y17 y18 y19 y20 y21 Å

Å


Z z0 z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 z14 z15 z16 z17 z18 z19 z20 z21 z22

Å

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 20 / 76
Symmetric ciphers Stream ciphers

A5/1 - Keystream generator

LFSR steps:
X steps then:
xi = xi−1
x0 = x13 ⊕ x16 ⊕ x17 ⊕ x18
Y steps then: ?
Z steps then: ?
A single keystream bit: s = ?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 21 / 76
Symmetric ciphers Stream ciphers

A5/1 - Keystream generation

When they step?


Majority vote function: m = maj(x, y , z), m = 0 when majority of
(x,y,z) is 0, otherwise m = 1
In A5/1, m = maj(x8 , y10 , z10 )
if x8 = m, then X steps
if y10 = m, then Y steps
if z10 = m, then Z steps

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 22 / 76
Symmetric ciphers Stream ciphers

RC4 algorithm

Designed for software, e.g, SSL, WEP...


Key: N bytes, 1 ≤ N ≤ 256
Lookup table: a 256-byte array S
Initialized from the key to the identify permutation: Key-scheduling
Algorithm (KSA)
can be one of all 256 possible permutations of 256 bytes
From the lookup table, a keystream byte is generated at each step:
Pseudo-random generation algorithm (PRGA)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 23 / 76
Symmetric ciphers Stream ciphers

RC4 - Keystream generation

KSA pseudo code:

1: for i = 1 to 255 do
2: S[i] = i
K [i] = key [i mod N]
3: end for
j=0
4: for i = 0 to 255 do
5: j = (j + S[i] + K [i]) mod 256
Swap(S[i], S[j])
6: end for
i=j=0

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 24 / 76
Symmetric ciphers Stream ciphers

RC4 - Keystream generation

PRGA pseudo code:


i = (i + 1) mod 256
j = (j + S[i]) mod 256
Swap(S[i], S[j])
t = (S[i] + S[j]) mod 256
KeystreamByte = S[t]

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 25 / 76
Symmetric ciphers Block ciphers

Block ciphers

General idea:

Plaintext fixed-sized blocks fixed-sized blocks


of Ciphertext

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 26 / 76
Symmetric ciphers Block ciphers

Block ciphers

General idea:

Plaintext fixed-sized blocks fixed-sized blocks


of Ciphertext

Claude Shannon: There are two primitive operations with which


strong encryption algorithms can be built:
Confusion: An encryption operation where the relationship between
key and ciphertext is obscured (e.g., substitution).
Diffusion: An encryption operation where the influence of one
plaintext symbol is spread over many ciphertext symbols with the
goal of hiding statistical properties of the plaintext (e.g., permutation).

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 26 / 76
Symmetric ciphers Block ciphers

Combining the two primitives to build a so called product ciphers


Most of today’s ciphers are product ciphers as they consist of rounds
which are applied repeatedly to the data.

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 27 / 76
Symmetric ciphers Block ciphers

Common block ciphers

Feistel Cipher
DES
AES

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 28 / 76
Symmetric ciphers Block ciphers

Feistel Cipher

???

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 29 / 76
Symmetric ciphers Block ciphers

Feistel network structure


Feistel network structure in DES

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 30 / 76
Symmetric ciphers Block ciphers

Data Encryption Standard

DES overview:
Developed by IBM, based on Lucifer cipher
Standardized in 1977 by the National Bureau of Standards (NBS)
today called National Institute of Standards and Technology (NIST)
Features:
Key length: ?
Block length?
how many rounds?
Subkey length?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 31 / 76
Symmetric ciphers Block ciphers

DES Algorithm

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 32 / 76
Symmetric ciphers Block ciphers

DES Algorithm - Encryption round


Feistel encryption

F-funtion

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 33 / 76
Symmetric ciphers Block ciphers

S-box substitution
Eight substitution tables
6 bits of input, 4 bits of output
Non-linear, crucial element for DES security
S(x1 ) ⊕ S(x2 ) 6= S(x1 ⊕ x2 )

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 34 / 76
Symmetric ciphers Block ciphers

Key schedule

PC-1: reduce 64 bits to 56 bits


by ignoring every 8 bits and
permute
Round 1, 2, 9, 16: rotate left by
1 bits, others by 2 bits
Rotation is only taken place
within either left or right half

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 35 / 76
Symmetric ciphers Block ciphers

Decryption

Key schedule is reversed in


decryption

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 36 / 76
Symmetric ciphers Block ciphers

Summary of DES

From above description of DES algorithm and key schedule, what we can
summarize?
DES Features:
Key length: 56 bits
Block lenghth: 64 bits
Subkey length: 48 bits
Number of rounds: 16
56-bit key is susceptible to an exhaustive key search

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 37 / 76
Symmetric ciphers Block ciphers

Advanced Encryption Standard

AES overview:
The most widely used symmetric cipher today
Approved by US NIST in 2001 after years of
byte-oriented cipher

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 38 / 76
Symmetric ciphers Block ciphers

AES Encryption Algorithm

Features:
block size: 128 bits
3 key lengths: 128/192/ 256
bits (subkey length =?)
Number of rounds: 10/12/14
Each round: 3 layers

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 39 / 76
Symmetric ciphers Block ciphers

AES Encryption Algorithm

3 layers:
Key addition layer
Byte substitution layer
Diffusion layer
Data path (state): 128 bits = 16
bytes

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 40 / 76
Symmetric ciphers Block ciphers

AES Internal structure

Plaintext block is arranged in matrix Key bytes are arranged in matrix of 4


of 16 bytes rows x n columns

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 41 / 76
Symmetric ciphers Block ciphers

AES Internal structure - Round function

Round function for


round 1,2,...,nr −1

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 42 / 76
Symmetric ciphers Block ciphers

AES Round function - Byte substitution layer

Consist of 16 S-boxes
S-boxes are:
identical
non-linear
one-to-one mapping of input and output
In implementation, S-boxes are realized as a look up table (mapping)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 43 / 76
Symmetric ciphers Block ciphers

AES Round function- Diffusion layers

provides diffusion
consist of two sublayers:
ShiftRows sublayer: permutation
MixColumn sublayer: mixes block of 4 bytes
perform linear operation on state matrices A and B (input matrices)

Diff (A) + Diff (B) = Diff (A + B)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 44 / 76
Symmetric ciphers Block ciphers

ShiftRows sublayer

Rows of state matrix are shifted cyclically:

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 45 / 76
Symmetric ciphers Block ciphers

MixColumn sublayer

Mixes each column of the state matrix

MixColumn(B) = C

Each 4-byte column is multiplied by a fixed 4x4 matrix


All arithmetic is done in Galois Feild GF(28 )

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 46 / 76
Symmetric ciphers Block ciphers

Key Addition layer

Input: 16-byte state matrix C and subkey kj


Output: C ⊕ kj

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 47 / 76
Symmetric ciphers Block ciphers

AES Key schedule

1 word = 32 bits
In each round i, subkey ki = 4 words W [4i + j], j = 0..3
Different key schedule for different key size

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 48 / 76
Symmetric ciphers Block ciphers

AES Key schedule - 128-bit key

The leftmost word: W [4i] = W [4(i − 1)] ⊕ g (W [4i − 1])


The remain words: W [4i + j] = W [4i + j − 1] ⊕ W [4(i − 1) + j]

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 49 / 76
Symmetric ciphers Block ciphers

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 50 / 76
Symmetric ciphers Block ciphers

g function:
S-box substitution: adds nonlinearity to the schedule
RC[i]: a round coefficient, 8-bit value, vary from round to round

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 51 / 76
Symmetric ciphers Block ciphers

AES Decryption

All layers must be inverted for decryption:


Inv MixColumn layer: inverse of the 4x4 matrix
Inv ShiftRows layer: all the state of the state matrix B are shifted in
the opposite direction
Inv Byte substitution: inverse S-Box
Key schedule for decryption:
Subkeys are needed in reversed order

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 52 / 76
Symmetric ciphers Block ciphers

Implementation in Software

One requirement of AES was the possibility of an efficient software


implementation
Straightforward implementation is well suited for 8-bit processors
(e.g., smart cards), but inefficient on 32-bit or 64-bit processors
A more sophisticated approach: Merge all round functions (except the
key addition) into one table look-up
This results in four tables with 256 entries, where each entry is 32 bits
wide
One round can be computed with 16 table look-ups
Typical SW speeds are more than 1.6 Gbit/s on modern 64-bit
processors

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 53 / 76
Symmetric ciphers Block ciphers

AES Security

Brute-force attack: ?
Analytical attack: There is currently no analytical attack against AES
known which has a complexity less than a brute-force attack

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 54 / 76
Symmetric ciphers Block ciphers

Mode of Operation

How to encrypt more than one single block of plaintext?


Electronic Code Book Mode (ECB)
Cipher Block Chaining Mode (CBC)
Cipher Feedback Mode (CFB)
Output Feedback Mode (OFB)
Counter mode (CTR)
others
They provides: confidentiality, integrity and authenticity

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 55 / 76
Symmetric ciphers Block ciphers

Electronic Code Book Mode

The length of the plaintext must be an exact multiple of the block


size of the cipher, if not it must be padded
Each block is encrypted separatedly
b-bit plaintext block xi has b bits, b-bit ciphertext block yi
Message exceeding b-bit must be partitioned into b-bit blocks

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 56 / 76
Symmetric ciphers Block ciphers

ECB Mode

Let e() be a block cipher of block size b, and let xi and yi be bit strings of
length b.
Encryption: yi = ek (xi ), i ≥ 1
Decryption: xi = ek−1 (ek (xi )), i ≥ 1

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 57 / 76
Symmetric ciphers Block ciphers

ECB security

Substitution Attack:
Example: electronic bank transfer: Block #1.Sending Bank A
#2.Sending Account #3.Receiving Bank B #4.Receiving Account
#5. Amount
Attacker: transfers repeatedly from his account in bank A to his
account in bank B
He obtains ciphertext for block 1,3,4
replaces block 4 of other transfers with his block 4 then all transfers
are redirected to his account

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 58 / 76
Symmetric ciphers Block ciphers

ECB security

Encrypting bipmap in ECB mode:


Statistical properties in the plaintext are preserved in the ciphertext

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 59 / 76
Symmetric ciphers Block ciphers

ECB Advantages and Disadvantages

Advantages:
no block synchronization between sender and receiver is required
bit errors caused by noisy channels only affect the corresponding
block but not succeeding blocks
Block cipher operating can be parallelized, then advantage for
high-speed implementations
Disadvantages: ECB encrypts highly deterministically
identical plaintexts result in identical ciphertexts
an attacker recognizes if the same message has been sent twice
plaintext blocks are encrypted independently of previous blocks
an attacker may reorder ciphertext blocks which results in valid
plaintext

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 60 / 76
Symmetric ciphers Block ciphers

Cipher Block Chaining Mode

The encryption of all blocks are chained together


The encryption is randomized by using an initialized vector (IV)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 61 / 76
Symmetric ciphers Block ciphers

CBC-Encryption and Decryption

Encryption and Decryption in CBC mode


Let e() be a block cipher of block size b; let xi and yi be bit strings of
length b; and IV be a nonce of length b.
Encryption (first block): y1 = ek (x1 ⊕ IV )
Encryption (general block): yi = ek (xi ⊕ yi−1 ), i ≥ 2
Decryption (first block): x1 = ek −1 (y1 ) ⊕ IV
Decryption (general block): xi = ek −1 (yi ), i ≥ 2

We do not have to keep IV secret. Why?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 62 / 76
Symmetric ciphers Block ciphers

Substitution attack on CBC

Example of electronic bank transfer


If IV is chosen for every wire transfer, attack will not work
If IV is kept the same, the attacker would recognize
Why?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 63 / 76
Symmetric ciphers Block ciphers

Output Feedback Mode

Is used to build synchronous stream cipher from a block cipher


key stream is generated blockwise fashion
Output of the cipher: key stream bits Si to encrypt plaintext bits
using the XOR operation

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 64 / 76
Symmetric ciphers Block ciphers

OFB - Encryption and Decryption

Encryption and decryption in OFB mode


Let e() be a block cipher of block size b; let xi , yi and si be bit strings of
length b; and IV be a nonce of length b.
Encryption(first block): s1 = ek (IV ) and y1 = s1 ⊕ x1
Encryption (general block): si = ek (si−1 ), i ≥ 2
Decryption (first block): s1 = ek (IV ) and x1 = s1 ⊕ y1
Decryption (general block): si = ek (si−1 ) and xi = si ⊕ yi , i ≥ 2

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 65 / 76
Symmetric ciphers Block ciphers

Cipher Feedback Mode

Same requirement of plaintext size as ECB


Uses block cipher as building block for an asynchronous stream cipher
Key stream Si is generated in blockwise fashion and function of
ciphertext
non-deterministic (if the IV is a nonce)

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 66 / 76
Symmetric ciphers Block ciphers

CFB-Encryption and Decryption

Encryption and Decryption in CFB mode


Let e() be a block cipher of block size b; let xi and yi be bit strings of
length b; and IV be a nonce of length b.
Encryption (first block): y1 = ek (IV ) ⊕ x1
Encryption (general block): yi = ek (yi−1 ) ⊕ xi , i ≥ 2
Decryption (first block): x1 = ek (IV ) ⊕ y1
Decryption (general block): xi = ek (yi−1 ) ⊕ yi , i ≥ 2

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 67 / 76
Symmetric ciphers Block ciphers

Counter Mode
Uses a block cipher as a stream cipher
Key stream is generated in blockwise fashion
The counter assumes a different value everytime a new key stream
block is computed

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 68 / 76
Symmetric ciphers Block ciphers

CTR - Encryption and Decryption

Encryption and Decryption in CTR mode


Let e() be a block cipher of block size b, and let xi and yi be bit strings of
length b. The concatenation of the initialization value IV and the counter
CTRi is denoted by (IV ||CTRi ) and is a bit string of length b.
Encryption: yi = ek (IV ||CTRi ) ⊕ xi , x ≥ 1
Decryption: xi = ek (IV ||CTRi ) ⊕ yi , i ≥ 1

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 69 / 76
Symmetric ciphers Block ciphers

Exhaustive key search revisited


A brute-force attack can produce false positive results
keys ki that are found are not the one used for the encryption
The likelihood of this is related to the relative size of the key space
and the plaintext space
brute-force attack is still possible, but several pairs of
plaintext–ciphertext are needed

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 70 / 76
Symmetric ciphers Block ciphers

Exhaustive key search revisited

Given a block cipher with a key length of bits and block size of n bits, as
well as t plaintext–ciphertext pairs (x1 , y1 ), ..., (xt , yt ), the likelihood of
false keys which encrypt all plaintexts to the corresponding ciphertexts is:

2k−t∗n

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 71 / 76
Symmetric ciphers Block ciphers

Increasing the security of Block cipher

Multiple Encryption
Key whitening

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 72 / 76
Symmetric ciphers Block ciphers

Multiple Encryption- Double Encryption

A plaintext x is first encrypted with a key kL , and the resulting ciphertext


is encrypted again using a second key kR

Key lengths: k bits, then key space (number of encryptions) =?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 73 / 76
Symmetric ciphers Block ciphers

Double Encryption- Meet-in-the-middle attack

Phase 1: encryption to compute the look up table ZL,i


Phase 2: decryption (result ZR,i ) to check whether any ZR,i equal to
ZL,i
The complexity or number of encryption or decryption = ?
How much it is more secure than single encryption?

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 74 / 76
Symmetric ciphers Block ciphers

Triple Encryption
Encrypt a block three times:

Meet-in-the-middle attack:

The attack reduces the effective key length from 3 ∗ k to 2 ∗ k


Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 75 / 76
Symmetric ciphers Block ciphers

Key whitening

Make block cipher more resistant against brute-force attack


Key whitening for block ciphers
Encryption: y = ek,k1 ,k2 = ek (x ⊕ k1 ) ⊕ k2
Decryption: x = e −1 k , k1 , k2 (y ) = ek −1 (y ⊕ k2 ) ⊕ k1

Security of key whitening: key length k bits, block length n bits


A naive brute-force attack: 2(k+2∗n) search steps
Meet-in-the-middle attack: 2(k+n) search steps

Nguyen Minh Huong (ICT Department, USTH) ICT Course: Information Security September 17, 2019 76 / 76

Das könnte Ihnen auch gefallen