CNS Unit1
CNS Unit1
Network Security
10/9/2024 1
Syllabus
10/9/2024 2
10/9/2024 3
Objective of Unit -1
4
Brief Introduction about subject
Computer data often travels from one computer to another, leaving the
safety of its protected physical surroundings. Once the data is out of hand,
people with bad intention could modify or forge your data, either for
amusement or for their own benefit.
Cryptography can reformat and transform our data, making it safer on its trip
between computers. The technology is based on the essentials of secret
codes, augmented by modern mathematics that protects our data in powerful
ways.
Computer Security - generic name for the collection of tools designed to
protect data and to thwart hackers
Network Security - measures to protect data during their transmission
Internet Security - measures to protect data during their transmission
over a collection of interconnected networks
5
Introduction to security
10/9/2024 6
Introduction to Security
10/9/2024 7
Computer Security Challenges
1. not simple – easy to get it wrong
2. must consider potential attacks
3. procedures used counter-intuitive
4. involve algorithms and secret info
5. must decide where to deploy mechanisms
6. battle of wits between attacker / admin
7. not perceived on benefit until fails
8. requires regular monitoring
a process, not an event
9. too often an after-thought
10. regarded as impediment to using system
“Unusable security is not secure”
Aspects of Security
• consider 3 aspects of information security:
– security attack
– security mechanism (control)
– security service
• note terms
– threat – a potential for violation of security
– vulnerability – a way by which loss can happen
– attack – an assault on system security, a
deliberate attempt to evade security services
Network Security(Attack)
10/9/2024 10
Security Attacks
• A useful means of classifying security attacks,
is in terms of passive attacks and active
attacks.
• A passive attack attempts to learn or make
use of information from the system but does
not affect system resources.
• An active attack attempts to alter system
resources or affect their operation.
Network Security(Attack)
Normal Flow:
10/9/2024 12
Network Security(Attack)
Wiring,
eavesdrop
10/9/2024 14
Network Security(Attack)
Replaced info
intercept
10/9/2024 15
Network Security(Attack)
10/9/2024 16
Network Security(Attack)
10/9/2024 17
Types of Active Attacks
10/9/2024 18
1. Masquerade
An unauthorized entity tries to gain more privileges than it is
authorized for.
Masquerading is generally done by using stolen IDs and
passwords, or through by passing authentication mechanisms.
10/9/2024 19
2. Replay
10/9/2024 20
3. Modification of messages
10/9/2024 21
4. Denial of service (DoS)
10/9/2024 22
Types of Active Attacks
10/9/2024 24
Types of Passive Attacks
– Traffic analysis
10/9/2024 25
Release of Message Contents
10/9/2024 26
Traffic analysis
10/9/2024 27
Network Security Services
10/9/2024 28
Network Security Services
10/9/2024 29
Network Security Services
10/9/2024 30
Security Mechanism
• feature designed to detect, prevent, or
recover from a security attack
• no single mechanism that will support all
services required
• however one particular element underlies
many of the security mechanisms in use:
– cryptographic technique
Security Mechanisms
10/9/2024 32
Relation between security services and mechanisms
10/9/2024 33
Model for Network Security
Model for Network Security
• using this model requires us to:
1. design a suitable algorithm for the security
transformation
2. generate the secret information (keys) used by
the algorithm
3. develop methods to distribute and share the
secret information
4. specify a protocol enabling the principals to use
the transformation and secret information for a
security service
Network Security Techniques
10/9/2024 36
Cryptography
Cryptography is technique of securing information and
communications through use of codes so that only those
person for whom the information is intended can
understand it and process it.
Decipher P = D(K2)(C)
Plaintext ciphertext
Encipher C = E(K1)(P)
10/9/2024 38
Conventional Encryption
Symmetric Encryption
• or conventional / private-key / single-key
• sender and recipient share a common key
• all classical encryption algorithms are private-
key
• was only type of encryption in use prior to
invention of public-key in 1970’s
• and by far most widely used
Some Basic Terminology
• plaintext - original message
• ciphertext - coded message
• cipher - algorithm for transforming plaintext to ciphertext
• key - info used in cipher known only to sender/receiver
• encipher (encrypt) - converting plaintext to ciphertext
• decipher (decrypt) - recovering ciphertext from plaintext
• cryptography - study of encryption principles/methods
• cryptanalysis (codebreaking) - study of principles/ methods
of deciphering ciphertext without knowing key
• cryptology - field of both cryptography and cryptanalysis
Symmetric-Key Cipher
10/9/2024 42
Requirements
• two requirements for secure use of symmetric
encryption:
– a strong encryption algorithm
– a secret key known only to sender / receiver
• mathematically have:
Y = EK(X)
X = DK(Y)
• assume encryption algorithm is known
• implies a secure channel to distribute key
Symmetric-Key Cipher Co1
10/9/2024 44
Cryptography
• characterize cryptographic system by:
– type of encryption operations used
• substitution / transposition / product
– number of keys used
• single-key or private / two-key or public
– way in which plaintext is processed
• block / stream
Cryptanalysis
• objective to recover key not just message
• general approaches:
– cryptanalytic attack
rely on the nature of the algorithm plus perhaps some
knowledge of the general characteristics of plaintext or
even some sample plaintext-cipher text pairs.
– brute-force attack
try every possible key on a piece of cipher text until an
intelligible translation into plaintext is obtained. On
average, half of all possible keys must be tried to achieve
success.
Cryptanalysis
Cryptanalysis attacks
10/9/2024 47
Cryptanalysis(Ciphertext-only attack)Co1
Ciphertext-only attack
10/9/2024 48
Cryptanalysis(Known-plaintext attack) CO1
Known-plaintext attack
10/9/2024 49
Cryptanalysis(Chosen-plaintext attack) CO1
Chosen-plaintext attack
10/9/2024 50
Cryptanalysis(Chosen-ciphertext attack) CO1
Chosen-ciphertext attack
10/9/2024 51
• Unconditionally Secure
• Computationally Secure
• Unconditionally Secure: An encryption scheme is
unconditionally secure if the ciphertext generated by the
scheme does not contain enough information to determine
uniquely the corresponding plaintext, no matter how much
ciphertext is available. That is, no matter how much time an
opponent has, it is impossible for him or her to decrypt the
ciphertext simply because the required information is not
there. There is no encryption algorithm that is unconditionally
secure(except One-Time pad).
• Computationally Secure: an algorithm that meets one or
both of the following criteria:
• • The cost of breaking the cipher exceeds the value of the
encrypted information.
• • The time required to break the cipher exceeds the useful
lifetime of the information.
Classical Encryption Techniques
• Substitution Cipher Technique
• Transposition Cipher Technique
Substitution cipher CO1
10/9/2024 55
Types of substitution techniques
• Caesar Cipher
• Monoalphabetic Cipher
• Playfair Cipher
• Hill Cipher
• Polyalphabetic Cipher
• One time pad
Caesar Cipher
• earliest known substitution cipher by Julius
Caesar
• replaces each letter by 3rd letter on
• example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
Caesar Cipher
• can define transformation as:
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
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
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher Security
• now have a total of 26! = 4 x 1026 keys
Playfair Cipher
C=KP mod 26
Example
For example, the plaintext “code is ready” can make a 3 × 4
matrix when adding extra bogus character “z” to the last
block and removing the spaces. The ciphertext is
“OHKNIHGKLISS”.
10/9/2024 72
Example
• Plaintext =paymoremoney and encryption key
C = E(K, P) = KP mod 26
P = D(K, C) = K-1C mod 26
One-Time Pad
• if a truly random key as long as the message is used, the
cipher will be secure
• 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 as a one-time pad, is unbreakable.
• It produces random output that bears no statistical
relationship to the plaintext. Because the ciphertext contains
no information whatsoever about the plaintext, there is
simply no way to break the code.
• problems in generation & safe distribution of key
One Time Pad
• ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
• key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
• plaintext: mr mustard with the candlestick in the hall
• ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
• key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
• plaintext: miss scarlet with the knife in the library
• In theory, we need look no further for a cipher. The one-time pad
offers complete security but, in practice, has two fundamental
difficulties:
• 1. There is the practical problem of making large quantities of
random keys. Any heavily used system might require millions of
random characters on a regular basis. Supplying truly random
characters in this volume is a significant task.
• 2. Even more daunting is the problem of key distribution and
protection. For every message to be sent, a key of equal length is
needed by both sender and receiver. Thus, a mammoth key
distribution problem exists.
• Because of these difficulties, the one-time pad is of limited utility
and is useful primarily for low-bandwidth channels requiring very
high security.
Transposition Ciphers
• now consider classical transposition or permutation
ciphers
• these hide the message by rearranging the letter
order
• without altering the actual letters used
• can recognise these since have the same frequency
distribution as the original text
• Two Technique
Rail Fence Cipher
Row transpositions Cipher
Transposition Chiper
Types
-Rail Fence
-Columnar transposition
-Double transposition
10/9/2024 80
Transposition Chiper(Rail fence cipher) CO1
10/9/2024 81
Row Transposition Ciphers
• a more complex transposition
• write letters of message out in rows over a specified
number of columns
• then reorder the columns according to some key
before reading off the rows
• “The simplest possible
Transposition”
• Key: 4 1 5 3 2
10/9/2024 83
Transposition Chiper(Columner cipher) CO1
Alice and Bob can agree on the number of columns and use
the second method. Alice writes the same plaintext, row by
row, in a table of four columns.
10/9/2024 84
Transposition Chiper(Columner cipher)
Example 1
10/9/2024 85
Transposition Chiper(Double Columner cipher) CO1
10/9/2024 86
Symmetric ciphers CO1
Types
1 Stream Ciphers
2 Block Ciphers
10/9/2024 87
Block vs Stream Ciphers
• block ciphers process messages in blocks, each
of which is then en/decrypted
• like a substitution on very big characters
– 64-bits or more
• stream ciphers process messages a bit or byte
at a time when en/decrypting
• many current ciphers are block ciphers
– better analysed
– broader range of applications
Modern Block Cipher CO1
10/9/2024 89
Block Cipher Principles
• most symmetric block ciphers are based on a Feistel
Cipher Structure
• needed since must be able to decrypt ciphertext to
recover messages efficiently
• block ciphers look like an extremely large
substitution
• would need table of 264 entries for a 64-bit block
• instead create from smaller building blocks
• using idea of a product cipher
Block vs Stream Ciphers
Claude Shannon and Substitution-
Permutation Ciphers
➢ Claude Shannon introduced idea of substitution-
permutation (S-P) networks in 1949 paper
➢ form basis of modern block ciphers
➢ S-P nets are based on the two primitive
cryptographic operations seen before:
⚫ substitution (S-box)
⚫ permutation (P-box)
➢ provide confusion & diffusion of message & key
Shannon’s Theory of Confusion and Diffusion CO1
Diffusion
The idea of diffusion is to hide the relationship between
the ciphertext and the plaintext.
Note
Diffusion hides the relationship between the
ciphertext and the plaintext.
10/9/2024 93
Shannon’s Theory of Confusion and Diffusion
Confusion
The idea of confusion is to hide the relationship between
the cipher-text and the key.
Note
Rounds
Diffusion and confusion can be achieved using iterated
product ciphers where each iteration is a combination of S-
boxes, P-boxes, and other components.
10/9/2024 94
Feistel Cipher Structure
• Horst Feistel devised the feistel cipher
– based on concept of invertible product cipher.
• Feistel cipher is a design model designed to create different
block ciphers, such as DES.
• The model uses substitution and permutation alternately.
• This cipher structure is based on the Shannon model
proposed in 1945.
Note
10/9/2024 102
10/9/2024 103
Data Encryption Standard (DES) CO1
10/9/2024 104
General structure of DES
10/9/2024 105
Data Encryption Standard (DES) CO1
A round in DES
(encryption site)
10/9/2024 106
10/9/2024 108
Data Encryption Standard (DES) CO1
10/9/2024 109
Data Encryption Standard (DES) CO1
Note
10/9/2024 110
Data Encryption Standard (DES) Function CO1
10/9/2024 111
10/9/2024 112
Data Encryption Standard (DES) Function CO1
Expansion P-box
Expansion permutation
10/9/2024 113
Faculty Name Subject code and
10/9/2024 114
abbreviation Unit Number
Data Encryption Standard (DES) Function CO1
10/9/2024 115
Faculty Name Subject code and
10/9/2024 116
abbreviation Unit Number
10/9/2024 117
Data Encryption Standard (DES) Function CO1
10/9/2024 122
10/9/2024 123
Strength of DES
• Label of security provided by DES concern two area:-
(i) Key size (ii) nature of algorithm
Key Size
• 56-bit keys have 256 = 7.2 x 1016 values
• brute force search looks hard
• On average half of the key has to be searched
• DES finally and definitively proved insecure in July
1998by (EFF)
• still must be able to recognize plaintext
• must now consider alternatives to DES such as AES
,Double DES and Triple DES
Multiple Data Encryption Standard (DES) Co1
Types
1. Double DES
2. Triple DES
10/9/2024 125
Double Data Encryption Standard (DES) CO1
10/9/2024 126
Double Data Encryption Standard (DES) CO1
10/9/2024 127
Double Data Encryption Standard (DES) CO1
10/9/2024 128
Double Data Encryption Standard (DES) CO1
10/9/2024 129
Double Data Encryption Standard (DES) CO1
Instead of using 2112 key search tests, we have to use 256 key
search tests two times.
Moving from a Single DES to Double DES, we have to
increased the strength from 256 to 257.
10/9/2024 130
Triple Data Encryption Standard (DES) CO1
The 1st, 3rd stage use 𝐾1 key and 2nd stage use 𝐾2 key.
10/9/2024 131
Triple Data Encryption Standard (DES) CO1
10/9/2024 133
Triple Data Encryption Standard (DES) CO1
10/9/2024 134
Avalanche effect
• Desirable property of any encryption algorithm is
that a small change in either the plaintext or the key
should produce a significant change in the
ciphertext. This effect is called avalanche effect
• In particular, a change in one bit of the plaintext or
one bit of the key should produce a change in many
bits of the ciphertext.
• If the change were small, this might provide a way to
reduce the size of the plaintext or key space to be
searched.
• DES exhibits a strong avalanche effect.
Strength of DES
• Label of security provided by DES concern two area:-
(i) Key size (ii) nature of algorithm
Key Size
• 56-bit keys have 256 = 7.2 x 1016 values
• brute force search looks hard
• On average half of the key has to be searched
• DES finally and definitively proved insecure in July
1998by (EFF)
• still must be able to recognize plaintext
• must now consider alternatives to DES such as AES
,Double DES and Triple DES
Strength of DES
• Label of security provided by DES concern two area:-
(i) Key size (ii) nature of algorithm
Key Size
• 56-bit keys have 256 = 7.2 x 1016 values
• brute force search looks hard
• On average half of the key has to be searched
• DES finally and definitively proved insecure in July
1998by (EFF)
• still must be able to recognize plaintext
• must now consider alternatives to DES such as AES
,Double DES and Triple DES
Block Cipher Modes of Operation
A block cipher takes a fixed-length block of text of length b bits and a key as input
and produces a b-bit block of ciphertext. If the amount of plaintext to be encrypted
is greater than b bits, then the block cipher can still be used by breaking the
plaintext up into b-bit blocks. When multiple blocks of plaintext are encrypted using
the same key, a number of security issues arise. To apply a block cipher in a variety
of applications, five modes of operation have been defined by NIST.
(1) Electronic code book (ECB): The simplest mode, in which plaintext is handled
one block at a time and each block of plaintext is encrypted using the same key. The
term codebook is used because, for a given key, there is a unique ciphertext for
every b-bit block of plaintext. The ECB method is ideal for a short amount of data,
such as an encryption key.
138
10/9/2024 139
Block Cipher Modes of Operation
(2) Cipher Block Chaining Mode (CBC): In this scheme, the input to the encryption algorithm
is the XOR of the current plaintext block and the preceding ciphertext block; the same key is
used for each block. Therefore, if the same plaintext block is repeated, different ciphertext
blocks are produced. For decryption, each cipher block is passed through the decryption
algorithm. The result is XORed with the preceding ciphertext block to produce the plaintext
block. We can define CBC mode as
The IV is an initialization block, which is produced using random number generator and it
should be the same size as the cipher block. This must be known to both the sender and
receiver but it should be unpredictable by a third party.
10/9/2024 140
10/9/2024 141
Stream Modes of Operation
• block modes encrypt entire block
• may need to operate on smaller units
– real time data
• convert block cipher into stream cipher
– cipher feedback (CFB) mode
– output feedback (OFB) mode
– counter (CTR) mode
• use block cipher as some form of pseudo-
random number generator
Cipher Feedback Mode (CFB) –
In this mode the cipher is given as feedback to the next block of encryption
with some new specifications: first, an initial vector IV is used for first
encryption and output bits are divided as a set of s and b-s bits. The left-hand
side s bits are selected along with plaintext bits to which an XOR operation is
applied. The result is given as input to a shift register having b-s bits to lhs,s bits
to rhs and the process continues. The encryption and decryption process for
the same is shown below, both of them use encryption algorithms.
10/9/2024 143
Faculty Name Subject code and
10/9/2024 144
abbreviation Unit Number
(4) Output Feedback Mode (OFB): This scheme operates on full blocks of plaintext
and ciphertext where the output of the encryption function is fed back to become
the input for encrypting the next block of plaintext.
Let the size of a block be b. If the last block of plaintext contains u bits, with u < b,
the most significant u bits of the last output block ON are used for the XOR
operation. In the case of OFB, the IV must be a nonce; that is, the IV must be unique
to each execution of the encryption operation.
10/9/2024 145
10/9/2024 146
Cipher Modes of Operation
(5) Counter Mode (CTR): In this mode, each block of plaintext is XORed with an
encrypted counter. Typically, the counter is initialized to some value and then
incremented by 1 for each subsequent block being encrypted using the same key.
Given a sequence of counters T1, T2, …, TN, we can define CTR mode as follows:
The advantages of the CTR are (1) hardware and software efficiency, (2)
preprocessing, (3) random access, (4) provable security and (5) simplicity.
10/9/2024 147
10/9/2024 148
Faculty Video Links, Youtube & NPTEL Video Links and Online
Courses Details
1. https://youtu.be/Q-HugPvA7GQ
1. https://nptel.ac.in/courses/106105162/
2. http://www.nptelvideos.in/2012/11/cryptography-and-network-
security.html
10/9/2024 150
Daily Quiz
10/9/2024 151
Daily Quiz
10/9/2024 152
MCQ s
(a) Authentication
(b) Authorization
(c) Integration
10/9/2024 153
MCQ s
10/9/2024 154
MCQ s
(a) Masquerade
(b) Replay
10/9/2024 155
MCQ s
(a) Masquerade
(b) Modification
(c) Repudiation
(d) Snooping
10/9/2024 156
MCQ s
(a) Encryption
(b) Decryption
(c) Cryptography
(d) Cryptanalyst
10/9/2024 157
MCQ s
(a) Ciphertext
(b) Ciphers
(c) Key
10/9/2024 158
MCQ s
10/9/2024 159
MCQ s
10/9/2024 160
MCQ s
10/9/2024 161
MCQ s
(a) Public
(b) Private
(d) Shared
10/9/2024 162
MCQ s
10/9/2024 163
MCQ s
(a) Affine
(b) Caesar
(c) Autokey
(d) Shift
10/9/2024 164
MCQ s
(a) One-to-one
(b) One-to-many
(c) Many-to-one
(d) Many-to-many
10/9/2024 165
MCQ s
10/9/2024 166
MCQ s
(a) Additive
(b) Hill
(c) Playfair
10/9/2024 167
MCQ s
(b) S-box
(c) P-box
10/9/2024 168
MCQ s
(a) Diffusion
(b) Confusion
10/9/2024 169
MCQ s
(a) Five
(b) Ten
(c) Eight
(d) Six
10/9/2024 170
MCQ s
10/9/2024 171
MCQ s
(b) S-box
(c) P-box
10/9/2024 172
Old Question Papers
https://aktu.ac.in/question-bank.html
10/9/2024 173
Expected Questions for University Exam
wearecomputersciencestudents
10/9/2024 174
Summary
➢ computer, network, internet security
➢ X.800 standard
➢ Security attacks, services, mechanisms
➢ Models for network (access) security
➢ Classical cipher techniques and terminology
➢ Transposition cipher
➢ Product ciphers and Rotor machines
➢ Stenography and Cryptography
➢ DES
10/9/2024 175
Thank You
10/9/2024 176