Professional Documents
Culture Documents
CNS Unit I
CNS Unit I
CNS Unit I
&
Network Security
UNIT 1
UNIT I
• Cryptography and Security
• Ciphers & Secret Messages
• Attacks and Services
• Mathematical Tools
• Substitution and Permutation
• Modular Arithmetic
• Euclid’s Algorithm
• Conventional/ Symmetric Algorithms
• Block Cipher Modes of Operations
• Feistel Structure –
• DES, Triple DES, Strengths
Introduction
• We live in a world of information
• Need to keep these information safe
• Protect information from unauthorized access
• For we have Cryptography
Cryptology
• An area of Mathematics
• Cryptography + Cryptanalysis
• Cryptography derived from the Greek words
• Kryptos – Hidden/Secret
• Graphein – To write
• Cryptography is the science of secret writing
• Cryptanalysis break the security algorithm and
leak information
Cryptography
• 3 aspects
• security attack – Any action that compromises the security
information owned by an organization / individual.
• security mechanism – A process ( a device incorporating such a
process) that is designed to detect, prevent or recover from a
security attack.
• security service - intended to counter security attacks . service
enhances the security of the data processing systems and the
information transfers of an organization.
Threat and Attacks
12 19 12 19 2 12 18 0 11
12 0 19
0 19 19
A T T
Vigenere Cipher
Based on the plaintext characters and the position of the characters in the
plaintext prepare the cipher text
Pick a keyword
Repeatedly write the keyword below the plaintext
one letter of the keyword associated with one letter of the
plaintext.
Prepare cipher text
Vigenere Cipher
• Encrypt the message “She is listening” using the 6-character
keyword “PASCAL”.
• The initial key stream is (15, 0, 18, 2, 0, 11).
Vigenere Cipher
• 7
• 15
• 18
• S
Vernam Cipher(One – Time Pad)
• Each plaintext symbol is encrypted with a randomly
chosen key.
• Invented by Vernam.
Transposition Cipher
• Rearranging the elements in the plain text – Word jumble
• transposition ciphers used in the past, are keyless.
• Now we have keyed Transposition Ciphers
Rail Fence Cipher
Text is written into a table column by column and then is
transmitted row by row.
Encrypt : “Meet me at the park”
“MMTAEEHREAEKTTP”.
Keyed Transposition Cipher
• Write Plain Text Characters of Width l, l is no of characters in key
Encrypt “ THIS IS COLUMNAR TRANSPOSITION” using key “APPLE”
Write number sequence A P P L E
T H I S I
1 4 5 3 2 - write alphabetical order
S A C O L
Cipher Text
U M N A R
TSUTPIILRSTSOANIHAMROOICNASN
T R A N S
P O S I T
I O N
1 4 5 3 2
Symmetric Ciphers
• Stream Cipher
• Block Cipher
Stream Ciphers
• Stream Ciphers encrypting one character at a time
• Vernam ciphers are examples for stream ciphers
Block Ciphers
• Keyed transposition ciphers
• block of plaintext is treated as a whole(Single Unit) & produce
a cipher text block of equal length.
• Plaintext symbols divided into group of size m (m > 1) and
encrypted together creating a group of cipher text of m.
• A single key is used to encrypt the whole block
• The key is made of multiple values.
• Modern ciphers are block ciphers
Hill Cipher
• Hill ciphers are block ciphers.
• If A is any invertible matrix (A inverse exist)
• C= A.P(mod m)
• P = A-1.C(mod m)
The key is made of m × m values ,considered as a single key
(Matrix).
• A-1 (mod m) = Adj(A)// A/(mod m)
Hill Cipher
• Encrypt “ATTACK AT DAWN” with key
• Cipher text:
(4,22,23,9,4,22,24,19,10,25) = EWXJEWYTKZ
Hill Cipher
• Decrypt EWXJEWYTKZ with key
Product Cipher – Play Fair Cipher
• English Alphabets arranged in a 5X5 Grid – Omit either I or J
• The Key for Playfair Cipher is a word
• Encrypt "Hide the gold in the tree stump“ using key “Playfair
example”
P L A Y F
• Construct 5X5 grid
I R E X M
B C D G H
K N O Q S
T U V W Z
• Hi de th eg ol di nt he tr ex es tu mp
• HI = BM
• DE = OD
• TH = ZB
• EG = XD
• OL = NA
• DI = BE
• NT = KU
• HE = DM
• TR = UI
• EX = XM , ES= MO, TU = UV, MP = IF
Product Cipher – Play Fair Cipher
Each round i has input Li-1 and Ri-1 derived from the previous
round and a sub-key Ki derived from the Key K
• Then XOR the output of that function and the left half of the data.
• Finally combine Left half and right half to produce the cipher block.
Feistel Cipher Structure
Design Features -Feistel Cipher
Block Size: normally 64 bits, (larger block means greater security)
Key Size:56-128 bits.
Number of Rounds: a single round offers inadequate security, a
typical size is 16 rounds.
Sub-key Generation Algorithms: greater complexity should lead to a
greater difficulty of cryptanalysis.
Round function: Again, greater complexity - means greater
resistance to cryptanalysis.
Fast Software encryption/Decryption: the speed of execution of
the algorithm is important.
Ease of Analysis: to be able to develop a higher level of assurance as
to its strength
Decryption: use the same algorithm with reversed keys.
Data Encryption Standard
• A proposal from IBM
• Accepted by NIST
• A combination of Substitution and Transposition
• So Product Cipher
• A symmetric key block cipher algorithm
DES Characteristics
• DES divide Plaintext into 64 bits blocks
• Last block padded with 0’s if necessary
• Initial Key length is 64 , then select 56 by avoiding each
8th bit
• 16 rounds
• 16 sub-keys generated, one used in each round
DES Processing
1. 64 bit block passes through initial permutation ,
rearrange the bits and produce permuted output.
2. Perform 16 rounds of permutation and
substitution to produce the 64 bit output ,
3. Divide that 64 bit into two 32 bit half's , swap it to
produce 64 bits
4. Apply another permutation (inverse of initial
permutation) to produce 64 bit cipher text
DES Key Generation