CRP1
CRP1
What is Cryptography?
Terminologies
P- plain-text
C- Cipher text
E- Encryption algorithm
D- Decryption algorithms
C= E (p)
P= D(C)
P= D(E (P))
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 1/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Types of ciphers:
Encryption
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 2/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Asymmetric cryptography:
✓ Developed in 1970
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 3/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Banking
✓ Shopping
✓ Tax returns
✓ Protesting
✓ Military
✓ Student records
✓ …
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 4/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 5/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Security issues:
✓ One can recognize each other’s face, voice, hand signature, etc.
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 6/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Security Services
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 7/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Security Mechanism
Access Control: Uses method to prove that a user has access right to
data or resource owned by the system
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 8/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Information Information
Source Destination
Information Information
Source Destination
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 9/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Information Information
Source Destination
Information Information
Source Destination
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 10/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Information Information
Source Destination
Possible attackers:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 11/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
How to send a file that looks gibberish to all but the intended
receiver?
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 12/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Secure Secure
Sender Receiver
Alice Bob
Trudy
✓ Alice, Bob and Trudy are well known in network security world
✓ Bob and Alice are lovers and want to communicate securely with
each other
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 13/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Passive attack
✓ Active attack
Security Attack
Passive Attack
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 14/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Active Attack
In this case either sender of message may deny that he has sent
message; or the receiver of the message might later deny that he has
received message
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 15/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Security Related
Sender Transformation Information Security Related
Channel Transformation
PT Secure Secure PT
Message E Message Message D Message
Opponent
Secret
Secret Key
Key
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 16/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 17/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
1. Plaintext
2. Encryption algorithms
3. Secret Key
4. Cipher text
5. Decryption algorithms
✓ Sender and receiver must have obtained the secret key in secure
fashion
X^
Cryptanalyst
Y^
X
Encryption Y Decryption
X
Message Message
Algorithm Algorithm
Source Destination
Key
Source
Secure
Channel
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 18/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
X= Dk(Y)
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 19/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Packet sniffing/snooping:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 20/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
IP Spoofing:
✓ e.g.: C pretends to be B
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 21/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 22/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Cryptographic Techniques:
✓ Substitution
✓ Transposition (Permutation)
Substitution Method
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 23/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Caesar’s Cipher
The Caesar cipher involved in replacing each letter of alphabet with the
letter standing three places further down the alphabet
i.e.
P.T.: A B C D E F G …….. Z
C.T.: D E F G H I J ……… C
P.T.: A B C D E F G …….. Z
N.V.: 0 1 2 3 4 5 6 …….. 25
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 24/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
P = D(C) = (C – K) mod 26
✓ T R I O A S Then
✓ Rarely used is J K Q X Z
P.T.: A B C D E F G …….. Z
C.T.: D E F G H I J ……… C
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 25/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 26/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Playfair Cipher:
Key: - MONARCHY
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Rules of Substitution:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 27/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
2. Form the pair of alphabets if letters are not having even alphabet
then add filler alphabet Z at end
3. If both letters fall in the same row of the key matrix, replace each
with the letter to its right (wrapping back to start from end), e.g.
“AR" encrypts as "RM"
4. If both letters fall in the same column, replace each with the letter
below it (again wrapping to top from bottom), e.g. “MU" encrypts to
"CM"
5. Otherwise each letter is replaced by the one in its row in the column
of the other letter of the pair, e.g. “HS" encrypts to "BP", and “EA"
to "IM" or "JM" (as desired)
M O N A R M O N A R
C H Y B D C H Y B D
E F G I/J K E F G I/J K
L P Q S T L P Q S T
U V W X Z U V W X Z
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 28/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Transposition Method:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 29/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
CT: MEMATRHTGPRYETEFETEOAAT
Example: “attack postponed until two am” with key 4312567: first
read the column marked by 1, then the one marked by 2, etc.
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 30/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
If we number the letters in the plaintext from 1 to 28, then the result
of the first encryption is the following permutation of letters from
plaintext: 03 10 17 24 04 11 18 25 02 09 16 23 01 08 15 22 05 12 19
26 06 13 20 27 07 14 21 28
17 09 05 27 24 16 12 07 10 02 22 20 03 25 15 12 04
23 19 14 11 01 26 21 18 08 06 28
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 31/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Inverse element: for each a∈G, there exists an element a’∈G such
that a •a’= a’•a=e.
Note that the set of integers with the multiplication (Z,x,1) isnot a
group: the inverse element does not exist for all integers (it exists only
for 1 and –1)
Example:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 32/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Rings:
Integral domain if
✓ It is commutative
✓ It has unity element
✓ It has no zero divisors: if a•b=0, then either a=0, or b=0
Example:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 33/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Fields:
Example:
The set of rational numbers (Q, +, •, 0, 1), the set of real numbers (R,
+, •, 0, 1) are fields
Finite Fields:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 34/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Modular Arithmetic:
For any integer a, there exists integers q and r such that a=qn+r and r
is from 0 to n-1
Example:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 35/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Euclid (a, b)
Steps:
gcd (a, b)
1. A =a, B=b
2. if B=0
3. return A=gcd(a, b)
4. R=A mod B
5. A=B
6. B=R
7. go to step 2
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 36/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Example:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 37/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Input that differ in one bit should generate output that differ
in many bits
2. No. Of Rounds :
✓ More rounds are generally better, but they cost in reduced
performance
3. F-Function :
✓ Must be difficult to unscramble
✓ Should be non-linear
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 38/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Encryption
process at
E E E
sender end
D Four D
Decryption
process at
receiver end
Four Four Four
Major problem with block cipher is repeating blocks for which same
cipher block is generated which gives cryptanalyst clue regarding the
original data
To deal with above problem of block cipher, block ciphers are used in
chaining mode
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 39/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Fiestel Cipher:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 40/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
M C
L1 R1 R3 L3
f K1 f K2
+ +
L2 R2 R2 L2
f K2 f K1
+ +
L3 R3 R1 L1
C M
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 41/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Block Size
✓ Key Size
✓ No. of Rounds
✓ Round key generation algorithms
✓ Scrambling Function
DES History
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 42/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
DES Structure
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 43/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 44/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Message block Mi (64 bits) is split into left half-block Li (32 bits)
and right half block Ri (32 bits)
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 45/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ The eight S-Boxes – each takes 6 bits (of the 48 bits above) and
generates 4 bits (resulting in 32 bits)
✓ The resulting 32 bits are permuted and XORed with the left half-
block Li to create right half-block Ri+1
Expand Function (32 inputs / 48 outputs):
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 46/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ First and sixth input bits select row (between 0 and 3 in table
below)
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 47/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Number of output bits that change when one input bit is changed
✓ Number of output bits that change when one key bit is changed
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 48/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ 4 keys in which each half of the key (after PC-1) is either all 0’s
or all 1’s
✓ 12 keys in which each half of the key (after PC-1) is one of the
following: all 0’s, all 1’s, alternating 0’s and 1’s, and alternating
1’s and 0’s
DES strength:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 49/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 50/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
✓ Several approaches:
✓ Other Algorithms
DES Variants:
DES
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 51/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Double DES:
M=DK2(Dk1(C))
Where
✓ M- Plain text block
✓ C- Cipher Text
✓ ENC- Encryption Process
✓ DEC- Decryption Process
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 52/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
2- key Triple-DES
Properties:
✓ Two keys (112 bits)
✓ Strength about O(2110) against Meet-in-the-Middle
✓ Compatible with regular DES when K1= K2
M=DK1(Ek2(DK1(C)))
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 53/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
3- KEY TRIPLE-DES
EEE Mode:
M=DK3(Dk2(DK1(C)))
EDE Mode:
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 54/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Algorithmic Modes
✓ For encrypting all the block of message same key and algorithm
is used
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 55/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
K1 K2 Kn
Encrypt Encrypt Encrypt
CT1 CT2 CT n
K1 K2 Kn
Decrypt Decrypt Decrypt
PT1 PT2 PT n
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 56/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
PT
PT PT
IV XOR XOR
XOR
K1 K2 Kn
Encrypt Encrypt Encrypt
CT1 CT2 CT n
✓ As shown in figure first step receives two inputs i.e. first PT block
and random vector IV (Initialization Vector)
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 57/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
CTn
CT CT2
K1 K2 Kn
Decrypt Decrypt Decrypt
XOR XOR
IV XOR
PT1 PT2 PT n
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 58/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
IV Encrypt CT of IV
Key
Step 2:
✓ C is transmitted to receiver
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 59/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
XOR
Cipher text1
(c)
Step 3:
Left shift IV by
J-positions IV
Move j-bits of C in IV C
rightmost side of IV
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 60/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Step 4:
✓ Now step1 to step 3 continues until all the plain text block are
encrypted i.e. following steps repeats
✓ IV is encrypted
K K K
E E E
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 61/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
K K K
E E E
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 62/63
UNIT-I FOUNDATIONS OF CRYPTOGRAPHY AND SECURITY
Question:
1. What are essential ingredients of a symmetric cipher?
3. How many keys are used by two peoples to communicate via cipher
12. Explain Euclid’s algorithm with suitable example for generating GCD
More secure if she encrypts the message two times each time,
Each time with different key. Is she right? Defend your answer.
17. Define greatest common divisor of two integers. Which algorithm can
18. Explain why modern block ciphers are designed as substitution ciphers
20. Encrypt “ MEET ME AFTER TOGA PARTY “ by using caesar cipher, Rail fence
Compiled by: MS VIBHA PANDEY of Computer Science & Engg, SSTC , BHILAI 63/63