Unit-II-CNS PPT
Unit-II-CNS PPT
Block Cipher
• Block of plaintext is treated as a whole and used to produce a
ciphertext block of equal length
• Typical block size 64 – 128 bits
• Example: Data Encryption Standard (DES)(64 bit block), Advanced
Encryption Standard (AES)(128 bit block)
Stream Cipher
• Process messages a bit or byte at a time
• Examples of classical stream ciphers are the autokeyed Vigenère
cipher and the Vernam cipher.
Block vs Stream Ciphers
Block Cipher Principles
Motivation for the Feistel Cipher Structure
• In general, for a n -bit ideal block cipher, the length of the key
defined in this fashion is n× 2n bits.
• Applying a round function F to the right half of the data and then
taking the exclusive-OR of the output of that function and the
left half of the data.
F(REi,Ki+1).
Block size
Key size
Number of rounds
Round function F
There are two other considerations in the design of a Feistel
cipher:
•Fast software encryption/decryption:
The speed of execution of the algorithm becomes a concern.
• Ease of analysis:
If the algorithm can be concisely and clearly explained, it is
easier to analyze that algorithm for cryptanalytic
vulnerabilities
Therefore develop a higher level of assurance as to its
strength.
FEISTEL DECRYPTION ALGORITHM
• Use the ciphertext as input to the algorithm but use the subkeys Ki
in reverse order.
• Let the output of the ith encryption round be LEi||REi, then the
corresponding output of the (16 – i)th decryption round is REi||LEi
or, equivalently LD16-i||RD16-i
• After the last iteration of the encryption process
The two halves of the output are swapped, i.e. ciphertext.
• IP – an initial permutation
• The output of the shift operation also feeds into another shift and
another instance of P8 to produce the second subkey (K2).
Encryption algorithm can be expressed as a composition of functions:
S-DES Key generation
• S-DES depends on the use of a 10-bit key shared between sender
and receiver.
• From this key, two 8-bit subkeys are produced for use in particular
stages of the encryption and decryption algorithm.
• This retains all 8 bits of the plaintext but mixes them up. At the end
of the algorithm, the inverse permutation is used:
• The second permutation is indeed the reverse of the first; that is,
IP–1(IP(X)) = X.
The Function fK
• The function fK consists of a combination of permutation and substitution functions.
• Let L and R be the leftmost 4 bits and rightmost 4 bits of the 8-bit input to fK, and let
F be a mapping from 4-bit strings to 4-bit strings.
where SK is a subkey
• Suppose the output of the IP stage (10111101) and F(1101, SK) = (1110) for some key
SK.
Then fK(10111101) = (01011101) because
• The first 4 bits are fed into the S-box S0 to produce a 2-bit output,
and the remaining 4 bits are fed into S1 to produce another 2-bit
output.
The two boxes are defined as follows:
• The left and right halves of the output are swapped to produce
the preoutput.
• The results show that about half of the bits in the ciphertext differ
and that the avalanche effect is pronounced after just a few rounds.
The Strength of DES
The Use of 56-Bit Keys
A single machine performing one DES encryption per
microsecond would take more than a thousand years to break
the cipher.
The Nature of the DES Algorithm
Over the years a number of regularities and unexpected
behaviors of the S-boxes have been discovered.
Timing Attacks
An encryption or decryption algorithm often takes slightly
different amounts of time on different inputs.
Block Cipher Design Principles
Number of Rounds
• The number of rounds is chosen so that known cryptanalytic efforts
require greater effort than a simple brute-force key search attack.
Design of Function F
One criterion is that F be nonlinear
The algorithm should have good avalanche properties.
Key Schedule Algorithm
• Select subkeys to maximize the difficulty of deducing individual
subkeys and the difficulty of working back to the main key.
The Advanced Encryption Standard(AES)
• Published by NIST in 2001.
Cipher
• Has 128/192/256 bit keys, 128 bit data
AES Encryption
Process
AES
Data
Structures
AES General Structure
• The cipher takes a plaintext block size of 128 bits, or 16 bytes.
• The key length can be 16, 24, or 32 bytes (128, 192, or 256 bits)
• .
• Plaintext block is depicted as a square 4×4 matrix of bytes.
• Example:
• B generates a related pair of keys: a public key, PUb, and a private key,
PRb
• With the message X and the encryption key PUb as input, A forms the
ciphertext Y = [Y1, Y2, . . . , YN]:
Y = E(PUb, X)
• The intended receiver, in possession of the matching private key, is
able to invert the transformation: X = D(PRb, Y)
Public-Key Cryptosystem:
Authentication
Encryption using Private key-
Authentication
Y = E(PRa, X)
X = D(PUa, Y)
• A prepares a message to B and encrypts it using A’s private key
before transmitting it.
• Because the message was encrypted using A’s private key, only
A could have prepared the message-digital signature.
Authentication and confidentiality
Applications for Public-Key Cryptosystems
• We can classify the use of public-key cryptosystems into three
categories:
Encryption /decryption
Digital signature
Key exchange
Requirements for Public-Key Cryptography
1. It is computationally easy for a party B to generate a pair (public key Pub,
private key PRb).
2. It is computationally easy for a sender A, knowing the public key and the
message M to be encrypted to generate the corresponding ciphertext:
C = E(PUb,M)
Find public keys of Alice and Bob and, the session(secret) key k
generated by them.
Solution:
• Given random prime number q=353, α=3
• Given private(secret) keys of Alice and Bob:
xA=97, xB=233
• Compute respective public keys:
yA = α xA mod q (Alice)
yA=397 mod 353 = 40
yB = α xB mod q (Bob)
yB=3233 mod 353 = 248
• Compute common key as:
A computes K= (yB)xA mod q = 24897 mod 353
= 160 (Alice)
B computes K= (yA)xB mod q = 40233 mod 353
= 160 (Bob)
The Diffie–Hellman Key Exchange
Man-in-the-Middle Attack