3. Contents
A model for Network Security
Classical encryption techniques
• Symmetric cipher model
• Substitution ciphers
• Caesar Cipher
• Monoalphabetic Cipher
• Playfair Cipher
• Hill Cipher
• Polyalphabetic Ciphers
• One time pad,
• Steganography.
Department of CSE- Data Science
4. A Model for Network Security
Department of CSE- Data Science
Figure 1.1 : Model for Network Security
5. Department of CSE- Data Science
All the techniques for providing security have two components:
1. A security-related transformation on the information to be sent. Examples
include the encryption of the message, which scrambles the message so that
it is unreadable by the opponent, and the addition of a code based on the con
tents of the message, which can be used to verify the identity of the sender.
2. Some secret information shared by the two principals and, it is hoped,
unknown to the opponent. An example is an encryption key used in
conjunction with the transformation to scramble the message before
transmission and unscramble it on reception.
6. Department of CSE- Data Science
A trusted third party may be needed to achieve secure transmission.
― For example, a third party may be responsible for distributing the secret
information to the two principals while keeping it from any opponent.
― Or a third party may be needed to arbitrate disputes between the two
principals concerning the authenticity of a message transmission.
This general model shows that there are four basic tasks in designing a particular
security service:
1. Design an algorithm for performing the security-related transformation. The
algorithm should be such that an opponent cannot defeat its purpose.
2. Generate the secret information to be used with the algorithm.
3. Develop methods for the distribution and sharing of the secret information.
4. Specify a protocol to be used by the two principals that makes use of the
security algorithm and the secret information to achieve a particular security
service.
7. Department of CSE- Data Science
Figure 1.2 : Network Access Security Model
Figure 1.2 reflects a concern for protecting an information system from un wanted
access.
The hacker can be someone who, with no malign intent, simply gets satisfaction
from breaking and entering a computer system.
The intruder can be a disgruntled employee who wishes to do damage or a
criminal who seeks to exploit computer assets for financial gain (e.g., obtaining
credit card numbers or performing illegal money transfers).
Another type of unwanted access is the placement in a computer system of logic
that exploits vulnerabilities in the system and that can affect application programs
as well as utility programs, such as editors and compilers.
8. Department of CSE- Data Science
Another type of unwanted access is the placement in a computer system of logic that
exploits vulnerabilities in the system and that can affect application programs as well
as utility programs, such as editors and compilers.
Programs can present two kinds of threats:
1. Information access threats: Intercept or modify data on behalf of users who should
not have access to that data.
2. Service threats: Exploit service flaws in computers to inhibit use by legitimate users
Viruses and worms are two examples of software attacks. Such attacks can be
introduced into a system by means of a disk that contains the unwanted logic
concealed in otherwise useful software. They can also be inserted into a system
across a network
9. Department of CSE- Data Science
The security mechanisms needed to cope with unwanted access fall into two
broad categories
1. The first category might be termed a gate keeper function. It includes
password-based login procedures that are designed to deny access to all but
authorized users and screening logic that is designed to detect and reject
worms, viruses, and other similar attacks.
2. Once either an unwanted user or unwanted software gains access, the second
line of defense consists of a variety of internal controls that monitor activity
and analyze stored information in an attempt to detect the presence of
unwanted intruders.
10. Basic Concepts
Plaintext: The original message
Cipher text : The coded message
Enciphering / Encryption: The process of converting plaintext to cipher text using a
cipher and a key
Deciphering / Decryption: the process of restoring the plaintext from the cipher
text
Cryptanalysis : techniques used for deciphering a message without any knowledge
of the enciphering details .Also called code breaking
Cryptology : Both cryptography and cryptanalysis
Department of CSE- Data Science
12. A symmetric encryption scheme has five ingredients
1. Plaintext: The original intelligible message or data that is fed into algorithm as
input
2. Encryption algorithm: performs various substitution and transformations on
the plaintext
3. Secret key: input to the encryption algorithm.
4. Cipher text: scrambled message produced as output
5. Decryption algorithm: takes cipher text and secret key and produces the
original plaintext
Two requirements for secure use of symmetric encryption
– a strong encryption algorithm
– a secret key known only to sender / receiver
Department of CSE- Data Science
13. A source produces a message in plaintext,X =
[X1, X2, ..,XM].
For encryption, a key of the form K = [K1, K2,
….,KJ] is generated.
If the key is generated at the message source
then it must also be provided to the
destination by means of some secure channe
Alternatively, a third party could generate the
key and securely deliver it to both source and
destination
Fig: Model of Symmetric Cryptosystem
Department of CSE- Data Science
14. With the message X and the encryption key K
as input, the encryption algorithm forms the
ciphertext Y = [Y1, Y2,… ,YN].
Y = E(K, X)
The intended receiver, in possession of the
key, is able to invert the transformation:
X = D(K, Y)
Fig: Model of Symmetric Cryptosystem
Department of CSE- Data Science
15. Cryptography
Cryptographic systems are characterized along three independent dimensions
The type of operations used for transforming plaintext to ciphertext
- Substitution
- Transposition
The number of keys used
- symmetric, single-key, secret-key, or conventional encryption
- asymmetric, two-key, or public-key encryption
The way in which the plaintext is processed
- Block cipher
- Stream cipher
Department of CSE- Data Science
16. Cryptanalysis and Brute-Force Attack
There are two general approaches to attacking a conventional encryption scheme
1. Cryptanalysis
- rely on the nature of the algorithm plus some knowledge of the general
characteristics of the plaintext or even some sample plaintext–ciphertext pairs
- exploits the characteristics of the algorithm to attempt to deduce a specific
plaintext or to deduce the key being used
2. Brute-force attack
- The attacker tries every possible key on a piece of ciphertext until an intelligible
translation into plaintext is obtained
- On average, half of all possible keys must be tried to achieve success
Department of CSE- Data Science
17. Table 1: Types of attacks on Encrypted Messages
Department of CSE- Data Science
18. substitution technique
letters of plaintext are replaced by other letters or by numbers or symbols
If the plaintext is viewed as a sequence of bits, then substitution involves replacing
plaintext bit patterns with ciphertext bit patterns
Caesar Cipher
involves replacing each letter of the alphabet with the letter standing three places
further down the alphabet. For example,
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
Department of CSE- Data Science
19. plain text : a b c d e f g h i j k l m n o p q r s t u v w x y z
cipher text: d e f g h i j k l m n o p q r s t u v w x y z a b c
0 1 2 3 4 5 6 7 8 9 10 11 12
A B C D E F G H I J K L M
13 14 15 16 17 18 19 20 21 22 23 24 25
N O P Q R S T U V W X Y Z
Department of CSE- Data Science
20. Then the algorithm can be expressed as follows. For each plaintext letter p,
substitute the ciphertext letter C
C = E(3, p) = (p + 3) mod 26
A shift may be of any amount, so that the general Caesar algorithm is
where k takes on a value in the range 1 to 25
The decryption algorithm is simply
C = E(k, p) = (p + k) mod 26
p = D(k, C) = (C - k) mod 26
Department of CSE- Data Science
21. If it is known that a given ciphertext is a Caesar cipher, then a brute-force cryptanalysis is
easily performed: simply try all the 25 possible keys
Table 2: Brute force cryptanalysis
Department of CSE- Data Science
22. Three important characteristics of this problem enabled us to use a bruteforce
cryptanalysis
-The encryption and decryption algorithms are known
-There are only 25 keys to try
-The language of the plaintext is known and easily recognizable
Fig: sample of compressed text
Department of CSE- Data Science
23. Monoalphabetic cipher
The “cipher” line can be any permutation of the 26 alphabetic characters,then there are
26! possible keys
This would seem to eliminate brute-force techniques for cryptanalysis
single cipher alphabet (mapping from plain alphabet to cipher alphabet) is used per
message
English language- the nature of the plaintext is known
Department of CSE- Data Science
24. 0 1 2 3 4 5 6 7 8 9 10 11 12
A B C D E F G H I J K L M
13 14 15 16 17 18 19 20 21 22 23 24 25
N O P Q R S T U V W X Y Z
Example: Plain Text: MYSURU
cipher text: BFXPIP
Department of CSE- Data Science
26. Monoalphabetic Cipher example: GZGEWVGRNCP
CT G Z G E W V G R N C P
PT E E E
PT E E T E
PT E E T E A
PT E E T E L A
PT E E T E L A N
PT E E T E P L A N
PT E X E C U T E P L A N
Department of CSE- Data Science
28. Pros and cons
Pros
1.Better security than Caeser cipher
Cons
2.Monoalphabetic ciphers are easy to break because they reflect the frequency data of
the original alphabet
3.Prone to guessing attack using the English letter frequency of occurrence of letters
Department of CSE- Data Science
29. Playfair Cipher
Multiple-letter encryption cipher which treats digrams in the plaintext as single units and
translates these units into ciphertext digrams
The Playfair algorithm is based on the use of a 5 * 5 matrix of letters constructed using a
keyword.
For the encryption process let us consider the following example
key: monarchy
Plaintext: instruments
Department of CSE- Data Science
30. The Playfair Cipher Encryption Algorithm:
The Algorithm consists of 2 steps:
1. Generate the key Square(5×5):
- The key square is a 5×5 grid of alphabets that acts as the key for encrypting
the plaintext.
- The initial alphabets in the key square are the unique alphabets of the key in
the order in which they appear followed by the remaining letters of the
alphabet in order.
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
Department of CSE- Data Science
31. 2. Algorithm to encrypt the plain text: The plaintext is split into pairs of two letters
(digraphs). If there is an odd number of letters, a Z is added to the last letter.
For example
PlainText: "instruments"
After Split: 'in' 'st' 'ru' 'me' 'nt' ‘sz’
Rule 1: Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the
previous letter.
example : Plain Text: “hello”
After Split: ‘he’ ‘lx’ ‘lo’ --- Here ‘x’ is the bogus letter.
Department of CSE- Data Science
32. Rule 2: If the letter is standing alone in the process of pairing, then add an extra bogus letter
with the alone letter
e.g.,: Plain Text: “helloe”
After Split: ‘he’ ‘lx’ ‘lo’ ‘ez’ -----Here ‘z’ is the bogus letter.
Rule 3: If both the letters are in the same column |↓| wrap around i.e., Take the letter below
each one (going back to the top if at the bottom).
e.g.,: Diagraph: "me"
Encrypted Text: cl (m -> c, e -> l)
Department of CSE- Data Science
33. Rule 4: If both the letters are in the same row |→| wrap around i.e., Take the letter to the
right of each one (going back to the leftmost if at the rightmost position).
Example : Diagraph: "st“
Encrypted Text: tl(s -> t, t -> l)
If neither of the above rules is true: Form a rectangle with the two letters and take the letters
on the horizontal opposite corner of the rectangle.
Example: Diagraph: "nt“
Encrypted Text: rq (n -> r, t -> q)
Department of CSE- Data Science
34. For example
Plain Text: "instrumentsz"
Encrypted Text: gatlmzclrqtx
Encryption
i-> g n-> a s-> t t-> l r-> m u-> z m-> c e-> l
n-> r t-> q s-> t z-> x
Department of CSE- Data Science
35. Using this Playfair matrix:
Encrypt this message: Must see you over Cadogan
West. Coming at once.
Department of CSE- Data Science
36. Hill Cipher
Multi-letter cipher
Developed by the mathematician Lester Hill in 1929
Encrypts group of letters: digraph, trigraph or polygraph
Review few terminologies from linear algebra
- matrix arithmetic modulo 26
- Square matrix
- Determinant
- Multiplicative inverse
Department of CSE- Data Science
37. The Hill Algorithm
C = E(K,P) = PK mod 26
P = D(K,C) = CK-1
mod 26 = PKK-1
mod 26
K11 K12 K13
(C1,C2,C3)=(P1,P2,P3) K21 K22 K23 mod 26
K31 K32 K33
C1 = (P1 K11 + P2 K21 + P3 K31 ) mod 26
C2 = (P1 K12 + P2 K22 + P3 K32 ) mod 26
C3 = (P1 K13 + P2 K23 + P3 K33 ) mod 26
Encryption
Department of CSE- Data Science
38. Example: Encryption
Plain text: pay more money
Key: 17 17 5
21 18 21
2 2 19
PT: pay mor emo ney
P A Y M O R E M O N E Y
15 0 24 12 14 17 4 12 14 13 4 24
Department of CSE- Data Science
39. • Encrypting : pay
K11 K12 K13
(C1,C2,C3)=(P1,P2,P3) K21 K22 K23 mod 26
K31 K32 K33
17 17 5
(C1,C2,C3)=(15 0 24) 21 18 21 mod 26
2 2 19
= (15*17+0*21+24*2 15*17+0*18+24*2 15*5+0*21+24*19) mod 26
= (303 303 531) mod 26
= (17 17 11)
(C1,C2,C3) = (R R L)
Department of CSE- Data Science
Department of CSE- Data Science
40. • Encrypting : mor
K11 K12 K13
(C1,C2,C3)=(P1,P2,P3) K21 K22 K23 mod 26
K31 K32 K33
17 17 5
(C1,C2,C3)=(12 14 17) 21 18 21 mod 26
2 2 19
= (12*17+14*21+17*2 12*17+14*18+17*2 12*5+14*21+17*19) mod 26
= (532 490 677) mod 26
= (12 22 1)
(C1,C2,C3) = (M W B)
Department of CSE- Data Science
41. • Encrypting : emo
K11 K12 K13
(C1,C2,C3)=(P1,P2,P3) K21 K22 K23 mod 26
K31 K32 K33
17 17 5
(C1,C2,C3)=(4 12 14) 21 18 21 mod 26
2 2 19
= (4*17+12*21+14*2 4*17+12*18+14*2 4*5+12*21+14*19) mod 26
= (348 312 538) mod 26
= (10 0 18)
(C1,C2,C3) = (K A S)
Department of CSE- Data Science
42. • Encrypting : ney
K11 K12 K13
(C1,C2,C3)=(P1,P2,P3) K21 K22 K23 mod 26
K31 K32 K33
17 17 5
(C1,C2,C3)=(13 4 24) 21 18 21 mod 26
2 2 19
= (13*17+4*21+24*2 13*17+4*18+24*2 13*5+4*21+24*19) mod 26
= (353 341 605) mod 26
= (15 3 7)
(C1,C2,C3) = (P D H)
Department of CSE- Data Science
43. PT P A Y M O R E M O N E y
CT R R L M W B K A S P D H
Plain text: pay more money
Cipher text: rrlmwbkaspdh
Department of CSE- Data Science
63. The strength of this cipher is that there are multiple ciphertext letters for each plaintext
letter, one for each unique letter of the keyword. Thus, the letter frequency information is
obscured.
Cryptanalysis
Determining the length of the keyword
Key and the plaintext share the same frequency distribution of letters, a statistical
techniques can be applied
Department of CSE- Data Science
65. One – Time Pad
Random key that is as long as the message
The key need not be repeated
In addition, the key is to be used to encrypt and decrypt a single message and then is
discarded
Each new message requires a new key of the same length as the new message
Such a scheme, known a one-time pad, is unbreakable.
No statistical relationship to the plain text
Because the ciphertext contains no information whatsoever about the plaintext, there is
simply no way to break the code
Department of CSE- Data Science
66. Example
Consider the ciphertext
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
We now show two different decryptions using two different keys:
ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
plaintext mr mustard with the candlestick in the hall
ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key : pftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
plaintext: miss scarlet with the knife in the library
Department of CSE- Data Science
67. Suppose that a cryptanalyst had managed to find these two keys.
Two possible plaintexts are produced. How is the cryptanalyst to decide which is the correct
decryption (i.e., which is the correct key)?
If the actual key were produced in a truly random fashion, then the cryptanalyst cannot say
that one of these two keys is more likely than the other.
Thus, there is no way to decide which key is correct and therefore which plaintext is correct.
In fact, given any plaintext of equal length to the ciphertext, there is a key that produces that
plaintext. Therefore, if you did an exhaustive search of all possible keys, you would end up
with many legible plaintexts, with no way of knowing which was the intended plaintext.
Therefore, the code is unbreakable.
The security of the one-time pad is entirely due to the randomness of the key
Department of CSE- Data Science
68. Two fundamental difficulties
The practical problem of making large quantities of random keys
Even more daunting is the problem of key distribution and protection
Because of these difficulties, the one-time pad is of limited utility and is useful primarily
for low-bandwidth channels requiring very high security
Department of CSE- Data Science
69. Perfect secrecy
The one-time pad is the only cryptosystem that exhibits what referred to as perfect
secrecy
perfect secrecy is the notion that , given an encrypted message (or ciphertext) from a
perfectly secure encryption system(or cipher), absolutely nothing will be revealed about
the unencrypted message(or plaintext) by the cipherext.
Department of CSE- Data Science
70. Steganography
Steganography is the practice of concealing a message within another message or
physical object in a way that the hidden message is not obvious to an observer.
It differs from cryptography, which aims to make a message unreadable, as
steganography focuses on concealing the very existence of the message itself
A simple form of steganography, but one that is time-consuming to con struct, is
one in which an arrangement of words or letters within an apparently innocuous
text spells out the real message.
For example, the sequence of first letters of each word of the overall message
spells out the hidden message.
Department of CSE- Data Science
71. Department of CSE- Data Science
Figure : A Puzzle for Inspector Morse
a subset of the words of the overall message is used to convey the hidden message.
See if you can decipher this; it’s not too hard.
72. Various other techniques have been used historically; some examples are the
following
• Character marking: Selected letters of printed or typewritten text are over
written in pencil. The marks are ordinarily not visible unless the paper is held at
an angle to bright light.
• Invisible ink: A number of substances can be used for writing but leave no visible
trace until heat or some chemical is applied to the paper.
• Pin punctures: Small pin punctures on selected letters are ordinarily not visible
unless the paper is held up in front of a light.
• Typewriter correction ribbon: Used between lines typed with a black ribbon, the
results of typing with the correction tape are visible only under a strong light
Department of CSE- Data Science
73. Steganography has a number of drawbacks when compared to encryption. It
requires a lot of overhead to hide a relatively few bits of information
Alternatively, a message can be first encrypted and then hidden using
steganography.
The advantage of steganography is that it can be employed by parties who have
something to lose should the fact of their secret communication (not necessar ily
the content) be discovered.
Encryption flags traffic as important or secret or may identify the sender or
receiver as someone with something to hide.
Department of CSE- Data Science