CSS (Comps)
CSS (Comps)
Module
Unit Detailed Content Hrs
No. No.
Introduction and Number Theory
10
1.1 Security Goals, Services, Mechanisnms and attacks,
The OSI
security architecture, Network security model, Classical
Encryption techniques, Symmetric cipher model, mono-alphabetic
and poly - alphabetic substitution techniques : Vigenere cipher,
playfair cipher, Hill cipher, transposition techniques : keyed and
keyless transposition ciphers, steganography. (Refer Chapter 1)
1.2 Modular Arithmetic and Number Theory : Euclid's algorithm
-
Prime numbers Fermat's- and Euler's theorem - Testing for
primality - The Chinese remainder theorem, Discret logarithms.
(Refer Chapter 2)
2 Symmetric and Asymmetric key Cryptography and key Management 12
2.1 Block cipher principles, block cipher modes of operation, DES,
Double DES, Triple DES, Advanced Encryption Standard (AES),
Stream Ciphers : RCS algorithm. (Refer Chapter 3)
2.2 Public key cryptography : Principles of public key cryptosystems -
The RSA algorithm, The knapsack algorithm, ElGamal
Algorithm. (Refer Chapter 4)
2.3 Key management techniques : using symmetric and asymmetric
algorithms and trusted third party. Diffie Hellman Key exchange
algorithm. (Refer Chapter 5)
3 Hashes, Message Digests and Digital Certificates 06
3.1 Cryptographic hash functions, Properties of secure hash function,
MD5, SHA-1, MAC, HMAC, CMAC. (Refer Chapter 6)
3.2 Digital Certificate : X.509, PKI. (Refer Chapter 7)
4 Authentication Protocols & Digital signature schemes 08
4.1 User Authentication and Entity Authentication, One - way and
mutual authentication schemes, Needham Schroeder
Authentication protocol, Kerberos Authentication protocol.
(Refer Chapter 8)
Scanned by CamScanner
Module Unit Detailed Content Hrs.
No. No.
4.2 Digital Signature Schemes RSA, EIGamal and Schnorr signature
schemes. (Refer Chapter 9)
5 Network Security and Applications 10
5.1 Network security basics : TCP/IP vulnerabilities (Layer wise),
Packet Sniffing, ARP spoofing, port scanning, IP spoofing, TCP
syn flood, DNS Spoofing.
(Refer Chapter 10)
5.2 Denial of Service Classic DOS attacks, Source Address La
spoofing, ICMP flood, SYN flood, UDP flood, Distributed Denial
Le
of Service, Defenses against Denial of Service Attacks.
1.
(Refer Chapter 11)
5.3 Internet Security Protocols : SSL, IPSEC, Secure Email : PGP, 2
Scanned by CamScanner
Lab Syllabus
Lab Outcome :
4 For varying message sizes, test integrity of message using MD -5, SHA -1,
and analyse the performance of the two protocols. Use crypt APls.
Scanned by CamScanner
Sr. No.
Descriptlon
5 Study the use of
network reconnaissance
nslookup to gather tools like WHOIS, dig,
information about traceroute,
networks and domain
6 Study of packet registrars.
sniffer tools : wireshark,
:
1. Download and
instll wireshark and capture
promiscuous mode. icmp, tcp, and
htp packets in
2. Explore how
the packets can be traced based on different
7 filters.
Download and install nmap.
Use it with different
perform OS fingerprinting, options to scan open
ports,
do a ping scan, tcp port scan,
Scan etc. udp port scan, xmas
Scanned by CamScanner
Crypt. & Sys. Security
(MU-Sem. 6-Comp)
oute,
Table of Contents
Module 1
s
Chapter1:Introduction to Cryptography
in
Syllabus : Security Goals,
Servicos, Mochanisms to
1-1 1-57
model, Classical Encryption and attacks, The OSI
techniques, Symmetric soCurity architocturo,
techniques : Vigenere cipher model, mono-alphabetic Network security
cipher, playfair clpher, and poly-alphabetic
Hill cipher, substitution
ts, ciphers, steganography. transposltion techniquos :
koyed and keyless
transposition
1.1 Introduction ...
Syllabus Topic : Security
Goals. 1-1
1.2 Security Goal (Dec.
15) 1-2
Syllabus Topic : Services...
1-2
1.3 Security Service (Dec. ....
16).... 1-4
Syllabus Topic : Mechanisms
and Attacks.. 1-4
1.4 Security Mechanisms (Dec.
15, May 16)... 1-8
1.4.1 Specific Security Mechanism/ 1-8
Attack Prevention.
1.4.2 Pervasive Security Mechanisms 1-8
/ Attack Detection,
1.4.3 Attack Avoidance 1-9
1.5 Security Attack (May 18). 1-9
1.5.1 Difference between Active 1-10
Attack and Passive Attack.
Syllabus Topic : The OSI Security 1-16
Architecture..
1.6 The OSI Security Architecture.. 1-16
Syllabus Topic : Network Security 1-16
Model.
1.7 Operational Model for 1-17
Network Security
1.8 Basic Terminology in Network 1-17
Security.
1.8.1 Cryptanalysis/ Cryptographic Attacks. 1-18
1.9
Syllabus Topic : Classical Encryption
Encryption Methods.
Techniques .. 1-20
1-23
Scanned by CamScanner
Table of Contents
Crypt. & S
6-Comp) 2
Sys. Security(MU-Sem.
Coypt. & 1-31
Block Cipher..
.. 1-32 Syllabus
1.10.2 Euclic
Block Cipher (Dec. 16)..
Differentiate between Stream and 1-32
2.2
1.10.3 2.2.1
Confusion and Diffusion..
1.10.4 1-33
and Diffusion. Syllabus
1.10.4(A) Difference betwccen Confusion 1-34
Techniques. Chine
and Poly-alphabctic Substitution 2.3
Syllabus Topic : Mono-alphabetic 1-34 SyllabuS
Substitution Cipher Techniques (Dec. 15)... ... 1-35
1.11
2.4 Eule
1.11.1 Caesar Cipher...
.. 1-36 2.4.1
1.11.2 Monoalphabetic Cipher
1-37 Syllabus
1.11.3 Polyalphabetic Cipher (Dec. 15).. .
1-37 Disc
1.11.3(A) Procedure of Polyalphabetic Cipher. 2.5
1.11.3(B) Difference between Polyalphabetic and Monoalphabetic (Dec. 17)......... 139 2.6 Fern
1-39 Chapte
Syllabus Topic : Playfair Cipher..
1.11.4 Playfair Cipher... 1-39
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
3
Table of Contents
:
Syllabus Topic Euclid's Theorem
Euclid's or Euclidean Algorithm. .2-4
2.2
2-4
2.2.1 Extended Euclidean Algorithm.
Syllabus Topic : The Chinese Remainder .2-8
Theorem...
2.3 Chinese Remainder Theorem.. 2-11
Scanned by CamScanner
cypt. & S
Table of Contents
6-Comp)
Socurity(MU-Sem. 4.3.1(e
Crypt. & Sys. .3-1s
4.3.1(
Final Permutation.. ..3-15
3.3.5
Strength of DES s*.3-16 4.3.1(
3.3.6
Weakness in DES .3-16 4.3.2
3.3.7
Syllabus Topic : Double DES. .3-16 Syllabus
3.3.8 Double DES 3-17 Knap=
DES.
4.4
V Syllabus Topic: Triple .3-17 4.4.1
3.3.9 Triple DES ****.3-18 4.4.2
Syllabus Topic : Advance Encryption
Standard (AES).
.3-18 4.4.3
Advance Encryption Standard (AES)....
3.4 3-18 Syllabus
3.4.1 Introduction to AES.
.. 3-18 4.5 EIGa
3.4.2 Silent Features of ABS.........*.
.3-19 4.5.1
3.4.3 AES Encryption and Decryption Process...
3-20 4.5.2
3.4.4 Detail Steps for AES Encryption.
.3-24 4.5.3
3.4.5 AES Decryption.
Advace 4.5.4
3.4.5(A) Difference between Data Encryption Standard (DES) and
3-24 4.5.5
Data Encryption Standard (AES).
.3-25 • Chapte
Syllabus Topic : RC5 Algorithm.
3.5 RCS Algorithm. 3-25 Chas
•
5.:
Chapter Ends .3-28
:
Syllabus Ke
Chapter 4: Public 4-30
Key Cryptography 41to Hellmari Key e
:
RSA Algorithm Working, Key Length, Security (May
4.3
17).. 4-5
5.
4.3.1 Computational Aspects.... .. 4-l
5.
4.3.1(A) Exponentiation in Modular Arithmetic....... 4
5.
4.3.1(B) Efficient Operation using the Public Key.. 4-5
Scanned by CamScanner
Crypt. & Sys. Security(MU-Sem. 6-Comp)
6 Table of Contents
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem. 6-Comp) Tableof Conterte
6
Module3
Chapter 6:Cryptographic Hash Functions
6-1 to 6-25
Syllabus: Cryptographic hash functions, Properties
of secure hash function, MD5,
SHA-1, MAC, HMAC, CMAC.
6.1 Hash Functions.
6-1
Syllabus Topic : Cryptographic Hash
Functions.
6-1
6.1.1 Cryptographic Hash Functions
6-1
6.1.2 Applications of Cryptographic
Hash
6.2 Simple Hash Functions 6-2
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp) 7 Table of Contents
Scanned by CamScanner
Table of Contents Crypt. &
6-Comp)
Security(MU-Sem.
Crypt.& Sys.
Module 4
8-1 to &-11 Chapter 10
10.4
| Syllabus : Digital Signature Schemes- RSA, EIGamal and Schnorr signature schemes.
9.1 Digital Signature (May 16, Dec. 16) 9-1
Scanned by CamScanner
Contents
Table of Contents
Crypt. & Sys. Security (MU-Sem, 6-Comp)
to Module 5
&-11
-... Syllabus : Network security basics : TCPIP vulnerabilitles (Layor wiso), Packet Sniffing, ARP spoofing, port
8-1 scanning. IP spoofing. TCP syn flood, DNS Spoofing.
....8-1 Syllabus Topic : TCP/IP Vulnerabilitices (Layer wise).
-... 10-1
8-2 TCP/IP Vulnerabilities (Layer Wise)....
.. 8-2
10.1 10-1
. 8-2
10.1.1 Application Layer. 10-1
10.1.2 Transpot Layer ....
.&-3 10-3
10.1.3 Network Layer.
.&-3 10-4
10.1.4 Data Link Layer.
8-5 10-7
10.1.5 Physical Layer ...
8-5 10-8
Syllabus Topic : Packet Sniffing....
8-5 10-9
10.2 Packet Sniffing.
8-7
10-9
3-7 Syllabus Topic : ARP Spoofing....
10-9
10.3 ARP Spoofing
10-9
1 10.3.1 What Is ARP Spoofing?....
10.3.2 10-9
ARP Spoofing Attacks.
Syllabus Topic : Port Scanning.. 10-9
10.5 10-11
P Spoofing (Dec. 15)
Syllabus Topic : TCP SYN 10-11
Flood
10.6 TCP SYN Flood 10-11
10.6.1 Attack Description. 10-11
Syllabus Topic : DNS 10-12
Spoofing
10.7 DNS Spoofing.. 10-12
10.7.1 Methods for Executing a 10-12
DNS Spoofing
Atack
Chapter Ends 10-13
.10-13
Scanned by CamScanner
Table of Contents
.... 11-9
11.6 Distributed Denial of Service Attacks
11-9
11.6.1 Distributed Denial of Service Attacks....
Attacks. 11-10
11.6.2 Characteristics of Distributed Denial of Service
11-12
11.6.3 Methods of Denial of Service Attacks..
Attacks... 11-14
Syllabus Topic : Defenses against Denial of Service
11-14
11.7 Defenses against Attacks
SyL
.11-14
Chapter Ends
12.5
12-1 to 12-48
Chapter 12: Internet Security Protocols
pots.
Syllabus: Internet Security Protocols SSL, IPSEC, Secure Email PGP, Firewalls, IDS and types, Honey
:
:
-
Syllabus Topic : Internet Security Protocols SSL, IPSEC. 12-1 S
12-1 12.6
12.1 Secure Socket Layer (SSL) (Dec. 15, Dec. 17)
Working of SSL. 12-3
12.1.1
.. 12-4
12.1.1(A) Handshake Protocol (May 16).....
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1
Table of Contents
12-11
12.2.1 Authentication Header.
12.2.2 Encapsulating Security Payload ... 12-11
12-14
12.2.3 Security Association Database
(Dec. 17) ....
Syllabus Topic : Firewalls 12-18
12-33
12.4.3(A) Signature Based Detection
12-33
12.4.3(B) Anomaly Based Detection.
... 12-34
12.4.3(C) Stateful Protocol Analysis .
12-36
12.4.4 Types of IDS.
12-36
12.4.4(A) Network based IDS (NIDS)
12-37
12.4.4(B) Host Based IDS (HIDS)
12-39
Syllabus Topic : Secure Email - PGP....
12-39
12.5 Electronic Mail Security : Pretty
Good Privacy (May 16)..
12-39
12.5.1 Working of Pretty Good Privacy (Dec.
15)..
12-41
12.5.2 Backdoors and Key Escrow in PGP.
12-45
Syllabus Topic : Honey Pots..
..
12-47
12.6 Honeypot..
12-47
Chapter Ends ....
.....12-48
Scanned by CamScanner
Table of
Contents
12 CHAR
6-Conmp
(MU-Sem.
Crypt. & Sys. Security
42 Module6 13-1 to 13-21
injection, Malware
SQL
Vulnerabllltles scripting,
Software cross-site
Chapter 13 : Overflow,
Format string,
13-1
Vulnerabilities : Butfer
Syllabus: Software Bomb, Bots, Rootkits. 13-1
Trojans, Logic
| Viruses, Wons,
13-2
13.1
Program Security.
Secure Programs Errors (Dec.
15).. 13-4
13.1.1
Non-malicious Program Syllabus
13.1.2 13-4
- Bomb, Bots.
: Malware Logic Security
Syllabus Topic 13-6
13.1.3
Malicious Software. Network
13-6
Worms mono-al
Syllabus Topic: Viruses and
Worms (Dec. 15, Dec. 16). 13-7
cipher,
13.1.4 Vius and
13.1.4(A) Types of Virus
13-8 steganog
13.1.4(B) Types of Computer
Worms 13-9
and Worm.
13.1.4(C) Difference between Virus 13-10
- Rootkits.
Syllabus Topic Malware Trojans, Intr
:
13-10 1.1
13.1.5 Targeted Malicious Code.. 13-12
13.1.6 Controls against Program Threats
...,.. In toda
- 13-13
Syllabus Topic : Software Vulnerability Buffer Overflow. on infc
13-13
13.2 Buffer Overflow (Dec. 15)..... Sensiti
- 13-15
Syllabus Topic : Software Vulnerability Format String.
13-15 The th
13.3 Format String Attacks.
Syllabus Topic : Cross Site Scripting..
13-18 is a ne
13.4 Cross Site Scripting (Dec. 16, Dec. 17).... 13-18 internE
... 13-19
13.4.1 Stored and Reflected XSS Attacks The I
13.4.2 Stored XSS Attacks 13-19
When
13.4.3 Reflected XSS Attacks 13-19
on a C
13.4.4 Other Types of XSS Vulnerabilities. 13-19
13.4.5 XSS Attack Consequences
Amor
13-20
Syllabus Topic : SQL Injection . 13-20
of all
Scanned by CamScanner
CHAPTER Module1
Introduction to Cryptography
Syllabus
Security Goals, Services, Mechanisms
and attacks, The OSI security architecture,
Network security model, Classical
Encryption techniques, Symmetric
mono-alphabetic and poly-alphabetic substitution cipher model,
techniques : Vigenere cipher, playfair
cipher, Hill cipher, transposition techniques :
keyed and keyless transposition ciphers,
steganography.
1.1 Introduction
Among those millions upon millions look at where we are. The fact is that about 30- 40%
of all users are aware of the things happening on their computers. The other simply either
don't care or don't have the proper knowledge to recognize if their system is under attack
and or being used by unauthorized users.
On the Internet nothing is quite what it appears to be, because information is just
transferred from one computer to another in a heartbeat. The uninformed will get hurt in
many ways.
Scanned by CamScanner
Introduction 10 Cryptography
6-Conmp) 1-2
Crypt. & Sys. Security (MU-Sem. Crypt. &
Sys
Goals
Syllabus Topic : Security
2. Integrit
Principle of
1.2 Security Goal (MU - Dec. 15) reaches to a
2.
Integrity
3. Availa
Principle of
3. Availability
the time a
4. Data Authentication available to
software an
Fig. 1.2.1 : Goal of information security
For example
1. Confidentiality
Informatiom
Confidentially is most common aspect of information security.
Confidentially is defined on email ac
as the contents of a message are accessed
only by intended person. Aim of confidentially time as on
is that only sender and his intended receiver should
be able to access the contents of a authorized
message.
There is o
For example
attack.
In military application information
from one higher authority is sending These th
authority. During this transmission process to another highet
when third unknown person objectives
this confidential information is trying to get
which is not desired. This type
because of interception third person. of information leakage caused
of Here sender and receiver are
contents of message
which causes
unable to access the
loss of message confidentially.
The attack threatening the confidentiality
is traffic analysis.
Because of interception
occurred between sender
confidentially.
of receiver, sender is losing messag
Scanned by CamScanner
hu
For example
Information
stored in bank, student's information stored
in universities information stored
on email accounts.
All these information need to be available to
all authorized users at any
time as on when required. Imagine the situation if all above
information is nöt available to
authorized users.
There is only one attack which threatening principle of availability called
denial of service
attack.
These three concepts are termed as CIA triad and represent fundamental security
objectives for data and information services as shown in Fig. 1.2.2.
Information
security
Availability
Scanned by CamScanner
GryYptography
Introduction to
1-4 Crypt.
(MU-Sem. 6-Comp) & Sys.
Crypt. & Sys. Security
4
Data Authentication X.800 define
4. networks.
many applications in
is important in was sent
Data authentication to check whether that data really
or receiver
allows the user
Data authentication
by the actual sender or not. symmetric
this mechanism is achieved through
- party communication
In the two
cryptography. Authentication Code
share a secret key to calculate a Message
The sender and receiver
(MAC) of all communication data.
message
exact or actual sender, if and only if
Receiver knows that the data is send by
arrives with a correct MAC.
a property that a data has not been modified when it will
Data origin authentication is
transmit, this means data integrity.
Data origin
authentication 1. AuthenL
Sign and verify
Application data It is asSurano
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-5 Introduction to Cryptography
1. Authentication
2. Authorization
3. Access Control
4. Non-Repudiation
5. Auditing
6. Data Integrity
7.Data Confidentiality
1. Authentication
It is assurance of parties that they are authentic user in the communication network.
Authentication helps to identify the claimed identity of an entity, such as username
password or any other important information such as encryption or decryption keys stolen
during transmission between sender and receiver.
It can be further classified as follows:
() Peer entity authentication : It checks that the entities connected in communication
network are authentic and do not perform any attack like masquerade and replay of
messages in network.
(ii) Data origin authentication : It checks that the data is authentic without any changes
received by the receiver.
> 2. Authorization
Authorization service helps for checking whether the entity has the right to perform action
requested. Authorization means providing authority or pernission of accessing the system
or privilege of accessing data, directories, files etc of the system.
Scanned by CamScanner
Introduction to Cryptograph
crypt.
1-6
Security (MU-Sem. 6-Comp)
Crypt. & Sys.
There
For example withdrawing
money and bio. helps
while
sever login, ATM pin jdentification. An authorization
princip
Password used for are valid user o D
employee 6.
an office for checking company employee
machine used in ATM card
user and
helps
server administrator,
whether To as
modificatic
not.
Access Control prevent (1) Conne
3.
the access to the host systems. It
control
ability to limit and resources i Conne
Access Control is the
to prevent unauthorized use of a
resource. The service used ocoe
unauthorized use of a resources, under what conditions access can attem
complete control
over who can access to
(ii) Check
methodology.
and what are different accessing
Comm
For example
It is protec
Ramesh sends a request to bank about money transfer into Suresh account but later o
Ramesh Denying the money transfer request to bank. Principle of non-repudiation does () Conn
allow such type of refuses of sender. Non-repudiation prevents either sender or proted
receiver fro
denying a transmitted message. (ii) Conn
5. Auditing (iiü) Selec
COnne
Auditing services helps to trace which üser accessed what ? when? and which way
(iv) Traf
In general auditing does not provide protection but can be the tool for analysis
data
problems.
Scanned by CamScanner
There are different security mechanism arc uscd to provide security services and
also
helps to prevent all types of attacks.
6. Data Integrity
To assure that the message receIVed is as sent with no
duplications, insertions or
modifications, delays or replays. The destructions of messages
have also been recovered.
() Connection integrity with recOvery : It provides integrity
of the user data on a
connection and detects modifications, insertions, deletions or
replay if any with a recovery
attempted.
(ii) Checks Connection integrity wthout recovery : It checks the integrity of the data in
communication network and detects various attacks like modification,
deletion replay of
messages in network but without any recovery of same.
(iv) Connectionless integrity : It determines and checks the modification of single data block
and for preserving its integrity in connectionless network.
7. Data Confidentiality
(iv) Traffic flow confidentiality : To protect data that might be derived from observing the
data flow.
Scanned by CamScanner
Syllabus Topic : Mechanisms and Attacks
Q. 1.4.1 Specify mechanisms to achieve each goal. (Ref. seo. 1.4) Dec. 15,3 Marks
defines systematic way to Defining the requirements for security. Characterizing the
4. Data integrity
Various mechanisms used to assure the integrity of the data. Content should not nou
before it reaches to intended person.
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp) 1-9 Introduction to Cryptography
5. Authentication Exchange
The mechanism used to ensure the identity of thc entity by information
exchange.
6. Traffic Padding
To insert bits into gaps in the data stream to frustrate
traffic analysis attempt.
7. Routing Control
To allow some selected routes in network for routing or can change
the route if any attack
is detected in the network.
These mechanisms are not specific to any of the OSI security service or
protocol layer.
This technique also called attack detection which is implemented to prevent,
if attacker bypass
the installed security measures to access the desired target/information. Attack detection
technique notifies such incidents happens and takes the responsibility to report someone
that
something went wrong somewhere in the system. Such type of mechanisms used to
inform the
administrator or authorized user that something went wrong in the system now its
job of
administrator or authorized user to take action against detected attack.
1. Event detection
Detection of security related events. Intrusion Detection technique is
the best example of
event detection.
In these techniques data is sent over an insecure channel such as Internet in encrypted
ormat and decrypted at receiver side using keys under assumptions that attacker may
have
ICcess to the transmitted data.
Scanned by CamScanner
P Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-10 Introduction to Crypiography
The
encryption and decryption is performed on sending data by using well
cryptographic mechanisms such as: kngwn
Q.
1.5.1
List and explain various types
>
(MU - May 18)
of attacks on encrypted message.
(Ref. sec. 1.5)
Q. 1.5.2 May 18, 5 Marks
Categories the different attacks.
llustrate hoW passive attacks lead to bu
loss. (Ret, sec. 1.5) business
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-11 Introduction to Cryptography
Passlve Attacks
2. Traffic analysis
FA
Intenet or
other comms taclity
Bob Allce
For Example
Telephonic conversation between two people, an electronic mail and a file may
contents sensitive information sent/ transfer over insecure channel such as Internet.
We would like to prevent third person from modification of these type of transmission
as shown in Fig. 1.5.3.
The main goal is to prevent the cryptanalyst from learning sensitive and confidential
information through transmissions that take place through telephone calls or email
messages or files transferred on network.
Scanned by CamScanner
Introduction to Gryptogrank
1-12
(MU-Sem. 6-Comp) Crypt. &
Sys. Securi
Crypt. & Sys. Security
2. Traffic analysis
message using encryption.
contents of the
Suppose we mask the able to capture
the contents of th.
called third person) ismessage.
The Opponent (here it is
information from the
message but not extract the or anv e
or
C
Internet
other commsfacility
Bob Alice
Scanned by CamScanner
? Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-13 Introduction to Cryptography
Active attacks
Masquerade Replay
Moditication Denlal of
servico (Dos)
or.
Internet
other comms facility
Bob Allce
Such type of attack involves pretending the user from accessing authorized
information.
2. Replay Attack (Rewrite)
It is a network attack in which original data get modified and new malicious
code
added into valid data, during transmission.
The newly generated malicious code retransmitted again and again to receiver called
as replay attack (Reusing information).
Scanned by CamScanner
Introduction to Cryptography
1-14
(MU-Sem. 6-Comp) Crypt.
Crypt. &
Sys. Security &
Sy
The c
such ty
message from lost.
Darth tI Capture :
Denial
Internot or Commnu
other comms facilltly
Bob
Allce It is ger
making
Fig. 1.5.7 : Replay attack overloa
for userS
3. Modification of messages
In modification, the original data that has been sent by the authentic user is been
disrupt or modified by the attacker to make it non meaningful for the receiver.
Usually the content sequence is been changed.
Modification is also called replay attack. When contents of message
modified after
sender sends it but before it reaches to indented
recipients, such type of attack is
called modification of message as shown
in Fig. 1.5.8.
Due to in
Darth Darth modifies Because C
message from Bob
to Alice Suresh is
services am
Once Din
nternet or
Bob other comms tacility things :
Allce
Flood
Fig. 1.5.8: Modification overlo
of messages
For Example Block
author
If Bob wants to
transfe amount of Rs.1000/-
into Alice account, during syster
transmission process an this
attacker called Darth capture Differe
the actual amount Rs. the conversation and moditieo
of 1000/- and sends iust Rs.
100/- into Alice account. protec
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp)
1-15 Introduction to Cryptography
Intemet
Suresh
Server
Dinesh
Scanned by CamScanner
Introduction Coyptography
1-16
(MU-Sem. 6-Comp) Crypt.
Crypt. & Sys. Security Attack
2 and Passive
Active Attack
1.5.1 Difference between The O
Passive Attack
S
Active Attack
Sr. is
No. to observe the
Attacker merely needs S
physical control of or
1 Attacker needs to have communication in the media ho
detected. en
It cannot be easily.
2. It can be casily detected. TI
It does not affect the system.
3. It affects the system.
monitoring of data. se
of data. It involves in
4. It involves in modification
5
replay, denial of service, distributed denial message, traffic analysis.
1.7 Op
of service.
Conside
It does not check for loopholes or It scans the ports and network in search
6
vulnerabilities.
another acro
for loopholes and vulnerabilities.
aspects of tE
7. It is difficult to prevent network from Passive attack can be prevented.
The teC
active attack.
The ori
Syllabus Topic :The 0SI Security Architecture that it i
An add
1.6 The OSI Security Architecture
the mes
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp)
1-17 Introduction to Cryptography
Scanned by CamScanner
Introduction to Gryptography
1-18
Crypt. & Sys. Security
(MU-Sem. 6-Comp) cypt. & Sy=
???
Basically
Attacker
text into pl=
3. Encryptiom
Recipient
Secure The proces
Sender Message encryption.
Secure nformation channel message
Message message
Internet Let, P be th
Key
Key we get Cas
Scanned by CamScanner
hy
Crypt. & Sys. Security
(MU-Sem. 6-Comp)
1-19 Introduction
Basically there are two process to Cryptography
Scanned by CamScanner
Introductionto Gryptograph.
(MU-Sem. 6-Comp) 1-20
Crypt. & Sys. Security crypt. &
Sys. Se
use all possible keys, algorithms and
cryptanalyst attempt to message.
An attacker also called as Known Ple
ciphertext and obtain original plaintext 1.
techniques to break
In this type
7. Cryptology
as cryptology. text.
together is known
The area of
cryptography and cryptanalysis
He will finc
8. Key which type of atta
information or number used in encryption and decryption algorithm
It is the secret will discuss
is known only to the sender and receiver.
2. Ciphertext
1.8.1 Cryptanalysis/ Cryptographic Attacks In this type
algorithms: access to cor
Cryptographic attacks are designed to discover the loopholes in cryptographic
access to a only. Such ty;
these attacks are designed to decrypt data without prior permission and without
key. This is job of Cryptanalysis to find the weakness into the algorithm used for 3. Chosen Plai
encryption and decryption of data and then decipher the data. Before studying different
In this type
attacks against Data Encryption Standard we must know different types of cryptographic
later on find
attack nethods.
called choser
As mentioned above the process of trying to break any cipher text message to obtain the
corresponding plain text message is called cryptanalysis and the person
This attack h
who is attempting
cryptanalysis is called cryptanalyst. attacker to fi
used against
Cryptographic Attack Methods public key.
There are five cryptographic attack methods
that include plaintext-based as well as cipher 4, Chosen ciph
text based attacks.
In this type
Cryptographic Attack matching pla
Methods Such type of
may get the
1. Known Plaintext attack
5. Side channe
2. Cipher text attack
only
In this type
3. Chosen Plaintext attack designed cry
4. Chosen Cipher and keys use
text attack
Cryptanalys
5. Side Channel Attack
perform par
Fig. 1.8.3: Cryptographic channel atta
Attack Methods
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-21 Introduction to Cryptography
In this type of attack cryptanalyst always try to find out. which technology used to
designed cryptographic algorithms and which are the different software or hardware
and keys used during encryption and decryption process.
Cryptanalyst may find the additional information like CPU usage, time taken to
perform particular task, voltage used and so on. Such type of attack 'is called side
channel attack.
Scanned by CamScanner
Introductionto Cryptography
1-22
Security (MU-Sem.
6-Comp) Crypt. & Sys. SecL
Crypt. & Sys.
9
Vulnerability Itfocuses o
result in harm to
a
G Threats and may system
an incident that Privacy prog
potential cause
of
a
Threat is
such as log i
organization. or a goup Qf assets that ca,
of an asset (resource)
Vulnerability is a weakness (4) Principles of Sec
exploited by one or more threats. a
destruction of an asset as a result of The three co
damage, or
Risk is potential for loss, integrity of i
exploiting a vulnerability. defi
Privacy
Example: In
a
system that allows weak passwords,
information.
dictionary or exhaustive key attacks
Vulnerability : Password is vulnerable for security depe
to break into the system
Threat : An intruder can exploit the password weakness
prone for illegal access/ modify/ dama:
Risk : The resources within the system are
by the intruder.
1.9 Encryption
Threat agent-entities that would knowingly seek to manifest a threat.
Scanned by CamScanner
Cryptography
Types of cryptography
ereas
1. Symmetric Key Cryptography
Scanned by CamScanner
Introduction
Sys. Security (MU-Sem. 6-Comp)
1-24 to Cryptonr
Crypt. &
2 cypt. &
as P = D (K, E(P).
Mathematically it is represented
= plain text, D (K, E(P) = Decryption ofb o Disadva
Where P = Plain Text, E (P) Encryption of
text using shared key K. Once the
(DES), Adys to decryE
For Example Stream and block cipher, Data Encryption Standard
:
1.9.2 Asyr
Transmitted Asymmet
ciphertext
In asym
decryptior
Plaintext
Plaintext
As mentic
Encryption algorithm Decryption algorithm
(e.g. DES) (Reverse of encryption algorithm) that may -
Other is pr
Fig. 1.9.2: Symmetric Cipher Model
messages,
Here the possibility is that if an
attacker/opponent got cipher text It is also
different permutations and combinations ?? He/she may ap:
to decrypt and obtain
the main aim of cryptography came the original plain text. H only its co
is into picture. Always sender message.
different encoding technique on has to think on apply
plain text message and convert
so that attacker cannot
read the actual plain text
it into cipher text mess The sende
easily. signatures,
Symmetric cipher model
convert the plain text message decryption
following techniques. into cipher text by us
cryptosyste
G Advantages of Symmetric Sender
key cryptography (Ramesh)
Symmetric key is A
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-25 Introduction to Cryptography
Encryption using
RSA algorithm Decryption algorithm
Intermet
Encryption Decryption
using B's using B's
public key private key
Fig. 1.9.3: Asymmetric Key Cryptography
Scanned by CamScanner
Introduction to Cnypiogrephy
6-Comp)
1-26
Crypt. & Sys. Security (MU-Sem. 4 Crypt. & S
as P = D(Kd, E
(Ke,P))
represented s
Mathematically it is Decryption, Ke Encrypi
= Encryption
of plain
text, D= Public ke
Text, E (P)
Where
P= Plain claimed
key, Kd = Decryption Key. Suresh then th
communicate withthe receiver informati
Ramesh wants to communi. sender an
For example, sender
and public key then and then
each one of this i.e. private key denying a
must have
will be successful. know
Ramesh and Suresh must Principles
possible pair of keys that
Table 1.9.1 shows the understan
communicating with each other. Hellman
Table 1.9.1 : Pair of private and
public keys
For Exar
Should know
Key Details Ramesh(A) should knowSuresh (B) algorithm.
Ramesh Private Key (A) Yes A must know Not known to B Advantage
Ramesh Public Key(A) Yes A must know Yes it is known to Suresh also In Asymm
both have
Suresh private key (B) Not known to Ramesh (A) Yes Suresh (B) must know
data over iL
Suresh public key (B) Yes known to Ramesh (A) Yes Suresh (B) also known it The main =
Following-are the possible cases of public key cryptography as per the table mention
for used er
above. cannot dec
RSA algor
Case 1
cryptograp
1 When Ramesh wants to send a message to Suresh. Ramesh can encrypt
the message us Easy to use
Suresh public key. This is possible because Ramesh and Suresh
knows the public key.
2 Ramesh can send this message to Suresh (Keep in mind this Disadvant=
it is encrypted using Surs
public key). Because of
3 Suresh can decrypt the Ramesh message transmissic
by using Suresh own private key. Because o
Suresh knows his private key Ramesh key crypto
is not aware about Suresh private
key.
4. It is important to note that the message of data).
only decrypted using Suresh private
nothing else. key Asymmetr
cryptograp
Case 2
Scanned by CamScanner
| Crypt. & Sys. Security (MU-Sem. 6-Comp)
1-27 Introduction to Cryptography
Scanned by CamScanner
Securi
Sys.
Crypt. &
Introduction to Cyptograph Ciphe
1-28
Block
6-Comp 1.10
Crypt. & Sys. Socurity
(MU-Som. Gryptography cryptog
Asymmetrlc Key Basically an
Symmetric and cipher
Diference betwoen Asymmetric Key
Cryptography Stream
I.3.3 algorithm.
Cryptography
Sr
Symmetrle Key
Block
cipher pri
cryptography two
No. In asymmetric key and shown in
Fig. 1.1
cryptography single or one is tor encryption
1 In Symmetric key keys are used,
same key is used for encryption
and decryption.
other is for
decryption. is also
Asymmetric key cryptography
cryptography is also called cryptography or
2.
Symmetric key called as public key
as secret key cryptography
or private key system.
conventional cryptographic
cryptography. as
Mathematically it represented
3 Mathematically it is represented as
P= D(K, E (Ke,P)), 1.10.1 Stream CL
P=D (K, E(P). are encryption and
Where Ke and Kd
Where K is encryption and decryption In stream ciph
decryption key.
bit at a time,
key.
D = Decryption
P=plain text, accepting onl
E(Ke, P) = Encryption of plain text
D= Decryption One time pad
using private key Ke.
E(P) = Encryption of plain text XOR with ea
Because of two different key used on varying tin
4. Symmetric key is faster than asymmetric
key cryptography. asymmetric key is slower than
asymmetric key cryptography.
symmetric key cryptography still play'an text and cipher text treated as integer
important role. numbers.
Scanned by CamScanner
6-Comp) 1-29 Introduction to Cryptography
(MU-Sem.
Security
Crypt. & Sys.
Principles
Cipher
1.10
Block
is used for transformation of plaintext into cipheiext.
cryptographic algorithm
Basically cipher are main method of encrypting text using key and
and Block
Stream cipher
algorithm. explained on the basis of two different algorithm types
principles are
as
Block cipher
1.10.1.
shown in Fig.
Algorithm types
1. Stream Cipher
2. Block Cipher
In stream cipher keys and algorithms are applied to each binary digit in a data stream, one
stream cipher operates on plaintext
bit at a time, rather than encrypting block of data (a
accepting only one bit at a time).
each bit of plaintext message
One time pad is the best example of stream cipher in which
XOR with each bit of key to obtain cipher text
message. It is a symmetric cipher operates
on varying time transformation individually on each bit. This is shown in
Fig. 1.10.2.
Decryption
Encryption
keystream
keystream generator k
generator
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Introduction to Cyptography
1-30
During decryption, the cipher text bits are XOR with a same key stream to recover
the
plaintext bits. 1.1
P, = k,
..(1.10.2)
The stream cipher security depends on the simple XOR and one tme pad. lI the key
stream output is random that, it will take harder time for a cryptanalyst to break it
However if it will
keep on repeating same stream bits then it can result an attack on the
cryptosystem.
For example : Suppose we have plaintext as pay 100 in ASCII (i.e. text format). When it
is converted to binary values 1let us take that it is translating as
010111001 (hypothetically)
also applying XOR logic in encryption
algorithm. We can see effect as,
In text format In binary format
Pay 100 010111001 Plaintext
100101011 XOR operation with the key
ZTU91^%D 11010010 Cipher text
XOR Logic is shown in table below
Input 1
Input 2 Output
0
11
1
1
1
0
Rather than divide bit stream
into discrete blocks stream
into ciphertext message by encrypting one cipher convert plaintext messag:
bit at a time. At receiver side use same
XOR logic to extract plaintext message. key and
A known plaintext attack can
cipher because if two messages are succeed against a stream
encrypted with the same keystream,
ciphertexts will remove the XORing the tvo
keys and result in the XOR
of the plaintexts.
C1 C2 =
(p1 k) (p2 k)
= (pl p2) (k, k)
= pl p2) 00..0
C1 C2 = (p1p2)
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-31 Introduction to Cryptography
E
e -
54- bits bits 64 - bits 64- bits Ciphertext
block of 64 - bit
each
Fig. 1.10.3: Block cipher
Block cipher is main method of encrypting
text in which keys and algorithm are
block of data rather that individual applied to
bits like stream cipher. Data Encryption
(DES) is the best example of block Standard
cipher in which each block of 64-bit get
using 56-bit key and cipher text of 64-bit encrypted
get generated.
At receiver side decrypt message
with same key to generate plaintext.
Like in stream cipher, block cipher also uses
the concept of key generator. Block
are used in Chaining cipher
mode, this is because for repeating text pattern,
the same cipher
block will be generated which can give
clue to cryptanalyst regarding what is the original
plaintext hence chaining mode is used for
block ciphers. We will discuss concept of
chaining mode in block cipher modes
of operation.
As in chaining method, previous block is
mixed with current block to avoid repeats in
patterns. Block cipher is little time consuming
but secure than stream cipher so generally
used in computer based cryptographic algorithms. Stream
cipher is faster than block
cipher.
Scanned by CamScanner
Introduction to Gryptography
6-Comp) 1-32
Grypt. & Sys. Security(MU-Sem.
Block Cipher
1.10.3 Differentiate between Stream and (MU - Dec. 16)
- stream ciphers. It
Q. 1.10.1 Compare and contrast Block and
Dec. 16, 5 Marks cha
(Ref. sec. 1.10.3) tex
Block Cipher a c.
Sr. No. Stream Cipher
method of
Block cipher is main
1. Instream cipher keys and and
algorithms are applied to each
encrypting text in which keys
binary digit in a data stream,
one bit algorithm are applied to block of data
stream Da
at a time, rather than encrypting rather that individual bits like
block of data. cipher. 2.
2
Stream cipher is less time Block cipher is more time consuming. Ea
consuming. do
2.
2. Confusion
Scanned by CamScanner
?Crypt. & Sys. Security (MU-Sem. 6-Comp)
1-33 Introduction to Cryptography
1. Diffusion
Scanned by CamScanner
Introduction to GryYptography
Substitution Cipher
techniques
1. Caesar Cipher
2. Monoalphabetic Cipher
3. Polyalphabetic Cipher
4. Playfair Cipher
6. Hill Cipher
Scanned by CamScanner
1.11.1 Caesar Clpher
Julius Caesar introduced the easiest and the simplest use of substitution cipher.
In Caesar cipher technique cach letter is replaced by the letter /alphabet which is three
places next to that letter which is to be substituted. Or In Caesar cipher technique, each
alphabet of a plaintext is replaced with another alphabet but three places down the line as.
mentioned in table below.
For example
Ciphertext: VXQULVHVLQWKHHDVW
Following is the list of possible combination showing the letters 3 places down of each
:
alphabet
Plaintext a bc de f gh i j k L
m n o pqr st u v w x
y z
CiphertextD E
FGH IJ KL MNOP QRSTU VWXY Z
AB C
:
The corresponding number equivalent to each alphabet is given below
a bc d e f g
hi j k 1
m
P 4 r s t 11 W X y z
l0 1
2,3 4 5
678 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
C = E(3,P) = (P +3)mod 26
P= D(3,C) = (C--3)mod 26
P= Plaintext/ alphabet
E = Encryption
D = Decryption
Scanned by CamScanner
Introduction to Cryptograns.
(MU-Sem. 6-Comp) 1-36
Crypt. & Sys. Security crypt. &S
message with the heln..
It isvery easy to break ciphertext obtained from plaintext Plaintext
only 25 possible keys to decrypt
Bute-Force attack because the attacker will be having
Cipherte
ciphertext.
are: Ciphertex
Further some more characteristics which lead to casy brute force attacks
Caesar ci
1 The encryption and decryption algorithms are known.
For example,
2. Only 25 possible keys.
3. And plaintext language is easy to recognize with few repetition of alphabet having sarme A can be
Q. 1.11.2 D
1.11.2 Monoalphabetic Cipher
In Caesar cipher the attacker can easily guess the plaintext as it is easily recognizable. In
Monoalphabetic cipher substitutes one letter of the alphabet with any random letter
As in m
fro monoalphabet
the alphabet.
polyalphabetic
It is not necessary that if A is substituted with B then compulsorily B has to be substituted
systematically=
with C. It can be replaced with any other letter of the alphabet. The only weakness this
in
algorithm is that if more repetition occurs then attacker can easily guess 1.11.3(A) F
the plaintext.
This random substitution is just done to have
uniqueness. 1. Pick a ke
2
In this the substitution of characters are random permutation Write yo
of the 26 letters of ie
alphabet. times as L
For example
3
For each
would go
Following is the substitution that we are taking: below.
Plaintext nopq
la bc defgh r.st uv wX
m
i k I y Z
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
1-37 Introduction to Cryptography
A can be replaced by : d, r, y
j,
B can be replaced by : h, u, m,
p etc.
Such type of large key space makes
this cipher technique extremely dífficult to
brute-force attack. But this can make break by
the cryptanalysis attacker straight
forward to guess the
pattern.
Scanned by CamScanner
Introduction to Cptograph
1-38 Crypt. & S
crypt. & Sys. Security (MU-Sem. 6-Comp)
y
U
V wX
ROW MNo JoP P a RST V
WX YZA 1.11.3(B) D
A B C
DE F G H K
KL MIN
L
QRS TU A B
B C D E F
GH M N o P Q R S
U V
W)X
WX
Y
YZ Z A B C
C D F G H
K T U V
EF H
K L
MIN
o P Q
RS W[X
Y
ZA JBC C D
Q. 1.11.3
G
| U V
F G H J K L
M Io
R
ST Z A B D B
P Q R B C D E F
T
UV WX Y
5
F G
H|LJKL M NO w X Y2 A U
V
J
KL MN
o P o R
ST A JB
C E F G D
9H
KLM
N O P o
BC DEFG
H H
|
8 |J K LM NO
P o R s
Y G H Sr. No.
T U V wX y Z A
B C D E
9 J KL
M
No P aR |S Hy Z A C D E F G Po
o X
W
10 KL
M N
P RSQ T U V G H
K 1.
A B
F
L M N O
P RS T U V wX YZ F G H
JKL ha
12
M N O P
a RSTU V
WIX
IYZA BC DE F G
H | KL M
13 NOPa RS T U V
wX Y Z
BC A D
M N
|o PQRSTU
V
WX YZ A
B C D
G H
KL M N O
2 M
15 JP T U V Q R S
Wx YZ A BC DE F G H |KL M N Su
KL
G H
IYZ JB BC DEF
T U V W X A
16
QRS
JR
S T U Vw X
YZ A c D EF G H JK LM JN O P Q
In
s T U
WX YZ A BC
V D E
F G H
K
L M N O P 0 R 3
T
EFG U V
WX Y Z JA B C D
H J K
LM N O P @
RS
20 UV wKYZ BCD EF A G H
KLMNo P Q R S T
fr
21 WX YZ B C DEF G H |
V A J K L
M N o P
Q RST U
22 w X Y Z A BC EF GHKL D
MNO PQ R s T U V e
ZA BCDEF G H
X
KL Y N P
QRS TUV w
M O
23
24 Y2 EF 9.KL A B C D G H
NOPRSUV
M
WX
c
4
Ir
Z B
FGHKL MNOP QRSTUVWxY
A D E
25
4. Then find the column of your plaintext letter (for example, 'w', so
the twenty-t
column).
5. P
5. Finally, trace down that column until you reach the row you found
before and write dr
the letter in the cell where they intersect (in this case, you
find an 'I there). Repeat t
same till you will convert
all plain text messages into ciphertext.
Example 1
Keyword 1.11.4 P.
MECMECMECMECMEGMECMECM
Plaintextt 1114
weneedmoresuppliesfast
Ciphertext It was i
IIPQIFYSTQWWBTNUIUREUF Playfai
Thus, the plain text message "We need more supplies m
Scanned by CamScanner
ography
Crypt. & Sys. Security (MU-Sem. 6-Comp) Introduction to Cryptography
1-39
2 More than one alphabet is used for One fixed single alphabet is used for
substitution. substitution.
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem.
6-Comp) lotroduction Crypt. & S
1-40 to Cryptographu
In the first step all letters are to
are already been be filled in that matrix from
placed is not be placed again
left to right, the letters whick
For Example
in that matrix. C
After filling up of the given
letter. fillrest of the space 1.
For pair
letters alphabetically in the matrix with the remainin
no
with repetitions. The par C
The letters I and J will be considered row letter
as one letter. So
place J in rest the If Iis already placed then no need to
of matrix.
The letters which are already
written/ mentioned need not
matrix. to be placing that
letter in given
For in given example A and are
E already mentioned in matrix so
write that letter again it is not mandatory to
in the given matrix.
Table 1,11.1
So CY will
F A
R
< E Checking
2 f
X M column.
L B
C ao
D G H K
N
T
U W Y
Encryption using Table 1.11.1
keyword matrix
1. The plaintext received is to be broken
in pair of two letters.
2. For example CYBER can be BE will be e
broken into CY BE R(X).
3 Checking for
If both letters are same or only one letter is left then
put X with that alphabet.
4., If both pair alphabet appears in same row
replace the letter with the immediate right
alphabet (wrapping around to the left side
of the row if a letter the original pair was on
the right side of the row).
5. If both letters appear in same column replace it with alphabet immediate below to that
letter (wrapping around to the top side of the column if a letter
in the original pair was on
the bottom side of the column).
Thepair
6
none of the condition explained above meet, then replace them with the letters on the letter
RX
same row respectively but at the other pair of corners of the rectangle defined by the butopp
R(X)
willbe
original pair.
Scanned by CamScanner
Cryptography
Introduction to
Crypt. &
Sys. Security (MU-Sem. 6-Comp) 1-41
CY we
check that CY does not occur in same row or
column
For pair same
1.
pair forms
rectangle, pick
a
X| M P B
|z D G K
S T
VW YZ
encrypt as HU.
So CY will immediate next in that
so replace it with
Checking for BE both are in same column
2.
column.
F|A I R
X| MP LB
H
D G
ST
VWYZ
to E is B).
BE willbe encrypted as KB (Below
FA I RE
X M P L|B
D G H K
S T
NO Q
V wYZ
FL. If pair formsa rectange, pick same row
Ine pair RX forms a rectangle, replace it with
letter but opposite cormers.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Introduction to Cryptography
1-42
Keyword- domestic
Keyword is domestic.
In the first step all letters are to be filled in 5x5 matrix from left to right, the letters which
are already been placed is not
be placed again in that matrix.
After filling up of the given letter, fill rest of the space in the matrix with
the remaining
letters alphabetically with no repetitions.
The letters I andJwill be considered as one letter. So If I is already placed
then no need to
place J in rest of the matrix.
es
t b
f h k 1
X y z
By using Playfair Cipher (Use following steps to. encrypt given word or message) we
want to encrypt the plain text message "The key is hidden under the door" using keyword
domestic.
1. The plaintext received is to be broken in pair of two letters, if duplicate letter put x
2. Th, ek, ey, is, hi, dx, de, nu, nd, er, th, ed, ox, or
Ex. 1.11
Is playfa
alphabet.
3. Ifboth letters are same or only one letter is left then put X with that "moonm
righ
alphabet appears in same row replace the letter with the immediate Soln, :
4. If both pair row a letter in the original pair wa
to left side of the if
alphabet (wrapping around the ls playte
on the right side of the row).
below to Play
appear same column replace it with alphabet immediate
5. If both letters in
the original
par text
column if a letter in
top side of the lette
letter (wrapping around to the
column).
on the bottom side of the
Scanned by CamScanner
Cypioraphy
remaining is Step 6 bo
hi Step 6 gc
no need to dx Step 6 my
de Step 4 os
nu Step 4 pn
nd Step 5 vt
er ay
Step5
th Step6 cf
ed Step 4 so
age) we
OX Step 6- mw
or
zeyword Step6 ep
The plain text message
"The key is hidden under
the door" encrypted as :
ut x cf, ar, ae, bo, gc, mnv, os, pn,
vt, ay, c, so, mw, ep.
Ex. 1.11.2
playfair cipher
monoalphabetic cipher
"moonmission" ? Justify. Construct a playfair matrix with
and encrypt the message the key
e
right "greet".
Soln.:
ir was
ls playfalr cipher
monoalphabetic
cipher
o that layfair cipher is not technically
mono-alphabetic. Monoalphabetic
ICxt
leer mapped with ciphertext means that
letter pairs letter and playfair is a each plain
to two letter digraph substitution - maps
pairs. it two
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.6-Comp)
1-44 Introduction
For
playfair, to Cryptogranhy
the order is unchanged,
looking digraph. we just
It is a substitution substitute common diagraphs
cipher. for randomiz,
It uses pre-arranged
key. So playfair Ex. 1
m
ni
a cd
f h |k
V W
Xy Z
The message is greet" Th
divide the latter's
into set of two characters.
Message greet : gr ex Me
et
Ciphertext is : hq, cz,
du
Ex. 1.11.3 Cip
Ex. 1.11.
Construct a playfair matrix
with the key "occurrence". Using pla
"tall tress". Generate the cipher text for
plain text
: Soln.:
Soln.
Draw
Draw matrix 5 x5
C Ie
h
df
i/i |kI
St
V wXyz
The mE
The message is "Tall trees" divide the latter's into the set of two character.
Massag
Massage Tall trees: Ta lx It es re
Scanned by CamScanner
ion
toCypiography
hsforrandomize
Crypt. & Sys. Security
(MU-Sem.
6-Comp)
Ex. 1.11.4 1-45
Introduction to Cryptography
ot the message Use playfair
algorithm with
:
key "monarchy"
Soln. and encrypt tho toxt
"jazz".
Draw matrix 5
x5
monar
hy d
f
g|ij| k
P9
The message wX
is "Jazz"divide
the latter's in
Message: Jazz thé set of two characters.
ja zx, zx
Ciphertext : sb, uz, uz
Ex. 1.11.5
Using playfair
plain text cipher encrypt the
plaintext "Why,
Soln. : don't you?". Use
the key "keyword".
Draw matrix
5x 5
d b C
f gh
p S
The message
is "why, don't, you
Massage :
Why, don't, you
?" divide the latter's
in to the set of
? two charactet.
Wh, yd,on,
Theciphertext 'ty, ou
: yij, ea, es,
vk, ez.
Scanned by CamScanner
Crypt. & Sys. Security
(MU-Sem. 6-Comp) 1-46 Introduction to Cyptograply
crypt.
Ex. 1.11.6
a
Use Play
fair cipherto encrypt The
key APPLE. the following message This is a
columnar transposition.
1
:
Soln.
2.
The key used is APPLE so
put it into 5 x 5 matrix. 3
Draw matrix 5
x5 4.
A 5.
For I
C G H
IJ K M N
R T U
WX YZ
The plain text message is "This is a
columnar transposition" divide the
of
two.character. latter's in to the set
Message : This is a columnar
transposition'"
Now break the message "This is a
columnar transposition" into
each. So message will look pairs of two alphabets
like as given
So
THIS IS AC OL UM NART RANS PO SI TI ON
For ex
By using play fair cipher the cipher text obtained
is given below:
T
UG M M CI MB SO IE SUOP MT BK
QM QN A
tr
One time pad invented by Vernam called as Vernam cipher that improves re
the security
over substitution and transposition
techniques.
The one time pad technique uses a random key of the same length of the message (as long
as the message), so that the key is not repeated. The case happens here is sender is a
generating new key for every new message while sending the message to the receiver
called as one-time pad. The key is used to encrypt and decrypt a single message.
Each new message requires a new key of the same length as the new message. This
method is unbreakable. It produces random output with no relationship to the plaintext.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem, 6-Comp) Introduction to Cryptography
1-47
Plaintext H WA R Y
7 14 | 22 0 17 4 24| 14 20
Key C b a X
13 2 19 5
16 |0 1723
Total 20 16 23 1942| 20 24 31 43
Ciphertext QXT Y F R
So the ciphertext obtained for the plain text how are you is uqxtquyfr
For example
The best example of one time pad is recharge voucher of any mobile company.
All recharge voucher having different key or code imprinted on it. Once that code entered
into mobile, customer will get talk time according to the voucher cost. If another customer
trying to use same code of voucher he/she get recharge failure message. The company is
new and
regenerating all keys or code in such a way that every recharge voucher having
unique code on it called one-time pad.
Another example of one time pad is license software or license copy of operating system
users ?
and antivirus having few keys available accordingg to license. If license key is of 50
software along with new key. Once the key has been used nobody can use same key for
activation.
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem.
6-Comp)
1-48 Introduction to
Vernam Cipher yptograhy
has two disadvantages & S
1. Large : Crypt.
random key cannot
be created.
2 Key distribution Where,
and generation keys can
3. In terms
of be problematic.
of cryptography it is not
póssible to implement one C and P
because generating new timc pad commercially encryptio
key every time for sending
complete transmission a ncw message
process. took more time to
Ke
Syllabus Topic : HII Cipher
1.11.6 HillCipher Using the
Scanned by CamScanner
Cypt. & Sys. Security (MU-Sem. 6-Comp) Introduction to Cryptography
1-49
Where,
C and P, are the column vector which is hold lcngth 3, K is used to representing tne
:
encryption key. Which is uscd 3 x3 matrix for Example
[2 5 4
12
Key (k) =9L3 7 17J
Using the vèctor we can represent the Key and first three letters of the plaintext HEL as
follow.
C = KP; mod 26
T2 5 4
9 12 mod 26
L3 717JL 11J
78
89 mod 26
236
0
=
ALC
is ALC.
For the given plaintext HEL, We get ciphertext
When we get the entire ciphertext it requires to o decryption using the inverse of the
matrix K.
is
Using the general terms in Hill cipher techniques
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) lntroduction
1-50 to Cryptograph,
Ex, 1.11.7
Cr
Encrypt the message "Exam" using the Hill cipher with Ex. 1.1
the key s 7
Using
Soln.: :
Soln.
key (k) =
Ci = KPi mod 26
mod 26
151 1677
mod 26
60 84
= VLIG
For the given plaintext, we get ciphertext
is VLIG.
Ex. 1.11.8
3 8 7
Soln.:
Plain text (Pi) = DEF
Ci = KPi mod 26
2. 4 3
Key (K) = 9 2 1 4
mod 26
3 87
8
5
47 21 1.
40 mod 26= 14 = Voy
76
24
For the given plaintext, we get ciphertext
is voy.
Scanned by CamScanner
toCryptography
Introduction to CryptographyY
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-51
Ex. 1.11.9
Jsing hill cipher encrypt plain text "COE"
use key "ANOTHERAZ!
Soln. :
= COE
Plain text (Pi)
By using Hill Cipher
Key = ANOTHERBZ
It is represented as
Ci = KPi mod 26
A N
T H E mod 26
RB Z.
0. 13 147 21
Cipher Text (Ci) = 19 7 4 14 mod 26
17 1. 25 4
238
= 152 mod 26
148
4
22
Mod 26
18
= EWS
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem.
6-Comp) 1-52 Introduction to Cryptography
Q. 1.12.3 What is
keyless Transposition Cipher? Sys.
(Ret. sec. Give any example of rail Cypt. &
1.
The ciphertext c
Columnar transposition
techniques rounds of su
2. Keyless transposition more comple
techniques A
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-53 Introduction to Cryptography
(3) Read the text present in cach selected random key columns.
present in each column as per selected
(4) Combine all text random key order.
(5) The
resultant text called ciphertext shown in Fig. 1.12.2.
1
G Example
Step 1 : Select any Plaintext :are you missing somebody,
1
2 3 4 5 6 + Column slze
m
Write plaintext
row - by - row
Step 4: oieysmrisdesoyamgounb
Step 5: Final ciphertext is
Ciphertext : oieysmrisdesoyamgounb
The ciphertext obtained in step 5 can be made more complicated
by performing multiple
rounds of such permutations.
A more complex way to encrypt the message would be to write it in a rectangle, row by row,
and then read off the message column by column, but to decide the order
of the columns.
The order of the column will be the key of the algorithm.
Example 2
12 3 5 67
h e b oK
a
e T
0h
|to r y
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) Introduction to
1-54 Cryote
& Sy
Cypt.
Select the order of
columns (Key):4351267
Ciphertext : beoyertryolhtiethsdooaikts Preparing
1.
1.12.2 Keyless Transpositlon Technlques. in this key
Keyless transposition technique also called Rail fence anothe
technique.
Algorithm for keyless transposition technique is
given below :
14573
(1) Write plaintext message That is, th
into Zigzag order.
numbered
(2) Read plaintext message of step 1 in order row
of by row as shown in Fig. 1.12.3.
letter has
G For example
write. For
Plaintext message is :
be care full while chatting. hand side
row 1
hea ver
row
2-b 42 163
Fig. 1.12.3 : Zigzag order of plaintext 2. Prepari
Write plaintext obtained in row 1 and row 2. -numbere
The resultant ciphertext is
:
Ciphertext eaeulhlcatnberflwiehtig. the key.
This technique doesn't want any key. Rows are
also fixed (2) so that attacker may get clu: heave
to break the ciphertext obtained
using rail fence technique. 42163
Ex. 1.12.1
WEA
Use Transposition Cipher to encrypt the plain text
"WE ARE THE BEST use key "HEAVEN".
Soln. : HEBE
3. Encryp
Single Columnar Transposition
of the ke
Single columnar transposition cipher is the simple
cipher. Read the key, and numbered à
eehr
each letter of the key as per their appearance
in the alphabet. The total encryption process is
divided into three parts : 1234
1. Preparing the Key AEEL
2. Preparing the Plaintext BES
3. Encryption Then t
i.e.
ABEE
Scanned by CamScanner
I Crypt. & Sys. Security (MU-Sem, 6-Comp) 1-55 Introduction to Cryptography
1
Preparing the Key : Suppose the key is another. We can assign the number to each letter
:
in this key as shown below
another
1457326
That is. the first letter a is numbered 1. There are no B's or C's, so the next letter to be
mheredis the e. So e is numbered 2, followed by h, and so on.
In the key. if the same
lotter has occurred more than one time, it should be numbered 1. 2. 3. etc. from left to
write. For example, the key is heaven. Here e is occurred two times. So first 'e'from left
band side is numbered as 2, whereas second e is numbered as 3.
heaven
421635
9 Prenaring the Plaintext : The letters from the message is written in rows under the
.numbered letters of the key. One letter from message is to be writen under each letter of
the key. Let us say that the message is - We are the best. We can write it as shown below :
heaven
'
421635
WEARET
HEBEST
3. Encryption : Now, arrange the above message written in rows under the numbered letters
of the key as per ascending order of the numbers at the top of the plaintext letters.
aeehny
123456
AEEWTR
BESHTE
Then the letters are copied down column wise from top to bottom. The result is ciphertext,
i.e.
ABEEESWHTTRE
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) 1-56 Introduction
to Cryptogre
Crypt. & Sys
:
Syllabus Topic Steganography
1.13 SteganographyApplications Known car
3.
and Limitations original im.
Q. 1.13.1 compared to
What is
steganography ?
(Ref. sec. 1,13) Give its advantages and disadvantages. is compared
a.1.13.2 as file an or
What
is steganography?
"steganography? What are applications and limitations encoded me
(Ref. sec. 1.13) attacked ma
Steganography is a technique attacks help
of hiding the message, file and
Tile or image: Steganography image within other mess original mes
word is of Greek origin
"secret writing". that means "covered writing",
4
Reformat
In other words, it is the art as attacker cha
well as science of hiding
that know body aware the the commnunication in such w don't store c
existence of communication.
E
The goal of hiding messages, 5. Destroy
files and images is to fool
attacker to detect that there attacker and not even allo related info
is another message
hidden in original message. used to stor
The main aim of Steganography
is to achieve high security and
in any cover media like encode the sensitive datz 6. Known me
images, audio, video and send over
Internet. Even if there is it insecure channel such : and when t
small change in stenographic
meaning of the messages. image or data will change complele help agains
Scanned by CamScanner
Crvpt. & Sys. Security (MU-Sem. 6-Comp) 1-57 Introduction to Cryptography
2 Known carrier attack : In this typc of attack, the steganalyst has access to both ne
original image and the image containing the hidden information are available and
compared to assume the message. The stcgo object (that contains the hidden information)
is compared with the cover object and the differences arc detected. This attack also called
as file an original copy : It might happen that attacker have a copy of both the file i.c. the
encoded message and a copy of the original file. If the two files are different, then
attacked may guess that there must be some hidden information inside a file. Such type
attacks helps attacker to destroy the hidden information by simply replacing it with
original message.
A
Reformat Attack : Most popular attack on steganography is reformat attack, in this attack
attacker change the format of the filè (BMP, GIF, JPEG) because different file formats
don't store data in exactly same way.
E
Destrov Everything Attack : An attacker could simply destroy the message and
all
related information. This can works correctly because there are different file formats are
used to store data in different ways.
6. Known message attack : In this type of attack, the original message prior to embedding
and when transmitting over Internet is known to sender. This type of attack analysis can
help against attacks in the future.
7. Multiple Encoding of a Files : The attacker gets n different copies of the files with n
different messages. It might happen if some companies are inserting different tracking
information into each file. If the attacker tracks all the data during transmission then he
may try to replace the tracking information with its own available information.
8. Compression Attack : One of the simplest attacks is to compres the file. This type of
attack tries to remove the unrelated information from a file during compression then what
is the use of hiding the data if extraneous information is removed.
Chapter Ends...
Scanned by CamScanner
CHAPTER
2 Modular
Module
19 Crypt. & S
In cryp
Syllabus three ba
Modular Arithmetic The co
Euler's theorem and Number Theory : Euclid's not clo
logarithms. Testing for primality- algorithm
Prime numbers-Fermat's
The Chinese remainder and
theorem, Discrete
2.1.1(A)
2.1 Modular Arithmetic A prir
a
by 1
2.1.1 Mathematical Background
Exam
the
Basics of Number Theory and Modular Arithmetic gcd
2.1.1(B)
Basics of Number Theory
GCI
1. Integer Arithmetic positive
integers
2. Binary Operations
integers
Fig. 2.1.1: Basics of
Number Theory For
Integer Arithmetic
gco
1.
Scanned by CamScanner
Crypt. & Sys. Secuity (MU-Sem. 6-Comp)
2-2 Modular Arithmetic & Number Theory
For example :
- 2, -
Z=(...-3, 1,0, 1, 2, 3,...) set of
integers.
2. Binary Operations
In cryptography different binary operations are
applied to set of integers. Among those
three basic operations are addition, subtraction
and multiplication.
The concept here is to provide two inputs and generate
only one output. Set of integers is
not closed under operation division,
i.e. quotient of two integers may not
be integer.
Syllabus Topic : Prime Numbers
Example:2, 3, 5,
7, 11 ctc.
Relatively prime number : Two numbers are relatively prime to one another when they
have no common factors except 1.
Example : 21 and 44 are relatively prime numbers, since common factors between both
the number is one i.e. Greatest Common Divisor GCD of a and n is 1 it is written as
god (a, n) =1 hence they both are relatively prime.
2.1.1(B) What is GOD?
GCD stands for Great Common Divisor, also called as greatest common divisor of two
positive integer a and b: The GCD of two integers is the largest integer that can divide both
integers. Most needed concept of cryptography is GCD and prime number. Two positiv
integers may have common divisors but we are interested in largest divisor.
For example :
gcd(3,5) =l hence 3 and 5 are relatively prime numbers to each other.
gcd(12,60) = 12
Scanned by CamScanner
P Crypt. &
Sys. Security
(MU-Sem.
6-Comp)
Explanation 2-0
Modular
Arithmetic &
Number
Factors The
of 12 = 1,
2,3,4, 6, 12 crypt.
Factors &
Sys
of 60 = 1, 2,
3, 5, 6, 12, 60
So looking to above Modular Arithr
between both example it is observed
that 12 is the greatest Modular art
the numbers so. and also common fact. division sins
gcd(12,60) = 12.
Let a, b, e
For example : Find
GCD (40, 20) : of natural n
Method 1 For examp
arithmetic.
Find prime factors
of given numbers, both leaves
40 = 22+ 2*5 If a, b, e Z
20 = 2*2*5 quotient and
Hence r,
if =0
GCD (15, 12) = 3 the remainde
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 2-4 Modular Arithmetic & Number Theary
Modular Arithmetic
Modular arithmetic is a simple concept of using Remainder which is left after an integcr
division since MODULO is the remainder in mathematical terminology.
Let a, b, E Z and n
eN then aab (mod n) if (a-b/n) where Z is set of integers and N is set
of natural numbers.
(mod 11). Congruence calculus is often
called as Modular
For example : 23 = 1
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.
6-Comp)
a= 4, 2-5
b +r Modular
Arithmetic
b= q,I + 0<r<b & Number
Theony
2 0<r<I|
0<<Iy
.. gcd= 20
Scanned by CamScanner
mberieony
Crypt. &
Sys. Securiy (MU-Serm.
6-Comn
2-6
Ex. 2.2.2 Modular
Arithmetic
& Number
Solve /find gcd (36, 10). Theory
:
Soln.
We know that,
gcd (x, y) =
gcd(y,x
mod y)
gcd (36, 10) =
gcd (10,36 mod
10)
= gcd (10,
.. gcd (10, 6) =
6)
gcd (6, 10 mod 6)
= gcd (6, 4)
greatest
n of the gcd (6, 4) = gcd(4,2)
gcd (4, 2) = gcd (2, 0)
.gcd (36, 10) = 2
Ex. 2.2.3
= gcd(18,12)
gcd(12,18 mod 12)
gcd(12,6)
gcd(6,12 mod 6)
= gcd(6,0)
.. ged(48,30) = 6
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem, 6-Comp) 2-7 Modular Arithmetic &
Number Theory
(1) gcd(105,80)
gcd(105,80)
= gcd(80,105 mod 80)
= gcd(80,25)
gcd(25,5)
gcd(5,25 mod 5)
=.gcd(5,0).
gcd(105,80) = 5
Ex. 2.2.4
= gcd(16,4)
gcd(4,16 mod 4)
= gcd(4,0)
i. gcd(20,16) = 4
() gcd(50,60)
gcd(50,60 mod 50)
gcd(50,10)
= gcd(10,0)
= 10
gcd(50,60)
Scanned by CamScanner
Crypt. & Sys.
Security (MU-Sem.
6-Comp) 2-8 Modular Arithmetic & Number Theory
2.2.1 Extended
Euclidean Algorithm
Q. 2.2.2 Write
Extended Euclidian algorithm.
As we
(Ref. sec. 2.2.1)
learn in school days,
when we divide integer
values by other nonzero integer
we
13 = 2(5) +3
Note that this expression is obtained from the one above it by multiplying througn
by u
divisor 5.
Ihe greatest common divisor of integers a and b, denoted by gcd(a, b), is the largest
integer that divides (without remainder) both a and b. So, for example :
57 = 2(24) +9
24 = 2(9) + 6
9 = 1(6) +3
6 = 23) +0
It is well known that if the gcd(a, b) =r then there exist integersp and s so that :
p(a) + s(b) = r
By reversing the steps in the Euclidean Algorithm,
it is possible to find these integers p
and s. We shall do this with the above example:
Starting with the next to last line, we have: 3 =9-1(6)
Scanned by CamScanner
Crypt. &
Sys.Security
(MU-Sem.
6-Comp)
From the 2-9
line before Modular Arithmetic
that, we see &
NumberThenn.
that 6 =24-
3 = 9- 1(24 2(9), so :
cypt.
From the -2(9) =3(9) -
line before that, we 1(24)
have 9=57-2(24), The e
3 = 3( 57 so :
algorit
-2(24) – 1(24)
= 3(57) The al
The extended Euclidean algorithm can calculate the gcd (a, b) and at the same time
a, =b
Ex. 2
Giver
Soln
t=t,
god(a, b) = I, S= S
Fig. 2.2.1
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) & Number Theory
2-10 Modular Arithmetic
algorithms.
IH- a
;
t-b;
S;t-1 ;
Sst-0; Initialization
t,-0; ht-1;
while (r;> 0)
updating r's
rti-qXI,i.
It-iIyt-r;
updating s's
updating t's
t+t,-qXthi
tt-,itt-t;
Ex. 2.2.5
s t.
Given a = 161 and b=28 find god (a, b) and value of and
Soln. :
Scanned by CamScanner
Crypt. &
Sys, Socurily (MU-Som. 6-Cornp) 2-11 Modular Arithrnotic &
Nurnber Thege,
B
S t t
5 161 28 21 -5
-
28 21 ) -5 6
3 21
-1 4 -5 -23
7 -l, 4 -23
What will be that number? The problem can be solved by well known theorem called
a range
Chinese remaindcr theorem. If that it is possible to reconstruct integers in certain
from their residue modulo a set of pair wise relatively prime modulo.
a, (mod m,)
X=
X = a, (mod m,)
X, = a, (mod m,)
Consider n positive integers which are relatively prime in pairs i.e. m, m,... m,. Then the
congrucnce of above equation have common solutions.
where M= m
xm, X M3
Scanned by CamScanner
&Number
Then
M2
=
M/m2 ==70,
M3 = Mim3
==42,
hen the M4 = M/m4 =
210-30
7
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp) Modular Arithmetic
&
Nurmber
2-13 The,
Ex. 2.3.2
A bag has certain number of pens. If you take.out 3 pen at a time, 2 pens are left, If you tete
pens at a time, pen is left and if you take out 5 pen at a time, 3 pens are left in the bao JL
1
X = a (mod m,)
According to given equation al=2, a2 = 1 & a3 =3 and m=3, m, = 4 and m,
=5
M= m* M,* Im3* m4
= 3
*4*5
M = 60
Scanned by CamScanner
melic
&
Numb
5= 422
J=30-2 Crypt. & Sys. Security (MU-Sem.
6-Comp) 2-14 Modular Arithmetic & Number Theory
mod
Y = Inverse of (M/ml) mod m, = Inverse of 20 mod 3
= 20 mod 3 =
20 mod 3 =2
odM), Y2 = Inverse of (M/m2) mod m, = Inverse
of 15 mod 3 = 15 mod 4
1 *4]mod = 225 mod 4 =1
210 Y3 = Inverse of (M/m3) mod m, = Inverse of 12 mod 5 = 12 mod 5
= 12 mod 5 = 3
According CRT
X = a,Miy + a,My2+ aMayst...........a, M, y,
(modM),
X = 12 * 20 2
* + 1l * 15 * 1
+3 + 12 *3 ) mod 60
releft,
eft in f youtala = [80+ 15 + 108 mod 60 =203 mod 60
the bag. ..
X = 23
Ex. 2.3.3
to the simultaneous equations.
Define the Chinese remainder theorem tind the solution
2 mod 7. =
:
Soln.
remainder theorem is.
The general equation of Chinese
x = a, (mod m,)
X = a, (mod m,)
K = a, (mod m,)
d
m, =5 equations
According to given simultaneous
mod 7
x=2 mod 3, x=3 mod 5, x=2
Let, a,
= 2, a, =3, a, =2, and
m,
3,
m,
=5,m, =7
M = m,* M,* Mz* m
= 3*5 *7
M = 210
= 21,
M, = M/m, 105/5=
= 15,
M, = M/m, 105/7=
Scanned by CamScanner
Modular. Arithmetic
&
Crypt. & Sys. Security (MU-Sem. 6-Comp) 2-15 Number
Th
= 15 mod 7= 1
X = 23
o5) = 4
(7) = ?
3
o(7) = 1, 2, 3, 4, 5; 6 are relatively prime7
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 2-16 Modular Arithmetic & Numbar Theory
:.o(7) = 6
This implies that o(n) will be casy to calculate if n has cxactly two different
prime factors say p and g
.:. (n) = pX4
1.e. (n).= (p) * (q)
Hence proved.
Euler's theorem.
For example Prove using
:
Ex, 2.4.1
n = 11.
Solve using Euler's theorem:a=2and
Soln. :
:20 = 1
(mod n)
11 = 1)
1024 = 1
mod 11 (1024 mod 11 =1 and 1024 mod
Hence próved.
Scanned by CamScanner
P Crypt. &
Sys.Security
(MU-Sem.
6-Comp)
2-17
Modular Arithmnetic
Syllabus Toplc & Number
2.5 Discrete
: Discrete
Logarlthm
Thene
7 18 1
d log, p(b) 9
The equation d log,,
p(b) called as discrete
logarithm which is 10 5 12
cryptographic algorithms used in different
like diffie Hellman algorithm and 11
digital
signature algorithms. 1
For a fix prime mumber P.
Let a, b be non zero integers "12
such that a * = bmod p) (mod p). The problem 11 18
is called Discrete Logarithm of finding X
Problem. Suppose that n
integer such that a" = 1 (mod is the smallest 13 17 12
p), i.e., n = or d,(a). By
X=L(b), and call it the discrete log of b w.r.t. assuming 0 x <n, we denote 14 6 8
a (mod p).
Example :P= 11, a= 2, b=9, then x = =
15 16 12
L,(b) La(9) =6
To explain discrete Logarithm considers 16 9 1
18 1
7 = 49 = 2 x19 + 18
11= 11 (mod 19)
= 343 = 18 x In general te
7 19+ 1= 1 (mod 19) (mod n)
is (n).
7 = 2401 = 126x 19+7=7 (mod 19) If a number i
7 = 16807 = 884 × 19+ 11=11 (mod 19)
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Modular Arithmetic & Number Theory
2-18
There is no point in continuing because the scquence is repcating. This can be proven by
noting that 7° = 1 (mod 19), Table 2.5.1 shows all the powcrs of a, modulo 19 for all
positive a< 19,
Table 2.5.1
18 17
A 11 12 13
415. a
1 1 1 1 1 1 1 1 1 1 1
1
18 17 15 11 -1
2 4 16 13 4 3 6 12 5 10
6 18 16 10 11 14 4 12 17 13 1
3 9 8 5 15 7 2
4 16 7 9 17 11 6 5
1
4 16 7 9 17 11 6 5 1
16 4 1 11 17 9 7 16
5 6 11 17
16 1
16 1 6 17 7 4 5 11 9
6 17 4 5
11 1 7 11 1
11 1
7 11 |--|
7 11 1 11 7
7 18 11 12 1
8 7 18 11 12 1
8 7 18 11 12 1 8
1
4 17 1
9 5 6 16 11 4 17
7 6 6
10 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 --
1
1
1 11 1 11 7 1
7 1 11 7
11 7 1 11 7
11 18 7 8 1 12 11 18 7 8 1
18 7
1 12
12 11
1
6 2 7 15 5 8 9 3
17 12 4 14 11 10 16 18
13
1
18 5 13 11 2 12 16 15
14 6 8 17 10 7 4
1
4 3 7 10 17 8 6 14
15 16 12 9 2 11 13 5 18
17 6 1
1 16 9 11 5 4 7
16 9 11 5 4 7 17 o
1
11 16 6 5 9
17 4 11 16 6 7 5 9 17 4
1
1 18 1 18 1 18
18 1 18 18 1: 18 1 18
18 1
terms, that the highest possible exponent to whom a number can belong
In general
(mod n) is o(n).
n.
Ifa number is of this order, then it is called as primitive root of
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
2-19 Modular Arithmetic & Number Ther.
Fermat theorem plays an important role in public key cryptography. For this theorem t
understand one has to have knowledge of Prime number, Co-prime number, pring
factorization and GCD i.e. greatest common divisor that has already been explained in ti;
chapter.
Theorem
For any prime number p, a is the integer which is not divisible byp then
= 1(mod p)
al .2.6.1)
a = a(mod p) ..2.62)
Basically this theorem is useful in public key RSA and primarily testing.
Let us have a = 3 andp = 5 then as per the above theorem in Equation (2.6.1) we have
35-l
=3= 81 = 1(mod 5).
Scanned by CamScanner
er
TheoN
Ex. 2.6.2
..2.6.1) We can solve any large mod operation using this method. Solve 62
mod 11.
Soln. :
Ex. 2.6.3
) 3 mod 11
Scanned by CamScanner
P Crypt. &
Sys.Security
(MU-Sem.
312-1 6-Comp)
mod 11 = 2-21
Modular
mod 11 Arithmetic
3" mod 11 = & Number
Thee
[(3° mod
. 3* mod 11 =
mod 11 =
(25 mod
11) =3
11) x
(3 mod 11)]
mod 11 =
(5 × 5] mod
11
(ii) 310 3
mod 11 CH
According
to Fermat's
little theorem a
Hence
a=3 andp= 11, Put =1 mod p, 30
mod 11
3l01 these values
mod 11 = into above equation,
3 mod 11
3 mod 11 = [(3 mod 11) x (3* mod
3 11)] mod 11 = [1 x
mod 11 = (4 4] mod 11 Syllabus
mod 11) = 4
mod 11 = 4 Block c
Advanc
Chapter Erd.
3.1 BI
Basic:
Strear
algor
For n
3.2 E
Q.3.2.1
Q.3.2.
@. 3.2,
Scanned by CamScanner
ic &
NumberTh
CHAPTER Module 2
Symmetric Key
3 Cryptography
Syllabus
DIoCKCIpher principles, block cipher modes of operation, DES, Double DES, Tiple DES,
Advanced Encryption Standard (AES), Stream Ciphers : RC5 algorithm.
Chapter
Ends
Basically cryptographic algorithm is used for transformation of plaintext into cipher text.
Stream cipher and Block cipher are main method of encrypting text using key and
algorithm.
For more details refer Section 1.10 of Chapter 1.
Q. 3.2.1 Explain with examples the CBO andECB modes of block ciphers.
(Ref. secs. 3.2.2 and 3.2.1) Dec. 16,3 Marks
Q. 3.2.2 Describe the block cipher modes of operation. (ECB, CBC, CFB, OFB and CTR
mode) with the help of block diagram.(Ref. sec. 3.2)
Q. 3.2.3 What are block cipher algorithmic modes? Describe any two
modes.
(Ref. sec. 3.2)
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.
6-Comp)
The block 3-2
cipher
that encrypting is basic buildingblock Symmetric
Key Cryptography
one bit for providing
The Federal at a time, block data security.
Information of bits is encrypted In Block
cipherrather Crypt. &
Sys. Secur
block cipher Processing at one go.
that may Standard (FIPS) defincs
Cryptographic be used in a four modes The drawback of
algorithms wide variety of operation
and decrypted. (DES, AES of applications for
the input genera
etc). The modes like symnerie key
specify how attacker or crypta
The modes included data will be encrypted
in this standard are :
1
Electronic Codebook
(ECB) mode
2. Cipher Block Chaining Key
(CBC) mode
3. Cipher Feedback
(CFB) mode and
4
Output Feedback (OFB) Fig. 3.2.
mode
5. Counter (CTR) Mode Only small messE
repeating the sam
3.2.1 Electronic Codebook (ECB) Mode
3.2.2 Cipher Bloc
(MU- Dec. 16)
Q.3.2.4 Describe ECB. (Ref. sec, 3.2.1)
Q.3.2.5 Describe
In Electronic Codebook (ECB) mode the given plaintext message is divided into blocks of To overcome the
64 bits each and each 64-bits blocks get encrypted independently. The plaintext block plaintext the Ci
produces ciphertext of same size (64-bits each). mode, each bioc
encrypted.
The given plaintext is encrypted using same key and transfers the encrypted data
In CBC mode
(ciphertext) to receiver.
Initialization V
At the receiver end each block is decrypted independently using same key in order to
block 1. In ne
produce original plaintext message of same size i.e. blocks of 64-bits each. previous ciphe
process is shown n block 2. The p
The Electronic Codebook (ECB) mode encryption and decryption
Fig. 3.2.3.
Fig. 3.2.l and Fig. 3.2.2.
Initialization V
Plaintext Plaintext Plaintext
block 2 block N more complica
block 1
Different crite
Key
Encrypt Koy-Encrypt -- KeyEncyp: A good initial
plaintext bloc
Ciphertext
ciphertext bloe
Ciphertext Ciphertext
block 2
block N In case of
block 1 cip
process of CBC mode
Code Book (ECB) mode encryption
Fig. 3.2.1:The Electronic
Scanned by CamScanner
2Crypt. & Sys. Security (MU-Sem, 6-Comp)
3-3 Symmetric Key Cryptography
Only small messages can be encrypted using ECB mode of operation where the chances of
repeating the same plaintext message are quite less.
To overcome the problem of repetition and order independence in ECB even for repeated
plaintext the Cipher Block Chaining (CBC) mode is used. In the cipher-block chaining
mode, each block of plaintext is XORed with the previous ciphertext block before being
encrypted.
In CBC mode the first block of the message (plaintext block 1) is XORed with an
Initialization Vector (IV) which is then encrypted using key k and produces ciphertext
block 1. In next step each block of plaintext (plaintext block 2) is XORed with the
previous ciphertext block 1 before being encrypted and produces output ie. iphertext
block 2. The procedure is continuing till all plain text block gets encrypted as shown in
Fig. 3.2.3.
Initialization Vector doesn't have special.meaning it. is simply used to make input message
more complicated or unique.
Different criteria for IV are fixed-size input value it should be random or pseudorandom.
A good initialization vector should be unique and unpredictable. In all modes of operation
plaintext blocks are represented by using P1, P2, P3,....!n and corresponding
ciphertext blocks are represented by using C1, C2, C3,......n.
In case of cipher block chaining mode even if plaintext block repeats in the input, output
of CBC mode yields totally different ciphertext blocks as shown in Fig. 3.2.3.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Symmetric Key Cryptograchy
3-4
CN
Ciphertext Ciphertext
Ciphertext
block
1
block 2 block N
Fig. 3.2.3: Cipher Block Chaining (CBC) mode encryption process
CBC mode is applicable whenever large amounts of data need to be sent securely.
provided that all data is available in advance (e.g. email, FTP, web etc.).
In CBC decryption, cipher text blockl get decrypted using same key used earlier during
encryption process and the output of this step is then XOR with initialization vector (IV)
and produces plaintext block 1.
In next step the ciphertext block 2 is decrypted and its output is XOR with ciphertext
block 1which results plaintext block 2. Repeat the procešs for all ciphertext block in order
to produce original plaintext blocks as shown in Fig. 3.2.4.
Ciphertext Clphertext Ciphertext
block 1 block 2 block N
C
P
P PN
Plaintext Plaintext Plaintext
block 1 block 2 block N
Fig. 3.2.4:Cipher Block Chaining (CBC) mode decryption process
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 3-5 Symmetric Kay Cryptography
CFB mode may be uscd as a stream cipher. In CFB encryption process 64 bits
initialization vector is used which is kept in 64 bits of shift register.
The IV (shift register) is then encrypted and produces 64-bits of ciphertext i.e. encrypted
IV. Now the lefmost S bits (size of 8 bits) of the encrypted IV are XORed with the first
Sbits (size of 8 bits) of plaintext P. to produce the first S bits of ciphertext Cy, which 1s
In next step contents of the 64 bit shift register are shifted left by S bits and Cqis placed in
the rightmost S bits of the shift register and which again undergoes to encryption procesS
as shown in Fig. 3.2.5.
S-bit shiting
4-S- bit shifting
Encryption Eneryption
Encryption
Key Key
Key
Ciphertext O
Ciphertext C Ciphertext CN
Decryption of CBC mode reverse of CBC encryption, the same technique is used, except
that the output of encryption process is XOR with the received ciphertext block to produce
the original plaintext block as shown in Fig. 3.2.6.
Scanned by CamScanner
P
Crypt.
& Sys.
Security
(MU-Sem.
6-Comp)
3-6
Syrnmetric
Key Cryptograch.
S bits
s bits Encrypt
bits (64- |
S bits S
PN select
S bits
Fig. 3.2.6: Cipher s bits
Feedback (CFB) Plaintext
mode Decryption Process
3.2.4 Output P
In OFB mode, if there is a small error in individual bits, it remains an eTor individual
Fig
bits. which do not corrupt the whole encrypted message (to avoid bit errors during
3.2.5 Counter
transmission) which is the biggest advantages of OFB mode over all other mode. (C
a.3.2.8 Compa
In this case Initialization Vector is extracted from a double length encryption key.
Q.3.2.9 Explain
Scanned by CamScanner
Symmotric
Koy
CN-1 Cryptography
Crypt.&
Shiftraglster Sys. Socurity (MU-Som.
6-Comp)
b-s bito 3-7
Symmetric Key Cryptography
|,obits Initlallzation yoctor
Encrypt
-S-bit shiting 49-bit shifting
B4- bits
Seloct shift ragister shift register
bits DiDiscard
shitt roaister
84- bita
b-s bits 84-bits
Encryptlon
Encryption
Encryption
Kev
Key
s bltg Encrypted IV
PN (64- bits) Encrypted IV Encryptgd IV
64- bits 84- bits
s blts solect S bits |(select S-bits)
(select S- bits)
Output O, Output
eSs Plaintext O2
P, Plalntext Plaintext
P2 Pn
Clphartext C, Ciphertext C,
Ciphertext CN
Fig. 3.2.7: Output feedback (OFB)
mode encryption process
kept in 64 bits of
Decryption process of OFB is reverse of encryption process as shown
V and XOR with in Fig. 3.2.8.
Nonce
yption process
shift register
g. 3.2.7.
P;
PN
Scanned by CamScanner
Crypt.
&Sys.
Security
(MU-Sem,
As mnode
uumoes is similar
6-Comp)
to OFR 3-8
which as inputto vith the Symmetric
willbe the difference
ofsame algorithm We nut KeyCYtograchy
u counter sizeas
that a
is
constant
that it uses
counters 2Cypt.
&
Sys. Security (MU
•Ihere mode, the counter of aplaintext value as or
value OfSeqe
1S no block. initial
chaining is encrynted cunte 3.2.6 Algorlthm Mode
pr0cess and
is doneas shown thenXOredwith
the plaintext
Counter 1
inFig.3.2.9 o ye
Counter2
Mode
Encrypt
Encrypt
Scanned by CamScanner
Symmetric
Key Gryptogr
uses otography
counterS
as initial Or sequence l
Crypt. & Sys. Security (MU-Sem.
value 6-Comp)
of counter Symmetric Kay Cryptography
32.6 Algorlthm Mode
the plaintext Detalls and Usage
to ciphertext Table 3.2.1 : Summarization
of algorithm modes
Mode
Detalls
Counter Usage
N
Electronic code book
Same key is use to encrypt
(ECB) and A single value is transmitted
decrypt 64 bit at a time.
in secure fashion.
Encrypt Cipher Block Chaining
Ciphertext of previous
(CBC) step and It is used
plaintext in next for authentication
step are purpose.
XORed.
Cipher Feedback (CFB)
K number of random from
Encrypted stream of data is
ciphertext bits of previous step
transmitted for authentication
and k bit from.plaintext of the
next step are XOred.
Output Feedback (OFB) It is similar to CFB, only
For transmission of encrypted
difference is that
input to stream of data.
ed earlier and later encryption step is preceding
in Fig. 3.2.10. DES output.
Counter (CTR) Both counter and plaintext
It is used in the applications
nter N
Scanned by CamScanner
Crypt.
& Sys.
Security
DES (MU-Sem.
isblock 6-Comp)
DES was cipherpublished 3-10
customer originally by
request developed NationalInstitute Symmetric
for a method by an BM ofStandards KeyCyptogra
In 1973, team Cypt. &
Sys. Security (MU-Sem.
6
OR
The given plaintext message
is divided into size
56-bit key at the initial level. 64-bits block each and encrypted
using
Fig. 3.3.1 shows conceptual
view of DES.
58- bit
Different1
key
64- bit
|64- bit
64-bit
plaintext plain text.
platn text
Scanned by CamScanner
Crypt. & Sys. Securty (MU-Sem. 6-Comp) 3-11 Symmetric Key Cryptography
At the decryption side, DES takes 64-bit ciphertext and creates 64-bit plaintext and
56-bit key.
The principle of DES is very simple. Divide plaintext message into block of size 64-bits
each, which is initial permutation.
After initial permutation on 64-bit block, the block is divided into two halves of 32-bit
called left plaintext and right plaintext.
84-bit plaintext
Initial pemutation
K1
1
Round Round
16usod
56 - bit Ditereht
key keys
Encrypted data
Final permutaton
Scanned by CamScanner
Crypt.&
Sys. Security
(MU-Sem.
3.3.3 Initlal 6-Comp)
Permutation 3-12
(IP) Symmetric
Q. 3.3.5 Koy Cryptograt.
Explain & Sys. Security
Initial permuutation 2Crypt.
Initial permutation steps in
block with any isthe process
DES, (Ref.
sec. Step 2 :
Expansion per
3.3.0)
other random of
rearranging or 3
For example bit of same shuffling cach bit of As shown in Fig.
block, : First bit of plaintext message original plainten,
Plaintext (LPT)
ane
the bitreplaces original bloCh
2" with 57
plaintext block replace
with 48"bit from 32-bits to
48
Scanned by CamScanner
etric Key
Cryptogra
graphy
Crypt. & Sys.
Security (MU-Sem. 6-Comp)
3-13
Symmetric Key Cryptography
Step 2:Expansion permutation process
f original
plaintext As shown in Fig.
3.3.3 general steps
Plaintext (LPT) and of DES, we had two 32-bit plaintext
original 32-bit Right Plaintext (RPT). called as Left
nin plaintex from 32-bits to 48-bits In step 2 Right Plaintext
Table3.3.1. the process called as expansion is expanded
permutation.
LPT (32- bits)
RPT (32 -bits)
32- bit
Expansion pemutaton
S-box substitution is the process which accepts 48-bit key and expanded
right plaintext of
48-bit which get XORed and produces 32-bit output as shown Fig.
in 3.3.4.
y is
S-box performs just jugglery on each bit positions and produces compressed bits.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. Symmetric Key CrYptograpi,
6-Comp) 3-14
XOR
RPT (48 -bit)
Ss S
S S S5
Sboxes S
Permutation
32-bits output
S box substitution
Fig. 3.3,4
t is quite obvious that output of XOR operation becomes new right plaintext and the old
right plaintext becomes new left plaintext, the complete process is called
as XOR and
swapping operations.
Scanned by CamScanner
Symmetric
Key
Grypiograph.
Scanned by CamScanner
Crypt.
&Sys.
3.3.7 Security
Weakness (MU-Som,
6-Comp)
1. InDES
Trying 3-16
2 all possible
In an cxhaustivc combination Symmetric
after Key
3 2i.e.3.6029search known of2"possible Cpg
If youspend x 10 trials plaintext keys is not Crypt. &
Sys. Ser
onan
attack, that much
4. TWo $25Kyou average. the hardthese
chosen can cryptanalyst days,
5. input build will obtain
The to an DES password the
purpose S-boxcan solstir,
Triple DES
crackers 3.3.9
ofinitial create that will successes
andfinal thesame
permutation output. infew a. 3.3.10 Explair
isnotclear. a. 3.3.11 Write s
3.3.8 Syllabus
Topic : Double
Double Triple DES per
DES DES uses three keys
Q.3.3.8 Explain
Double First it perfor
Q. 3.3.9 DES.
(Ref.sec, 3,3.8)
Write short ciphertext agair
note
on:Multiple the second cip
Double performs DES. (Ref.
sec.3.3.8)
the same operation ciphertext Cp.
keys K1 and as DES
K2. only difference
is that double DES use Mathematically
First it perform txo
encryption on Pt»EK1Pt) =
ciphertext again plaintext which is encrypted
this ciphertext
into final ciphertext. is encrypted by
using another
using K1 obtains finst » Cp= EK3 (E
key called K2
Mathematically and convertet Where
Double DES is
represented as
Pt EKI(Pt)
TEMP =
EK1(P) EK2(E(K1(P))
Where Cp= EK2E(KI(P)
Pt = Plaintext
EK1(P) = Encrypted E
plaintext with Key
Ki Cp = EK3
.TEMP = EK1Pt) =Temporary
Variable to store results
EK2(E(K1(P)) = Encrypted Decryption of
Results of first step using
K2 The final ciph
Cp = Final Ciphertext. which results
Decryption of Double DES is reverse ciphertext,
of Encryption. Whatever the ciphertext obtained f
after double DES encryption process get plaintext Pt.
decrypted using K2 and obtain
ciphertext, the result of previous step the firs
(ciphertext) decrypted using K1 which To decrypt
yields the
original plaintext. To decrypt the cipher text th
Cp and obtain the plain text Pt Double DES operation.
need to perform the following operation.
Pt = DK2(DK1(Cp))
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 3-17 Symmetric Key Cryptography
Triple DES perforns the same operation as double DES only diference is that triple DES
uses three keys K1, K2 and K3 while
encrypting plaintext.
Pt = DK3(DK2 (DKI(Cp)
Scanned by CamScanner
P Cypt.
&Sys.
Security
(MU-Serm.
6-Comp)
Sylabus 3-18
3.4 Toplc:
Advance Advance
Symnetric
Encryption Encryption
Kay
Q.3.4.1 Standard C
wis
Scanned by CamScanner
Coypt. & Sys. Securty (MU-Sem. 6-Comp) Symmetric Key Coyptography
3-19
The plaintext given is divided into 128-bit block as consisting of a 4 x4 matrix of bytes.
Therefore, the first four bytes of a 128-bit input block occupy the first column in the
4x4 matrix of bytes. The next four bytes occupy the second column, and so On.
ABS operates on a 4 x 4 column-major order matrix of bytes; called as state array
shown in Fig. 3.4.3. AES also has the notion of a word. A.
word consists of four bytes that
is 32 bits. The overall structure of AES encryption and decryption process is shown in
Fig. 3.4.1.
Plaintext(128-bit) Plaintext(128-bit)
The numbers of rounds are 10, for the case when the encryption key is 128 bit long. (As
mentioned earlier, the numbers of rounds are 12 when the key is 192 bits
and 14 when the
key is 256.) Before any round-based processing for encryption can
begin each byte of the
state (plaintext) is combined with the round
ky using bitwise XOR operation. Nr stands
for number of rounds.
Scanned by CamScanner
C? Crypt. & Sys. Security (MU-Sem. 6-Comp) 3-20 Symmetric Key Gryptography
all other rounds are identical. Final Round doesn't have (MixColumns) it incilues ony
SubBytes, ShiftRows and AddRoundKey.
plaintext using same
The process of transforming the cipher text back into the original
process the set
decryption
encryption key is called as decryption process of AES, during
(1) SubBytes
(2) ShiftRows
(4) AddRoundKey
step/Substitute byte as
1. The SubByte fixed S-box lookup table
replacement of each byte using a
SubBytes) consists of state array (16 byte). It
into the 4 x4
to achieve non-linearity
shown in Fig. 3.4.2
same function as the S- BOX in DES.
performs roughly the the
performs a non-linear substitution in
on each byte in the state and
It operates
makes AES a non-linear cryptographic
Galios Filed GF (2) field,
which is what
system. apply
transformation using SubBytes techniques
and if
Fig. 3.4.3 shows the state
create original values.
reverse called as InvSubBytes transformation which will
every same two byte value the resulting transformation is also same. It also shows
For
one.
that the InvSubBytes transformation creates the original
values, their transformation also
same is the same:
Note that if the two bytes have the
The corresponding substitution step used during decryption is called InvSubBytes.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 3-21 Symmetric Key Cryptography
1
0 2 3 4 5 6 7 8 a
b C e
0 63 7c 77 7b F2 6b 6f C5 30 67 26 Fe D7| Ab76
1
ca 82 C9| 7d Fa 5947| FO Ad D4
A2|Af9c A4 72 CO
2 b7 Fd 93 26 36 3f F7 Cc ES F1 |71 D8 31 15
34|A5
4 C7 23 C3 18 96 5 9a 7 12 80 E2 Eb 27 B2|75
4
9 83 2c la 1b |6e 5a A052|3b D6 | B3| 29 E3 2f 84
5 53 DI0 Ed| 20 Fc B1 5b 6a Cb Be 39 4a 4c 58 Cf
6 DO Ef A8
Aa Fb |434d.33 85 45 F92 7f 50 3c 9f
7 51 A3
408f 929d38 Da 21 D2
X
F5 BcB6 10 Ff
8 Cd 0c 13 Ec 5f97 44 17 | C4| A7 7e 3d 64 5d 19 73
9 6081 4f Dc
222a 90 8846 Ee B8 Be Db
14 5e 0b
EO32 3a0a 49 6 24 5c C2| D3
Ac62 91 95 E4 79
b E7 C837 6d | 8b D5| 4e
A96c 56 | F4 Ea65 7a Ae 8
C Ba 78 25 2e lc A6 B4 C6 | E8| Dd 74 1f 4b Bd 8b 8a
d 70 3e B566483 F6 Oe 61 35 57 B9 86 ld 9e
C1
e E1 F8 98 11 69 D9 8e
94 9b le 87 B9 Ce 55 28 Df
f 8c A1| 89 Od bf B6 42 68 41 99 2d Of BO
54 | bb 16
Fig. 3.4.2:S-Box Lookup table for SubBytes
SubByte.
10 21 CO 81 CA FD BA 0C
05 07 01 25
State Array 60 byte(128-bit) 86B C5 7C 3F
27 12 19 21 blocks
8CC C9 D4 FD
15 27 30 35
59 CC o04 98
8,
IrvSubByte
Scanned by CamScanner
Crypt.
&Sys.
Security
2. ShiftRows (MU-Sem.
6-Cor
Comp)
3-22
Lue output Symmetric
which of the SubByte Key Gyptograr
consists transformation
matrix of rotation Sys. Securit
(rotation is innut to Crypt. &
MixColumns performs 04 E0
operation on the state array
by-column and each column obtained from ShiftRows
is multiplied with row a columa 66 CB
four bytes as an input and of fixed matrix. This step takes
produces outputs 81
output bytes). of four bytes (cach input byte 19
affects the
The four numbers state arrays ES 9A
of of first column are modulo multiplied
Galios Filed (GF) by a given in Rijandeal's
matrix as shown in Fig.
along with ShiftRows are 3.4.5. In AES MixColumn step
primary source for The same
cipher produced. providing complete diffusion to he
ShiftRows
0203 o101 D4| EOB81E Except fo
0102 0301 BF
04EO4828 doesn't ha
B44127 B8cBF8 00
|0101o203 5D 521198 Finally ar
o3o101 02
8119D326
30|AEF1|F5 reverse
E59A|7A|40 r
Predefined matrix InvMixcc
State array New state
same enc
Fig. 3.45:MixColumns transformation
Scanned by CamScanner
Cypt. & Sys. Security (MU-Sem. 6-Comp) 3-23 Symmetric Key Cryptography
From Fig. 3.4.5 on the left hand side, the row of the leftmost matrix is multiply with
column of state array (XOR operations) which produces the new state. Perform the
same operation on all columns which provides diffusion (mixing data within
columns).
The 4 bytes of each column in the State are treated as a 4-byte number and
transformed to another 4-byte number via finite field mathematics (modulo multiplied
in Rijndael's Galois Filed by a given matrix) as shown. MixColumns step is primary
source of diffusion in AES.
4. AddRoundKey
In the AddRoundKey step, the Round key one generated using Rijndael's key
schedule is combined with the new state obtained from MixColumns transformation
state.
The round key is added by combining each byte of the state array using bitwise
XOR
operations. The actual 'encryption' is performed in the AddRoundKey)
function,
when each byte of state array is XORed with the round key to produce
final cipher
text as shown in Fig. 3.4.6.
04 EO 48 28 A0 | 88 23 2A A4 68 6B 02
66 CB F8 06XOR FA 54 A3 6C 9C 9F 5B6A
81 19 | D3 26 FE 2C| 39 76 7F35 EA 50
ES 9A |7A 4C 17 B1 | 39 05 F2 2B 43 49
Fig. 3.4.6 :AddRoundKey
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.
3.4.5 AES 6-Comp)
3-24
Decryptlon Symmetric Key
Cryptography
Crypt. & Sys.
Decryption occurs
InvShiftRows through
the function AddRoundKey
0,InvSubBytes Ex. 3.4.1
inverse function,
as it
(), InvMixColumns ). plus the inverse AES
function, AES encryption
c
once, and simply XORs ) and AddRoundKey ) does not
decrypts when the state with the require an Soln. :
applied again). subkey (XOR encrypts when
applied We aware
3.4.5(A) Difference
between Data Encrvpion combinations, sh
Encryption Standard Standard (DES)
(AES) and Advance Data key during encrg
Q. 3.4.4 Compare AES and into some temp
DES. (Ret. sec, 3.4.5A) permutation and
Sr. No.
DES what will be the
1. AES
Data encryption standard takes when sender se
64-bit It allows the data length
plaintext as a input and creates (plain text size)
64-bit of 128, 192 and 256 bits. cryptanalyst abl
Ciphertext i.e. it encrypts
data in block message get mor
of size 64-bits per block.
2 does not solve i
In DES plaintext message is divided AES divide plaintext into 16 byte
into size 64-bits block each and
(128-bit) blocks, and treats each block
encrypted using 56-bit key at the initial as a 4 X4
State array and supporting
level. three different key lengths, 128, 192, 3.5 RC5 A
and 256 bits.
3. The left plaintext and right plaintext The number of rounds are 10, is for the RCS is a sy
goes through 16 rounds case when the encryption
of encryption key is 128 bit
process along with 16 different notable for bei
keys for long. (As mentioned earlier, the number
each rounds. of rounds is 12 when the key is 192 bits XOR, shift, etc
and 14 when the key is 256.) Example
4. DES uses 56-bit keys so that there are AES
is stronger than DES because of
possible key combinations which is key size vary Key.:00 C
from round to round.
roughly equal to 7.2 x× 10° keys
required to break DES cipher. Plain Tex
5. Different versions of DES are double AES doesn't Cipher Te
have any future version.
DES and triple DES is added.
RCS is a
6. DES doesn't use Mix Column,
Shift AES uses Mix Column, Shift Rows text block
Rows method during encryption
and method
siz
during encryption and
each instance
decryption process. decryption process
7
DES, double DES and Triple DES (168- AES also are vulnerable to b=key size
bit key) are. vulnerable to brute force attacks.
brute foroo i
attacks.
Scanned by CamScanner
eyCryptography
RCS is a symmetric key block encryption algorithm designed by Ron Rivest in 1994. It is
is for the
is 128'bit notable for being simple, fast (on account of using only primitive computer operations
like
number XOR, shift, etc.) and consumes less memory.
192 bits
Example
cause of Key.:00 00 00 00 00 00 00 00 000000 00 00 00 00 00
d.
Plain Text:00000000 00000000
Cipher Text:EBDBA521 6D8F4B15
jon. RCS is a block cipher and addresses two word blocks at a time. Depending on input plain
text block size, number of rounds and key size, various instances of RCS can be defined and
Rows
and cach instance is denoted as RCS- wrb where w= word size in bits, r = number of rounds and
b=key size in bytes.
force
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.
6-Comp)
Allowed 3-26
values are :
Symmetric
Key Cryptogr
Crypt. & Sys. Secur
Parameter
w
Possible Value For example, if
block/word
size (bits) u=328 = 4. c=
16, 32, 64
Number of Lis pre initialize
Rounds for i=b-1l to 0
0-255 Ljilu] (L[wi]<<<=
Key Size (bytes)
Nota: Since at a time, 0-255 Step-3: Initializing
RC5 uses 2 word blocks
theplain textblock Sub-key S of siz
Notation used size can be 32, 64 or 128 =
P
in the algorithm bits. s[oj
for i =I to 2(r+l)-1
| Symbol S) = S[i-1] + Q)
Operation Step 4 : Sub-key mi
x<<<y Cyclic left
shift of x
by y bits The RCS encry
the basis of user
Two's complement addition of words
where addition is modulo i=j=0
Bit wise Exclusive-OR A=B=0
do 3 max(t, c) times
Step 1 : Initialization of constants A= Si] = (S) +
P and Q.
RCS makes use of 2 magic constants B=Li] = (Li]
P and Q
whose value is defined by the word size w. i(+l) %1
Scanned by CamScanner
Cryptography
to 0 value before
fori=b-l to 0 adding secret
key K to it.
LEu] (LWi] <<<
8) + K1
Step -3 : Initializing
sub-key S.
Sub-key S of
size t= 2(r+1)
bits, is initialized using
sO) P
magic constants
for i = l to P and Q.
2(r+1)
S)= Si-] +0)
Step 4: Sub-key mixing.
The RC5 encryption algorithm uses
Sub key S. L is merely, a
the basis of user entered secret temporary array
key. Mix in user's secret formed on
i=j=0 key with S andL
=B0
A
do 3 max(t, e) times:
A= Sil= (Sil + A# B) <<<3
B= L1=(L] B)<<<(A+
+ A + B)
W.
i=i+1) %t
j=6+) %c
Step 5 : Encryption.
We divide the input plain text block into two registers A and B
each of size w bits. After
undergoing the encryption processes the result of A and B together forms the
cipher text
block.
1. One time initialization of plain text blocks A and B by adding S[0] and S[1] to A and B
respectively. These operations are mod
2. XORA and B. A = A ^B
3. Cyclic left shift new value of A by B bits.
4. Add S[2*;] to the output of previous step. This is the new value of A.
5. XOR with new value of A and store inB.
B
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
3-28 Symmetric Key Cryptog
7. Add S[2*i + to the output of previous step. This is the new value,of B.
1]
Chapter Ed.
Scanned by CamScanner
Symmetric
value_of
s. B.
CHAPTER
Module 2
Syllabus
Public key
cryptography :
The knapsack algorithm, Principles of public key cryptosystems
EIGamal Algorithm. The RSA algorithm,
Chapter
E
4.1 Public Key Cryptosystem
with Applications
Public key Cryptosystem also
called as asymmetric key Cryptography
or Public Key
Cryptography already discussed
in section 1.9.2. (Chapter
Two different keys are used during
encryption and decryption process
(one key for
encryption and second key used at
the time of decryption). RSA algorithm
is the best
example of asymmetric key cryptography as
shown in Fig. 4.1.1.
Private Key (only known
to owner).
Public Key(possibly known to
everyone).
Encryption
Plaintext Cipher text
public key e
Private key d
Cipher text
Decryption Plaintext
Scanned by CamScanner
Crypt.
& Sys.
Security
(MU-Sem.
6-Comp)
4-2
Public
-Publlc
key rtng
Sender
Alce public
2. Digital si
key ring
3. Key exch
PU
PUe Alice's prvata
key for conve
X
Transmítted PRa
cipher
Paln text txi
y= E(PUa,
Input X) xD(Pra, y)
X
Encryption algoithm Cipher Messagal
text Cipher sOurce
(e.g. RSA)
text Decryption algorithm Paln
Bob
tet
qutgut
Sender
Transmitted
PUa
X 4.2
cipher text Publ
y= E(PRb, X) X= D(Pra, y).
Paln text
Cryptographic
input Encryptlon algorithm Cipher
Cipher
(e.g. RSA) text
text Decryption algorithm Pain text 1. It is com
Output
Bob (PR).
2
Alice It is com
(b) Encryption with generate
Fig. 4.1.2: Private Key
Public Key Cryptography
3. It is com
4.1.1 Applications for-
Public - Key Cryptosystem private k
Applications of public
key cryptosystem are
classified into three categories : 4.
1. Encryption/decryption : During It is co
this process the sender encrypts
receiver's public key. the message wiu determin
5.
It is coIE
plaintext
Scanned by CamScanner
blic Key
Cryplograph.
Crypt.
& Sys. Security
(MU-Sem.
6-Comp)
2. Digital signature 4-3
Receiver : During
this process Public
3. Key exchange the sender "signs" Cryptography Key
for conventional
: Both sender a message
and receiver cooperate with his private
encryption. to exchange a key.
Source A session key,
typically
Message Destinaton B
X Encrvpt
yption
sOurce Aloorit Encrvotion
gorithm
Pain text Algorithm Decryption
output Algorithm
Decryption X
|Algorithm Messane
desinatior
PUb
PRb
Key pai
SOurca
PU:
PRa
Key oar
sQurce
Receiver
Fig. 4.1,3
Syllabus Topic : Requirements
and Cryptanalysis
Scanned by CamScanner
Crypt,
&Sys.
Security
6 (MU-Sem.&-Comp)
h
thebn requirement
encryption that, 44
although
anddecryption useful. Public
is not necessary Key Cry
can Cyptogr
4.2.1 Pt = EnPUb be applied for all public-key
Publlc [DrPRb ineither
(PU]= order: pplictic,
Key Cryptanalysis DrPUb
[EnPRb
Public (P))
key encryption
encryption. method
is accessible 4.3
to the brute
rublc Key systems force attack
with symmetis
Because
depend on
the use
of that of mathematic Q. 4.3
attack cannot the key size is
equation or some
work on larger enough tunction.
practical thelarge:size key. to avoid brute
force
encryption Whenever key
attack i.e.
and decryption. brute Q. 4.3
size is small forc
When key that timeenough Q. 4.3
size is large fr
generating that time speed
for to make brute of encryption/decryption Ro
force attack are too Aldema
Public key encryption impractical. slow. This key is
plain te:
is bound to signature
Some other application
form of attack and management. The
some way is that if hacker
to calculate the has a public
private key using I. Sel
feasible for a key, but it that key hacker fnd
particular public is not conform 2
key algorithm. that this type Cor
Because it of attack is
is ñot mathematically 3. Cor
proven. any
SUspect. So given algorithm as
like RSA is work like 4. Sel
If problem is difficult 1<
from one angle can
at in an entirely multiple be found to S. Ca
ways.
This is the history
havea answer or solution
if lookd
There is some
style of attack
of cryptanalysis. 6. PuL
that is distinct
Suppose take one to public key system. 7. Co
example, a message
and attacker could has to be send C
encrypted possible that lie totally a
56 bit DES key of 56 bit DES key
encrypted key
by matching the using the public P
transmitted ciphertext. key and find the
In the public key scheme 8. Co
there is no matter
minimized to that the key length
brute force attack is how large, the attack P
on a 56 s
This attack can bit key.
be countered W
by fixing some
random bits to
such simple message. Be
encryp
Scanned by CamScanner
Crypt. & Sys. Securty (MU-Sem. 6-Comp)
4-5 Public Kay Cryptography
Q.4.33 Explain RSA algorithm used for public key cyptography. (Ref. sec. 4.)
Ron Rivest, Adi Shamir and Len Aldeman have developed this algorithm
(Rivest-Shamir
is a block-cipher which converts
Aldeman) in 1978. It is a public-key encryption algorithm. It
versa at receiver side.
plain text into cipher text at sender side and vice
1<e<o(n).
5. Calculate d (private key) such that,d =emod o(n) or mod on) =1.
6. Public key = (e,n), private key = {d,n).
7. Computecipher textusing,
C=P°mod n where, P
<nwhere C= Ciphertext,
P=cd mod n.
Where, d = dècryption key.
Both sender and receiver know the value of n. In addition, the sender must know
encryption key 'e' and receiver must know decryption key'd'.
Scanned by CamScanner
2Crypt. & Sys. Security (MU-Sem. 6-Comp) 4-6
Public Key Gryptograh
T For example
5. Finding d
where,
i ='1to 100
240 + 1_24118.53
= (i=2)
13 13
+ 1
360 361
13
= 13=27.76 (i=3)
480 +1 481
d = = 13 =37
13
Hence. d = 37
= and
6. Hence public key (13, 143)
Private key = (37, 143)
7. Encryption
Plain text message (P) which is in binary format converted into integer.
Here P is
selected as 13 such that P <n
: (13< 143)
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
4-7 Public Key Cryptography
i. C= [(13° mod 143) *(13° mod 143)*(13 mod 143)] mod 143
8. Decryption
52 mod 143 = 52
52 mod 143 = 130
mod 143
Hence, P= 52
= [(52 mod 143) * (52 mod 143) * (52 mod 143)] mod 143
Computational Aspects
There are two main issues arises in complexity of the computation we can see that one by
one. At the first we see the process of encryption and decryption.
In RSA, both encryption and decryption method, integer can increased as power
and mod
n. Le. [(p mod n) x (q mod n)] mod n
=(p Xq) modn so the given equation say's that, we can
reduced the result using modulo n. This calculation we can
do practically.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Public Key Cryptograph,
4-8
X = XXXXXXxX*XxX XxXxXxX
We can find same result using only four multiplication i.e. (*)(x) )*)
(*
n
[(x mod n) x (x´ mod n) x (x° mod n)] mod a
we want to find the
as a mathematical way as if their is
: value 'a'
So we can define that
power x i.e. a.
n
X = 2i=a mod
x0
4.3.1(B) Efficient Operation using
the Public Key
key, because
we can increases the speed of the operations using public
In RSA algorithn
a choice called as 'e'.
of that it create particular the choice is
common choices are used for the value of e' that is
Almost all
are the popular common choices.
65537 (216+ 1)and the choice 3 and 17
to
choices has only two 1
bits because of that it requires minimum multiplications
These
find the exponentiations
a
When we use very small public key like
e = 3. So RSA algorithm becomes accessible to
simple attack.
are uses the value e =3
Let's take one example having 3 different RSA users. That 3 users
in this RSA algorithm. But they have different value for 'n' cach have unique value called
as (N1, N2, N3). If user x sends the encrypted message M to all three users, then it creates
3 cipher texts that are as follows :
Ct1 = M3 mod N1
Scanned by CamScanner
Public
Key
Cryptography
se when
we usse
ncreases. theRSA
Crypt.&
Sys. Security
(MU-Sem.6-Comp)
4-9
iplications C2 =
as : M3 mod n2 Public Key Cryptography
Ct3 = M3
mod N3
Where, N1,
N2, N3 are pair
Chinese Reminder wise relatively
prime.
Theorem (CRT) says
CRT. that, for computing
M3 mod (NI, N2,
ntegers X Using the Rules N3) we use
andn. represented as
of RSA algorithm:
Message M is
M3< N1, N2, N3. less that each
of the Ni, that is
Attacker can easily
find or decrypt the message
to find the cube root like in above example
of M3. So he can directly attacker only need
d then calculate In this attack, padding find or decrypt
that message easily.
is done that means adds a
every instance message it unique pseudo-random
of M. for the encryption. bit string. For
want to In RSA algorithm, when
find the a key generation process is
value ofe that becomes done that time user need to
relatively prime to selects the
(n)
If value of e is selected and then prime p
andq are generated.
We can find the gcd (o(n),e)
is # 1 then user can
generate a new p, q pair. discard the p, q values and
they can
creates X mod p
it
X, = C'mod q = Cmod (q- mod a
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 4-10 Public Key Cryptograçh,
are might be
When we choose the prime numbers that
choose p and q as large numbers. number.
no any useful technique that finds the large prime
At the present there is is to pick the
random
large prime number
which we used for finding
So general procedure prime or not if that number is
whether that number is
an odd number and test that number
number until one is
found
next random number and check that
not prime then choose the
that tests are prime.
popular algorithm is used for finding the prime number
For example : One efficient and
Algorithm"
that is "Miller-Robin
given number is prime or not, if integer n is
In this algorithm, the procedure for testing the
But if n passes many tests with different randomly chosen values for a
Then we can say's that the value of n is exactly prime number.
In short,
(1) Cho0se an odd value orn at randomly.
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem.
6-Comp) 4-11 Public Key Cryptography
(3) Perform the primary test using Miller-Rabin Algorithm. If n fails the test, then discard
the value of n and go to step 1
(4) Ifnhas passed the number of tests which are sufficient to decide the prime number
then accept n; otherwise go to the step 2.
When we find the prime numbers Le. p and q that tme process of key generation iS
Ex, 4.3.1
Prime number p = 3, q = 11, e=3, m = 00111011 (m-message) then calculate private key d
and cipher text C.
Soln. :
Step 4: Select e such that it is relatively prime to (n) i.e. gcd(e, o (n)) = 1
e = 3 is given.
Step 5: Calculated such that
e
d= mod o (n)
Scanned by CamScanner
pl Crypt. & Sys. Security
(MU-Sem. 6-Comp) Public Key Gryptogra
4-12
ed mod (n) = 1
3* d mod 20 = 1
(O(n) * ) +1
d =
e
d=
20x)+l_
3
0x)+1=7
3
d = 7
0011101159 (P=59)
n
where P<n=59 mod 33
c = P mod
33] mod 33
P = (20* mod 33] * [20° mod
33] *
[20 mod 33] * [20 mod 33] * (20 mod
[20' mod 33] mod 33
*
= [400 mod 33] * [400 mod 33] * [400mod 33]
[20 mod 33] mod 33
= (4]* [4] * [4] * [20] mod 33 = 1280 mod 33
P= 26
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem. 6-Comp) Public Kay CryptographyY
4-13
Ex. 4.3.2
Calculate cipher text using RSA algorithm glven data as follows: Prime numbers p, q as 7, 1
=6* 16= 96
Step 4: Select e such that it is relatively prime to (n) i.c. ged(e, n))=1
If we select s then it is not relatively prime p 96 because
3,= 1*3
96 = 2* 2
*2*2*2 *3
gcd must be 1.
5 = 1*5'.
god (5,96) = 1
ed mod o (n) = 1
5 *d mod 96 = 1
d =
where i =1 to 9= -194.
d= 77
Scanned by CamScanner
Crypt.
&Sys.
Security
Step (MU-Sem.
6: 6-Comp)
Public 4-14
key =
(c,n) = Public
Private (5, 119) KeyCryplo
Step
7: key= (d,
Calculate n) (77, 119)
cipher text
message
2Cypt. &
Sy
Plain text for given plain
denoted as text message m=
p = 10 10. Step 5: Ca
c = (m denoted as
Itcanbe represented p mod n =10 p)
mod 119
as
10 mod 119 =
[10 mod 119) *
[10 mod 119]
mod l19
[1000mod 119]
= 100000 * [100 mod 119]
mod 119
mod 119
C
Step 8: 40
Now calculate
plain text required
40 to the receiver P at the time
then receiver can of decryption. Once sender
calculate plain se
P = c mod n = 40" mod 119 textp.
Now represent 40
mod 119 as mention
Because decryption process above it will
results p as 10. Step
always yields 6: Pu
.:. original message
P 40 mod =
/plain text Privat
119 10
P= 10 Step 7: Ca
Ex. 4.3.3.
Calculate cipher text
using RSA algorithm
Prime numbers given data is as
follows :
P, as 13, 17 and
Q
Scanned by CamScanner
Crypt. Cryptography
&
Sys. Security (MU-Sem. 6-Comp) Public Kay
4-15
19 19
(192 *3) +1 (192 *4) +1
19 =30.3 = 19
= 40.4
(192 * 5) +1 = 50.5 = (192* 6)t60.6
19 19
(192 *7) +
l (192 * 8) +
-80.8
=70.7=
19 19
(192 *9) +1
19 =91
d = 91
c= 81
to obtain original plain
Step 8: Send c = 181 to receiver as if required for decryption
text p.
12
P=
Scanned by CamScanner
Public Key Gryptogra
2 Crypt. & Sys. Security (MU-Sem. 6-Comp) 4-16
Ex. 4.3.4
as = 17.
In public key cryptosystem given N =
187 and encryption key (E) Find
a,
corresponding private key (D).
:
Soln.
RSA Algorithm (Refer Section 4.3]
=
we select a 17 and
Step 1: Select two large random prime numbers
a
and b.
if b =1
emod (n) = 1
(Oo) *i) +1
d= e
where i
=l to 20
(160 * ")+1_9A- (160 *2) +1=
18.8
17 17
(160 *3) +1 = = (160
* 4)
+1 =37.70
17 28,2
17
(160 * 5)
+1= 47.11 = (160 *6) +1
17 17
=56.52
(160*7) +1_660- (160 * 8) +1 =75.35
17 17
(160 *9) +1
17 '= 84.76
(160 * 12)+1
= 113
17
d = 113
Scanned by CamScanner
Public
icKey Cryp
key (E) as =
17 lCrypt. Sys.
&
Find Security
(MU-Sem.
Ex, 4.3.5 6-Comp)
4-17
Usingthe
RSA algorithm Public Key Cryptography
e encrypt
select ) p=3, q= 11, the following :
a =
17 (i)
e7, M= 12
and p7, q= 11, e= 17,
b= r) Find the
corresponding
M= 25
e=7is given.
Step 5: Calculate d such that
d = e
mod (n)
ed mod o (n) = 1
7* d mod 20 = 1
(On) *)+1
d= where i =1 to 100
e
Find d such that
it is divisible by e.
Consider
i=l you can continue till d will get integer value, Qn) = 20 and
d =
e=7
(20 *1) +1)/7=21/7 =3
d= 3
Step
6: Public key = {e, n} = (7, 33}
Private key={d, n) = {3,33}
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) 4-18
:
Step 7 Calculatc cipher text message for given plain text messagd.
Plain text message given is M= 12 we consider M as i.e. P= 12
C = p'mod n where p<n
= 12' mod 33
C = 12
P= 12
we convert
When
plain text message into cipher text the corresponding ciphertext
j:
the same plain text.
17* d mod = 1
d= (o) *i)+1
where i
e =1to 100
((60*1) +1) 17)
= 3.58
d mustbe
completely divisible
by 'e'.
Scanned by CamScanner
Cypt. & Sys. Security (MU-Sem.
6-Comp)
4-19 Public Key Cryptography
It can be represented as
C= 9
Step 8: Now calculate plain text P required at the time decrvption. Once sender sends
of
P= C mod n
= 9
mod 77
P = 25
(iüi) Find the corresponding ds for (i) and (i) and decrypt the cipher texts
(iü) is d= 53 which will decrypt
Decryption key for question (i) is d =3 and for question
the message successfully.
-
Ex.
4,3.6 MU Dec. 15, 10 Marks
In
Calcülate
system the public key fe, n) of user A is definedas(7119). calculate
an RSA and otn)
Soln. :
By using RSA Algorithm: Refer Section 4.3]
problem statement Public key (e, n) = (7,119) is given, means we don't néed to
In the
sclect e & n. if we select following prime numbers which results n= 119 as shown below.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 4-20 public
Key
y
:
Step 2 n=a*b=7* 17 = 119.
Step 3 :
(n) = (a- 1), (b– 1)
=
(7-1) * (17- 1) Becau
=6* 16= 96
Step 4: Select e such that it is relatively prime to (n) i.e. ged(e, O(n) = 1
Soln.
ed mod o (n) = 1
Usin
7*d mod 96 = 1
p=?
Using RSA algorithm
Step 1 :
calculate plain
P = C0 mod n
=3 mod 119
text p. Step €
Now represent
40 mod
119 as mention
above it will
results p as 10.
Scanned by CamScanner
Key
Crypt
NPiogra
Crypt. &
Sys. Security
(MU-Sem,
6-Comp)
Because decryption 4-21
process
always yiclds Public Koy Cryptography
P= 7355 original message
mod 119 =
10 I plain text
P
10
Ex, 4.3.7
Perform encryption
using the RSA
e(encryption
key) =7, M(plaintext algorithm p=3, q = 11(two
message) = random numbers).
Soln. : 5
Using RSA algorithm
p=3, q=11, e=7
and M=s
Step 1: Prime number
p =3,q=11
Step 2: n=p*q=3x11l=33
Step 3: (n) =
p-1) *(q-1) = (3-1) *(11 -1)"
(n) 2* 10=20
Step 4 : Select e such that it is relatively
prime to o(n) i.e. gcd
(e, () =l
gcd (e, 20) = 1;
gcd (7, 20)=1
e = 7 is given,
Step 5 : Calculate d such that
d = e mod (n)
ed mod o (n) = 1
7 *d mod 20 = 1
d=
(9(n) *i) +1
nds d= 3
Step 6: Public key={e, n} = {7,33)
Scanned by CamScanner
Public Key Cyptogrars
2Crypt. & Sys. Securty (MU-Sem. 6-Comp) 4-22
C= M mod n
where M<n
= 5' mod 33
= 16250 * mod 33
c = 14
Ex. 4.3.8
11 and 3 and ouht.
algorithm to be ušed is RSA. Given two prime numbers
Tne encryption is7
decryption key and Calculate the ciphertext if the given plaintext
Key (e) is 3. Calculate the
Soln.:
Using RSA algorithm
Step 4: Select e such that it is relatively prime to (n) i.e. gcd (e, (n)) =1
e = 3 is given.
ed mod (n) = 1
Scanned by CamScanner
pl Crypt. & Sys. Cryptography
Security (MU-Sem.
6-Comp)
4-23
Public Koy
3 *d mod 20 =1
d=
d = (20xi)+11
3
d = 7
Step 7: Calculate ciphèr text message for given plain text mesSsage.
=
T mod 33
mod 33
[7 mod 33] * [7 mod 33]
*
=
= [49 mod 331 * [7 mod 33] * mod 33
= [16 * 7] mod 33
C= 13
Soln. :
as a =3, b= 19
numbers are P=3 and Q= 19 we are denoting P & O
Step 1: Prime
2: n=a*b=3* =57
Step 19
= (3-1) * (19- 1)
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Public Keyy Gryptograth
4-24.
On) = 2* 18=36
Step 4: Select e
such that it is relativcly prime to (n) i.c. gcd(C, 9(n))
=
11<e<on
selected as 5, gcd (5, 36) = 1.
is also relatively prime to o (ni
Here gcd(5,36) = One can sclect c as 7 because 7
1
e as 7
private key therefore we will select
It better if
you select large
gcd(7,36) = 1
Step 7: Calculate cipher text message for given plain text messagem=6.
Plain text denoted as p =6 (m denoted as p)
C= P
mod n
=
6 mod 57
= 279936 mod 57
C= 9
Scanned by CamScanner
6-Comp)
Security(MU--Sem. 4-25 Public Key Cryptography
Coypl. & Sys.
44 Knapsack Algorithm
be broken means
Knapsack, items cannot
which the thief should take the item as a
n
-1
it. This is reason behind calling it as 0-1 Knapsack.
whole or should | leave
21 Knansack cannot be solved by Greedy approach. Greedy approach does not ensure an
ontimal solution. In many instances, Greedy approach may give
an optimal solution.
our statement.
The following examples will establish
Example 1
are as shown in
- Let us consider that the capacity of the knapsack is W= 25 and the items
the following table.
Item A BC
Profit 24 18 i8 10
Weight 24 10 10 7
Wihtout considering the proit per unit weight (p/wd, if we apply Greedy approach to
SOve this problem, first item A will be selected as it will contribute maxmum protit
among
all the elements.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. Public Key
6-Comp) 4-26
.total profit is 24. Whereas, the optimal solution can be achieved by selecting
items,
C, where the total profit is 18 + 18=36. Ba
Example 2
Instead ofselecting the items based on the overall benefit, in this example
heitera
selected based on ratio p/w. Let us consider that the capacity of the knapsack is
and the items are as shown in the following table.
Item A B
Weight 10 40 20
Ratio 10 7 6
Using the Greedy approach, first item A is selected. Then, the next item Bi &.
Hence, the total profit is 100 + 280 =380. However, the optimal solution of this inct
can be achieved by selecting items, B and
C, where the total profit is 280 + 120 = 40
Hence, it can be concluded that Greedy approach may not
give an optimal solution.
To solve 0-1 Knapsack, Dynamic Programming approach
is required.
4.4.1 Problem Statement
Scanned by CamScanner
(MU-Sonm. 6-Comp) Public Key Cryptography
& Sys. Socurity 4-27
aCoypt.
inputs :
the following
The algorithm takes
max,mum weight W
The
number of items n
The
sequences v=:<V), V2,
.., V> and w
=<W|,
W2, ., W,>
Thetwo w, n, W)
Dynamic--1-knapsack (v,
to Wdo
forw =0
tondo
for i=efi,.
l =0
0]
W do
fiorwlto
w then
ily, S
cfi-1, w-w] then
iy +
c[i, w] =, t cl-l, w-w]
else cfl, w]
= c[-l, w]
else
the table, starting at
c[n, w]and tracing
can be deduced from
to take
of items
The set
optimal values came from.
backwards where the and we continue tracing
the solution,
= w], then item i is not part of we continue tracing with
fcfi. wl cfi-l, part of the solution, and
Otherwise, item i is
with cli-1, w].
cfi-1, w-W.
Scanned by CamScanner
2Crypt,&
Sys. Security
(MU-Sem.
6-Comp)
found in practical 4-28
can time frame Public
be computed for a given
number,while
Key Cryplegtar
efficiently. 2 Crpt. & Sys. Secu
Let us go through the inverse
operation
case of a simple version of the pry
Thus thc private
elliptic curve of EIGamal
that works with
variants,
4.5.1 it is based on numbers modulop.
quite different 4.5.2 Encryptlon
Generation number systems. Int.
of EIGamal Key The generation
Each user Palr
of ElGamal process for RSA. Bus
cryptosystem
generates E
Choosing a large
prime p. Generally a
the key pair through as follows : 4.5.3 EIGamal
chosen. prime number
of 1024 to 2048
bits length
Suppose sende
Choosing a generator (p. g. y), then:
element g.
This number must Sender represe=
be between 1 and p 1, -
but cannot be any number. To encrypt the
It is a generator of the multiplicative group
every integer m of intgers modulo p. This means The encryptio
co-prime to p, there is an integer f,
k such that g= a mod n.
For example, 3 is generator group Randomly
of 5 (Zs= (1, 2, 3, 4}).
Compute
N 3n 3 mod 5.
3
Send the cipl
2 9 4
Referring to
3 27 2 encrypted as
Randon
4 81
Compu
Choosing the private key. The private key x is any number bigger than 1
and smala
than p-1.
Computing þart of the public key. The value y is computed from the parameters p, g u Send the ci
the private key x as follows :
4.5.4 EIGare
y= g'mod p
Obtaining Public key. The ElGamal public key consists of the thrce parameters (p. & )} To decryp
For example, suppose that p = 17 and that g = 6 (It can be confirmed that 6 is a genere Comp
of group Zi7). The private key x can be any number bigger than and smaller
1 than 71,9 to as
we choose x = 5. The value y is then computed as follows : Obt
y = 6 mod 17 =7
Scanned by CamScanner
6-Comp)
a coypt. & Sys. Securiy(MU-Som. 4-29 Putillc Koy Cryptograpty
62
is and the public key is (17,
the private key
6, 7).
Thus
EIGamalEncryption
A63
sender wishes to send
a
plaintext to someone whose EIGamal public key is
Suppose
Y), then : n.
(P,8, as a series of numnbers modulo
Sender represents the plaintext
p.
plaintext P, which is represented as number modulo
a
the first
To encrypt
ciphertext C is as follows :
process to obtain the
The encryption
Randomly generate a
number k;
C2, where
Compute two values C1 and
C1 = g mod p
C2 = (P'y) mod p
C2), sent together.
Send the ciphertext C, consisting of the two separate values (C1,
= 13 is
our generation example given above, the plaintext P
Referring to ElGamal key
:
encrypted as follows
k= say 10
Randomly generate a number,
where -
o Compute the two values Cland C2,
C1 = 6
mod 17
C2 = (137) mod 17 =9
Send the ciphertext C = (C1, C2) = (15, 9).
Scanned by CamScanner
he
poH LOlCypt.
&Sys.
Security
Thus (MU-Sem.
theprivate 6-Comp)
A.5.2 key
Encryptlon is62and 4-29
thepublic
The generation andDecryptlon key
is(17,6,7). PublicKoy
process for Cryptograpn
RSA. of an EIGamal
But
4.5.3 EIGamal the encryption key pair is
ngth comnarativey
and decryption
Encryption
i Suppose areslightly simpler
than the
y, then:sender wishes to
more
P, &, complex cquie
than RSA.
send a plaintext
Sender represents to someone
theplaintext whose
To encrypt as aseries ElGamal
public
1s for the firstplaintext of numbers koy
The encryption P, which modulo p.
process isrepresented
Randomly to obtainthe asa number
generate ciphertext modulo p.
Compute a number C as
is follows:
twovalues k;
C1 and C2,
C1 = g where -
mod p
C2 = P'y)mod
p
Send the ciphertext
C, consisting
Referring to our of the two separate
values (C1, C2),
EIGamal key generation sent together.
encrypted as follows : example given above,
the plaintext P = 13
is
Randomly generate a
number, say k = 10
Compute the two values
Cl and C2, where -
C1 = 6
mod 17
C2 = (137) mod 17
=9
Send the ciphertext C= (C1, C2) =
(15,9).
4.5.4 EIGamal Decryption
To decrypt the ciphertext (C1, C2) sing private key x, the following two steps are taken :
Compute the modular inverse of (C1' modulo which is (Ci)", generaly referred
to as decryption factor.
Scanned by CamScanner
Crypt.
& Sys.
Security
(MU-Sem.
In our example, 6-Comp)
the decryption to decrypt 4-30
factor is theciphertext Public
C= (C1, C2) = Key Cryptogaphy
15 mod (15, 9)
Extract 17 using private
plaintext =9 key x =s
4.5.5 EIGamal P=(9x9)
mod 17 =
13. CHAF
Analysis
In EIGamal system,
5
-
key prime each user
has a
modulus p, generator private keyx. and
EIGamal g, and has three components
is based on public Y
the difficulty of publiç
The secure of discrete logarithm =gmod p. The strength of
key size is generally problem. te
the processing > 1024 bits.
speed front, Today even
Elgamal is 2048 bits long
protocols. Due key are used. On
to higher processing quite slow, it is used mainly Syllabus
becoming increasingly efficiency, Elliptic for key authenticaticn
Key manag
popular. Curve variants
of ElGamal are third party. D
Chapter Ende
5.1 Key Di
Before discus
5.1.1
Manager
The main
store air
it.to pro
Key mnanage
maintenance
C
Thepurpose
various C
aspec
Key manager
Cryptographic
signatures.
It is
Scanned by CamScanner
CHAPTER Module 2
Key Management
Techniques
Syllabus
Key management techniques : using symmetric and asymmetric algorthrns and trusted
third party. Diffie Hellman Key exchange algorithm.
Before discussing the key generation and usage let us first discuss what is Key.
5.1.1 Management
a
The main aim of Key management is to generate secret key between
two parties and
store it to prove the authenticity between communicating users.
Key management is the techniques which support key generation, storage and
maintenance of the key relationship between authorized
users.
The purpose of this unit is to give idea about the issues involved anda
broad survey of the
various aspects of key management and distribution of keys.
as the basis. for securing
Key management plays an important role in cryptography
cryptographic goals like confidentiality, authentication, data integrity,. and digital
signatures.
It is not the case where communicating parties are using same key for encryption and
decryption or whether two different keys are used for encryption and decryption the basic
purpose of key management is key generation, key distribution, controlling the use of
keys, updating, destruction of keys and storage, backúp/recovery.
Scanned by CamScanner
Key management
5-2
Crypt. & Sys. Security (MU-Sem. 6-Comp) lech
& Sys. Se
Crypt.
symmetric as well as asymo
can generated by using well known
Shamir Adleman (RSA), Diffe .Snn
be
Key are Nh
cryptographic algorithms like Rivest If there
can be used later for encryption and decryption of data, When attacker
exchange algorithms and
opened.
Syllabus Toplc : Key Menagement
Techniques Using symmetric and Asymmetre
Trusted Third Party
Algorithms and Key
distributic
per need. Ever
5.1.2 Symmetric Key Distrlbutlon using
Symmetrlc and Asymmet:e
Using tempora
Encryptions called as sessic
Encrvption
5.1.2(A) Symmetric Key Distribution using Symmetric Session key is
connection, tr
Key distribution Scenario
End user use
1.
3. IfX and Y uses a key previously then any one person i.e. X or Y can send ne oo
with encryption to other person.
4. Xand hás its own encrypted connection to third person
Y candeliz
and that person
a key on the encrypted links to X and Y. 1. Key
distrlt
datacat k
Point (1) and (2) are device
the manual delivery of the key. In link encryption The sc
transferred between only two partners. This is end end encryption. distrib
tò
or dev
But
in distributed system one host can communicated with many others hosts Let us
so because of that each device needs many keys that supplied dynanmcany one
tir
In wide-area distributed system it is difficut to manage number o AY
Scanned by CamScanner
(MU-Sem.
6-Core
5-3 Key management techniques
Sys. Secu
&
a cypt.
communicate cach other than ([N(N- 1)y2
hosts keys are requircd.
there
are N
If atlacker succeeds to gaining acccss to any one key then other related keys will be
When
opened.
responsible for distributing keys
distribution centre is the form of pairs of users as
Key user. shares a unique key with key distribution center.
Every
per nced. communication is encrypted between end users.
temporary key This temporary key
Using
session key.
called as some logical duration in between connection like, in
used for frame relay
Session key is connection etc. after that session key will be discarded.
connection,
transport
uses same networking facilities which have session key provided by key
user the form of encryption. Master key is also provided
End
center. Session key is in
istribution
(KDC).
Key Distribution Center
hy
that Master key
to end user or system.
So KDC shares
has one master key shares with key distribution center that can be distribution in
Each user
Some fashion.
Cryptographic
Data protection
Cryptographic
Session
protection
keys
No Cryptographic
Master
keys protection
e scenario refers each user have its own unique key called master key with key
distribution center.
S
aSsume that user X wishes to create a connection with user Y, So he requres
One time
sssion key for protecting data.
Scanned by CamScanner
Crypt. &
Sys. Security
(MU-Sem.
6-Comp)
So X
has Key management
mater key technin.
K,that is
has also known only 2 Cry
its own mater itself and the key distribution center,
key K, shares
with key distribution andy
center.
Key distribution
Key distritbution
steps
center
Sender Receiver
3. Ses
Authentication steps
Scanned by CamScanner
1Crypt. & Sys. Security (MU-Som. 6-Comp)
5-5 Kay management tochniqus
Eor example :
Each local KDC is responsible for small area
like single building or
single LAN.
Jf two different domain wants to communicate or share some key that timc local KDc
connect or contact with global KDC.
The hierarchical approach having three layer or more layer.
Key distribution
center
(Applicatlon)
Application
Security Security
service service
Host 1 Host 2
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 5-6 Koy management S
Sys.
Crypt. &
2. Ask for KDC for session 42
use differ
3. KDC distributes session key to both hosts We
Data En
4. Buffered packct transmittcd. 1.
File Enc
In Fig. 5. 1.3, Host wants to cstablishcd connection with another 2 access
hostthen or
the request packet the KDC. hetends
Key distribution center provides the scssion key to 3.
PIN En
the host using electron
the cncrypion
key also provide to the another host. tua Basically m
KDC is encrypted with master key only with the host.
distribution c
5. Decentralized key control
Application
approach requires that each system can communicate
This
in secure manner There are
so
is need to use multiple master's keys for configuration. S0 thete
propos=
Full decentralization is not possible n This
practical for large area network
key.
So session key will be created as follows :
That eight
1. X
sends the request to Y
for session key including with followingp
original message
2. Y replay to' the X with M,
original encrypted message
using shared mater key. Control
replay attaçh with session key selected
of f(M,), another M. T vector
3. Using the new session key x returns
f(M,) to Y.
QID, || M, Hash
function
Sender
Receiver
X Y
EK,Ks|IDx|D,||F(M,)) Key in
F(M2)
E(K,|IF(M,)
Scanned by CamScanner
Crypt. &
Sys. Security(MU-Sem, 6-Comp)
5-7 Kay management techniques
We use different types of session key like:
1
Data Encryption : Usc for communication in the nctwork.
2. File Encryption key : Uscd for encrypting file which stored for publically
available
or accessible on the locations.
2 PIN Encryption key : PIN is personal Identification number. It is mostly used for
electronic transaction like banking or e-transactions.
Basically master key is physically secured using cryptographic hardware of key
distribution centre.
uses the session key which
Application program is encryptedi with the master key.
There are some limitation to use any key for that purpose of uses tag with session key.
This nroposed technique is used with, DES in that it used 8 extra bits in each 64 bit DES
key.
are used for
That eight bits are reserved ror parity checking from.the key tag. That bits
following purposes
:
Master Session
Control Control Master Encrypted
key key
vector vector key Session key
Hash Hash.
function
function
Encryption Decryption
function functlon
Vector.Decryption
Fig, 5.1.5: Control Vector Encryption Fig. 5.1.6: Control
with the key.
of key generation control vector is crVptographically coupled
e umne
Ouping and decoupling process can be given to Fig.
5.1.5.
Step
1: Control
vector is going through function that produces some value
the hash
length of that value
is equal to the encrypted
key.
Scanned by CamScanner
Key managenment
Crypt. &
Sys. Security (MU-Sem. 6-Comp) 5-8 technie..
Step 2 : Hash function reduces or maps the value from large input range to the Smallinpu Crypt. &
Sys.
range.
E.g. the number of range is 1
to 100 that can be reduces by 10% so range is now 1, 2. Q gener.
approximately. to P.
Step 3 : After that Hash value is then XOR with the master key.to produe some ou 3. P decry
This output is used as for key input. know K
This key input is used for encrypting the session key thus, 4. P discar
Hash value = H=h(cv) At the end
-
Key input = M, H
from ceavesd
Cipher text = E ((M, H), S)
Where, the master key and Sis session key. For plain text we can recover
M, is
he
session key using following operation:
D([M;O ),E(M,O H],S))
Recovering session key we use both master key that user must share with KDCand
of
control vector. Because of that link between session key and its control w.. te
maintained.
There are two main advantages of control vector over the use of an 8 bit tag.
Fig
There is no restriction for control vector to its length. 2. Secret Key
2. It is available in clear form at all stages of operation.
1. Psends
5.1.2(B) Distribution of Symmetrlc Key none N
Scanned by CamScanner
Ro Crypt. &
Sys. Security (MU-Sem. 6-Comp)
5-9 Koy managernent techniques
9 O generates a session key K, and encrypted using P's public key
(PU) and transmis
to P.
P
decrypts the session key K, by using its own private kev. Now both P and
2
know K.
Pdiscards public/private key and
Q
4. discards P's public key.
communication both P
and The communication is sccure
Q
of discards K,.
At the end
cavesdropping. The communication becomes unsafe from man-in-middle attack.
from
Initator Responder
P
3. Hybrid Schemes
Distribution Center
use KDC (Key Distribution Center) key
Ihis technique retains the of
encrypted
a secret master key with each user and distributes secret session keys
hat shares
with the master key.
Scanned by CamScanner
Key management techniqueg Cry
Public Keys
6.1.3 Distribution of :
public keys
techniques are used for the distribution of
Following
1. Public Announcement
2 Publicly Available Directory
3. Pul
3. Public Key Authority
-
4. Public key Certificates
1. Publlc Announcement
as RSA, any user can send his or her
In a public key cryptograpby, such 5.1.8.
the group as shown in Fig,
other user or broadcast it to
PU PU2
User 1 PU PU2User 2
PU PU,
Fig. 5.1.8: Public Announcement
Until user A has got this thing and alerts to other user, a pretender is able to rezd al
encrypted messages for user P.
2. Publicly Available Directory Steps
1. Ps
A dynamic publically available directory is used to achieve the security. Maintenan:
and distribution of public directory is controlled by a trusted entity. 2.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) 5-11
Kay managoment techriua5
Publo koy
directory
PUp
PUo
P
Fig. 5.1.9 : Publicly Available Directory
3. Public Key Authority
It gives stronger sccurity. As shown in the Fig. 5.1.10, a central authority keeps a
dynamic directory of public keys of all users. Additional, cach user knows the public
key of authority.
Public - key
authority
Initiator Responder
Steps
to authority for public key of Q.
1. Psends a time stamped request
message. A message is encrypted using authority's private
A authority sends
an encrypted
public key. A message includes Q's
2.
by using authority's
key, so that P can be decrypt
it
by P with
can use by P for the encryption, the original request sends
public key which be
the time stamp. message to Q. An
for an encryption and send an encrypted
3. P uses Q's public key nonce (N), which is used to
Identity of A (Dp) and
encrypted message contains the
identify the transmission uniquely.
authority similarly like
1
and 2.Now P and Q start
485
Q
retrieves P's public key from the
the communication. Two additional steps may be requiring.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem, 6-Comp)
5-12 Key managementtechniaueg
6. O
sends an encrypted message
to P. A message
contains P's nonceN and encrypted using P's public key which
Q's nonce N,.
7. P eturn sent an encrypted message
in
using Q's public key which contains Q's nonce
to ensure Q that its correspondent N)
is P.
4. -
Publc Key Certificates
A public key authority has some
drawbacks in the system.
a user
If has to communicate with authority for a
public key for every other
Usertha
he wishes
to contact. This approach provides certificates to users for exchanging the
keys among them without contacting
to the authority.
The data and
public key maintained by authority itself may be vulnerable
tampering. tothe
The certificate
authority shown in Fig. 5.1.11 is a government agency or trusted
agency.
Certificate
authorty
1
2 5
Scanned by CamScanner
techniques
y which
Grypt. &
Sys. Security
once 5.1.4 Key Generatlon,
(MU-Sem.
6-Com
N2.,
6.1.4(A) Key Dlstrlbutlon, 5-13
Generatlon
Key Storago Koy
generation and Usnga nncorert tchninue
is the
cryptography. proccss
generating
The key can
ser be generated keys using
ehe functions
that using
of passwords $ymmeric or
random or
ngthe It is standard (ANSI and PINs. pseudo-tandom
asymmetric
key
X9.17) way key bit generator
to generate
5.1.4(B) Key Distrlbution pseudorandom
which uses
to the DES keys.
Key Distribution also
called as
securely distributed from Key
Transportation
usted use of it the location where is
the process by
then transmitted they are which keys are
using manual generated or stored
loaders), automated methods transmission to where there bec
combination of automated (e.g., key transport methods
(e-g., file transfer, key
and manual and/or key
methods. agreement protocols), or a
Secure key distribution is
the basic aim
cryptographic system. The to achieve
goal of any the integrity and trust
key distribution process in any
To ensure that the keys are distributed is :
to intended recipients
To ensure that the keys sent are the corect only.
keys and sent to correct
To ensure that the keys recipient.
achieving authentication
and protection of recipient.
To ensure.that it is not modified
during transmission.
To ensure that transmission
mechanism is secure and intact.
important to define the key storage for data management of cryptographic key; the
It is
Proper use of. the function depends on the key type, protection
requirements and lifecycle
:
stage. There are different function provide by key storage
1. Operational Storage
2. Backup Storage
3. Archive Storage
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 5-14 Key management
1. Operatlonal Storage
Ifthe required for operational purpose that keys can be taken from operalit
key is
Storage when not present in active memory (the memory which 1s prescntly
that key
the key stored in operational storage is lost or corrupted, then mua
recovered from backup storage.
Certain key types such as PIN, master keys are always stored in physical hyardwa
uses a
and never on software system. The operational storage device koy,such
of a server which is directly connected
encryption key store on local hard disk
network.
Once the key is stored in a database, the database administrator should notaccesS%,
the keys in the clear text form. If database administrator stolen the key, he/she
must
not use it tothe encrypted data. Apart from this, storage media
reàd beprotete
as dual control and rigorous access
by strong physical and logical security such
logs.
2. Backup Storage
In case of hardware or software failure if keys are lost then there should be s.
back up mechanisrn required to recover the lost data or corruption of the operai
storage. The backup of only the important keys arë stored.
Finally, the backup determination depends on key usage whether the application ;
important to use the key.
3. Archive Storage
.A Key Archive is the term used to recover the large histórical encrypted data.
The data backup storage keeps the data of today whereas
archive storage addresse:
the data management of tomorrows or overcome the
future challenges of data storag:
management.
Scanned by CamScanner
cypl. & Sys.
becuy(MU-Sem. 6.Ch
5.15
5.1.4(E) Key Valldatlon
Updation
s1.4F) Key
A function performed on a cryptographic
key in order compute new, but related key
to a
5.1.5
Importance of Key Management
Q.52.1 Explain how key is shared between two parties using playfair Diffie Hellman
a
key exchange algorithm.What is the drawback of this algorithm?
(Ref. sec. 5.2) Dec. 15, 10 Marks
5:2.2 Explain "Diffie-Hellmen key exchange algorithm with suitable example, Also
of MIM attack in it. (Ref sec. 5.2) May 17, 10Marks
explain the problem
Scanned by CamScanner
managomont tochrine,
Crypt. & Sys. Security (MU-Sem. 6-Comp) Key
5-16
oxample,
with sultable
Q.5.2.3 lustrate Ditie Hellman key exchange
algorithm
(Ref. sec. 5.2) prone to man
Q. what way,
exchange
algorithm, in t
5.2.4 In the Diffile Hellman kay
middle attack. (Ref. se0. 5.2)
seG, 5.2)
Oxchange. (Ref.
Q.5.2.5 Brietly e explain Diffie Hellman key algoritho
as Key exchange
was widely known Hellman in 1976. Difs,
The Diffie Hellman algorithm
and Martin
Whitfield Diffie cryptographic
agreement algorithm developed by
(symmetric) private keya
same
Hellman algorithm is used to
generate transfer this key from sender y
no need to
so that there is
senderas aswell receiver end
greement not &
receiver. used only for
key
Hellman algorithm is communicate
that Diffie receiver want to
Kemember message. If sender and
decryption of Diffie Hellman Algorithm ateg
Cncryption or generated by
agree on the
same key
us start with the algorithm.
each other they first Let
encryption or decryption.
on they can use this key for
Hellman Algorithm agree on f
T. Steps of Diffie they must
communicate with Suresh
step is that if Ramesh wants to
1. The first
p and q. that
large prime numbers a, and calculate R such
number
selects another
secret large random integer
2. Ramesh
p
R= gmod
Ramesh sends this R to Suresh.
3.
integer number b, and calculate
independently selects another secret large random
4. Suresh
S such that.
S = mod p
agreement algorithm.
9. We
have Ry = Sy= Khence proved. (K is called symmetric key).
Scanned by CamScanner
attech
echnique
Hol Crypt.
&
SyS. Securityy
(MU-Sem.
6-Comp)
aninthe For example
Damesh
5-17
1
and Suresh Key managoment
are agrec technique0
2. Ramesh selects on two
another secrct largc prime
numbers
m or R= q mod p largc random number 5 i.c, sayp= 17 and q = I.
16. key = =7 mod 17 =11 a=5and calculate
Diffe (7x7x7x7 R
Such that
if p a
Solve =7 and q=17 using Diffie Hellman algorithm. Select =6, b=4.
:
Soln.
By using DIffie Helman algorithm
1. Ramesh and Suresh are agree on two large prime numbers sayp=7 andq=17.
2. Ramesh selects another secret large random number
6 i.e. a=6 and calculate R such that
R = qmod p = 17° mod7
R =1
3. Ramesh sends R to Suresh.
Scanned by CamScanner
Crypt. & Sys.
Security (MU-Sem.
6-Comp)
4. Suresh selects 5-18 Key management
another secret tech:
large number 4
i.c. b=4 and calculate Cypt. & Sys
S mod p = 17° mod p such that
= (17x 17% Suresh is ca
17x 17) mod 7 7
S = 4
5. Suresh sends
numberS to Ramesh
6. Ramesh now calculates =S
it's secret key Ry as follows : 8. If R
future.
Rx = S
mod p = S° mod p =4° mod 7
= Ex. 5.2.3
(4x4x4x4x4x4) mod 7
generator g
-
= If
R 1
Show tha
7. Suresh is calculating his secret (i)
Sg as follows :
(ü) HA has
SK = R° mod p
=1' mod 7 B
has
(ii) If
SK'= 1
Calculate
(iv)
O. T KK = Sx then Ramesh and Suresh can agree for future communication. Soln.
:
R = l60 ie. 10
Scanned by CamScanner
Chnigu
For example
As mention in (i)
a
=2 and n=11
Calculate on) i.e. o(11) = {1 to 10 }
=10
According to Euler's theorem
an= 1 mod n
2°= 1
mod 11
1024 = l mod 11
Scanned by CamScanner
Key management
Crypt. & Sys. Security (MU-Sem. 6-Comp) 5-20
Imod 11 = 1
g as a q (i.e.
Representing g=2 =q)
Using Diffie Hellman algorithm
2. Suresh now calculates R such that
mod p (Here q=2 andp =11]
R=
= 2' mod 11 [a is 9 public key]
R= 6
S = 8
as
:
are 7.
Shared secret keys of Ramesh and Suresh
=
Hence, R S=7
algon
our notations mentioned in Diffie Helliman
Note: Inabove example we have solved by using
B denotes Suresh, denotes
a a
and o is same as p. Students
So here A denotes Ramesh,
Scanned by CamScanner
nttech
echniu
C
Crypt. & Sys.
Securityy
(MU-Sem,
6-Comp)
Ex. 5.2.4 5-21
Key management
A and B tochniques
decide to use
secret no. Diffie Hellman
and exchange key exchange
numbers 6 and where p = 13, g =
() What is common 11.
2, each chooSe
secret key? his om
) What are
their secret numbers
?.
H) Can intruder m
gain any knowledge
and 11. If yes, show from protocol run
how ? if he sees
Soln. : p, 9 of and two
keys o
According to Diffie
Hellman algorithm,
Let us say A as Ramesh
and B as Suresh
Also p = 13 and g=2
Here in our example we
are denoting g as q,
. p 13,
q'= 2
Secret numbers denoted as, a =
6 and b= 11 by using Diffie
1.
Hellman algorithm.
Ramesh and Suresh agree on two
large prime numbers p = 13 and q
=2.
2 Ramesh selects ariother secret no. a
=6 and calculate R such that
R =qmod p
[q = 2, a =6, p= 13]
= 2° mod 13
R= 12
= 2
mod 13
S = 7
Ry = 12
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Key management 1echria,
5-22
=
S R'modp[R = 12, b= l1, p= 13]
12! mod 13
= 12
S
() Shared secret key of Ramesh and Suresh is
= Sx = 12 [A and B = 12]
R
() Secret numbers of Ramesh and Suresh are
R= 12 and S =7
(ii) If intruder m knows P, g and a, b then what willhappen. [Here g = q
Case I : Value of p, q, a, b are known to m represented as,
Ramesh Suresh
p=13, q
=2 p=13, q
=2 p= 13, q =2
Use Diffie Hellman algorithm,
a
After selecting large prime numbers, it's time to select random numbers and b.
The secret random number selected by Ramesh and Suresh are,
Ramesh Suresh
Consider m as intruder selected two random numbers say a =8 and b = 6 as his own secret
key, because he wants to calculate value as R and S, as he intercepted conversion between
Ramesh and Suresh
= 2° mod 13 = 2° mod 13 = 2
mod 13
= 12
R= 9 S= 7
mod 13
= 2' mod 13 = 12
Scanned by CamScanner
& S/8.
Crypl.
MU-5M. B-Comp) 5-23 Kay managemei!
Case 3 : Following arc the valucs available with Ramesh, Suresth and intruder m
R=9, S = 12
R= 12 S=7
Case 4:
Ramesh sending
his R= 12 to Suresh but intruder m
sending his ownR =9 to Suresh
= 12. Suresh sending his S = 7
to Ramesh, here. again intruder
m
sending his own
instead ofR
values
12 to Ramesh. In this case Ramesh and Suresh doesn't aware that which
value of S=
sending and receiving [Intruder m sending his own value Because his interception].
of
they are
new values with Ramesh, Sureshand intruder m.
Following arethe
p= 13 a= 8,b=6,p= 13|p=13
Rg=S' mod p
11
= 12° mod 13| Rg= S mod p S =R'mod
=7 mod 13 mod 11
Ry=1
=3 Sç=3
Sy=R'mod p
= 12° mod 13
=1
1 and Suresh
thinking that value of his secret key
is
Ihink what is happening ? Ramesh is
also thinking that value of his secret key is 3.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 5-24 Key managementtechnique
P
During real communication between Ramesh and Suresh intruder m
sending
secret keys to Ramesh and Suresh. If Ramesh sending his secret key RK = 1
to Suresh
because of man-in-the-middle attack. Intruder
sending his secret key RK=3 to Suresh
m
Chapter Ends.
Scanned by CamScanner
Ghique
his
Ao oWn
Suresh
Suresh
issecre
CHAPTER
msuch
6 Cryptographic Module 3
Ends..
FunctionsHash
Syllabus
Cryptographic
nash functions,
HMAC, CMAC. Properties of secure
hash function,
MD5, SHA-1,
MAC,
Syllabus Topic :
Cryptographic
Hash Functions
6.1.1 Cryptographic Hash Functions
In hash function H accepts a
variable length block
Droduces the fixed of input data called as
size hash value can be represented as M
and
h = H (M)
A good has function provides a property
that hash function is applied on large amount
data input (M) and then produces of
it the fixed amount of output data.
If any bit or bits changes in the data, then whole hash function output
data will also
change.
When hash function provides security application this is called cryptographic hash
functions.
Scanned by CamScanner
Cryptographíc Hash Funciona
Crypt. & Sys. Security (MU-Sem. 6-Comp) 6-2
difficulty
length ficld produces forte.
Because of these securities will provided, the
withthe same hash valuc.
attacker to create alternative message
L bit
Hash value h
H (fixed length)
CryptographicHash Function
Diagram of
Fig. 6.1.1:Block
implementing cryptographic Hash functir
mostly used for to
Cipher Block chaining is
cryptographic hash function.
whirlpool is another popular padding is done.
on original message when
applied
Cryptographic hash algorithm is
bits.
variable length input is added like 1024
ln padding fix value h.
algorithm is applied so it creates a Hash
After this hash function
Cryptographic Hash
6.1.2 Applications of
function. It is mosty
adaptable cryptographic algorithm is the cryptographic hash
Most
application.
used in Internet protocol and security :
are some application which are used in Cryptographic Hash Function
Following
1. Message Authentication
verify or checks the integrity
of
that message.
Message Authentication checks that the data received from
sender which is exactiy
same as sent to receiver. (i.e. content of the data will be
same no modification wll
have done or insertion deletion or updation).
valid or
Some authentication provides a mechanism that checks identity of sender
not.
When Hash Function provides a value, which.is used for message authentea
purpose then that value is invoked as Message Digest (MD).
Scanned by CamScanner
Crgptographic Hanth
Fiurctin
&
Sys. Security (MU-Som. 6-Comp) 6-3
M
Compare
K
K Hash
H(M)
Message (Key for (Key for function
encryption) Decryption)
Hash function
Fig. 6.1.2(a)
symmetric encryption.
with hash code that
encrypted using
message is comc from
Message added key, A
secret
receiver shares the same
B or
(a) A and
hash code provides a security
Sender that
der A that must not
be changed. After
authentication.
structure to active ReceiverB
Sender A
Compare
K
E(K,H(M)
Fig. 6.1.2(b)
This minimizes the
symmetric key encryption.
Hash code is
encrypted using. any confidentiality.
6) required
applications that don't
load for those Receiver B
SenderA
M
>Compare
H(MIJS)
Fig. 6.1.2(c)
authentication only use hash function. In
message
encryption required for they communicate with
(C) No same secret key when
process two person shares the
tis
each other.
over adding the original message M and S
value
Sender A calculates the hash
and attach the result of hash value
to message M.
Scanned by CamScanner
Crypt. & Sys. Cryptographic Hash Funcs
Security (MU-Sem.
6-Comp) 6-4
M M
-
+Compar
K
H(MI|S)
E(K(M|JH(M|jS))
Message Authentication
Fig. 6.1.2(d) : Simplified Examples of the use of a Hash Function for
value.
MAC function is applied to the original message and the produced result will
be
Scanned by CamScanner
6-Como)
cvpt. & Sys. SeCUrTlY (MU-Sem, 6-5 Cyptogrehin Pfs furetrs
When user cnters a password the hash value of the password is compaed with the
valve for verification purpose.
storcd hash
Hash function is. also uscd for intrusion detection as well
as virus detection.
H
system stores the (F) for cach file.
One
Sender A RecetverB
-
Compare
Digital Signatures
Fig. 6.1.3a) : Simplified Example of
ReceiverB
Sender A
M
PRa PUa
M Compare
K D
E(PRaH(M)
E(K[M|JE(PRa, H(M)
Digital Signatures
Fig. 6.1.3(b) Simplified Example of
:
3. Other Applicatlon
Hash function. The password
To creating one way password file we commonly used
or
will stored on operating system because of that
hacker cannot access the data that
password file.
is used. Pseudo
the pseudo random function cryptographic hash function
To construct
Scanned by CamScanner
Cypt. &
Sys.Security
6.2 (MU-Sem.
Simple 6-Comp
6-6 Cryptographic
Hash Functions HashF
The process
of
value h) transforming
is called as input message m
into a fixcd sizc string (calloa Whe
function hash function
applied on and is denoted by H. Here h is the
it
output
type
input message
m. ofha To
Hash function h = H(m) the
message, protects the integrity of The
then the.contents the message. If attacker tries to modify
applying Hashing of
original message may changed the 1.
algorithm. The most oij:
it can be denáfiea
Here, there popular hashing algorithms are
MD5 and 2
are two SHA
principle. simple hash function, all hash functions are operate
using
(1) The message s
file is like a
simnple input
a sequence of
(2) When it open n-bit blocks.
input is processed
only one block at the
generate an n-bit given time in iterative
hash function.
The simple hash function
is the bit-by-bit XORing
done of every block.
This can be shows
the following ways :
CH = B, B, .....>Bim
Where,
Scanned by CamScanner
Coypl & Sys. Security (MU-Sem..6-Comp)
6-7 Gyotograhic Hash Functions
To
improve the malter performancc, Use simple ways i.c. one-bit circular shift, and also
valuc after the every block is processed.
rotationon hash
the.
as
steps are summarized by follows
The
zero.
n-bit hash value initially
1.
Set the
every successive n-bit block of data is as follows :
Process the each and
2.
value is rotate to the left by onc bit.
The current hash
The
(1)
XOR of every block and attach the
Define hash code h= H(M) as block-by-block
()
hash code as the
final blockS.
h= A+1
= A,
A,..... 0AN
Next, encrypted
message plus hash' code to produce the
Using CBC mode
encrypt the whole
BN+
message B,
B, B3....
we get
cipher block chaining,
For example, the definition of
A, = B-,D (K, B)
Scanned by CamScanner
Crypt. & Sys. Security(MU-Sem. 6-Comp) Cryptagraphi,t
6-8 Hah
messages.
3. A
small change to a message should change the hash value so extensively that
hee
bash value appears uncorrelated with the old hash value.
. It is infeasible to find two different message with the same has value.
(MU - Dec. 17
Q.6.2.2 What is the role of a hash fünction
in security ?
(Ref. sec. 6.2.3)
Dec. 17, 3 Marks
Requirement and Security
Before taking any action, we
need to define the two points.
For a hash value
h=H (m), we can say that m is the pre-image
block whose hash function, of the h. That is m
dala
using function H, is h.
Scanned by CamScanner
ash
Funct
cpt. &
Sys. Securty(MU-Sem,
6-Cormp)
Here, the collision occurs
For we
if A y
region, use and H
Cyptercki Hanh
bere hash (A)= H
undesirable. function (3) efon
NMarks the data,
Assume, suppose the integrity
length and also the
the block of length of
of bits with hash code isn bit,
collitions are
clearly
Here, the b>n. and function
total number of possible H use as inpt
Total number of hash messages messages
values is is 2b. or
Ssible 2.
6.2.4 HashFunctlons Based on
Clpher Block
Without using he sccret Chalning
key. the number
unction based on a cipher block chaining.
of proposal
have been
The Rabin is
made for
proposed first techniques the hash
message M
are divide
that techniques are
The
into working
the fixed size blocks the following ways.
M,... My use
method like. DES to calculate i.e. M,,
hash code following
manner : encryption
HF, = Initial value
HF, = En (M, HF,_)
C= HFN
It is same like a
CBC techniques but in
this particular condition
secret key not used.
the any hash code, that design is likely to
Using is
encryption algorithm is the birthday attack,
and if used
DES. It produced only 64-bit hash the code then the desien is the
accessible.
Ae well.
the birthday attack used the another version
and if the candidate access only one
message
and also used it's correct signature and not attain a multiple signings.,
- Here used the outline:
Individually, assume that the candidate prevents a message
with a signature in the form of
the encrypted hash code and then an encrypted message is m bit long.
1. To calculate the unencrypted
hash, code C used algorithm which is defined at
beginning of the subsection.
2. To design any desired messages in the form of P,, P, P, ....PN-2
3. Count
HE = E, P, HF-) for i s (N-2)
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 6-10 Cryptographic Hash Fu.e
Accomplish 2 any random blocks ; for any block A, compute E, (A, HFE,
accomplish the additional 2m2 any random blocks; for any block
(B, C) whcre the D, is the decryption function like to En
B,
Compute
,
A
probability there will be
5. Place on the birthday paradigm, along high and
E,(A, HFN-2)=D,(B, C).
6. Fromthe message Mi, Mz, M3, ... MN-2, A, B,
this message has the hash
It was developed by Ron Rivest. This algorithm takes an input of arbitrary length at
-
128- bit message digest is produced. The input message is produced in 512 bit blocks.
Message
Padding bits
(1 to 512) (n mode 2)
=
L'512 bits N*32 bits
n bits
Message 100.0
512 bits 512 bits + 512 bits 512 bits
Mo
M, M,
Scanned by CamScanner
Cypt. &
Sys. Security (MU-Sem. 6-Comp) 6-11 Coptograpttr, Manh Frrtinns
a
6.3.1 shows processing of message to produce message digest. Following steps
Fig.
of MDS.
cxplains the procedure
Steps MDS Message Digest
Algorithm
(5) Output
Digest Algorithm
Fig. 6.3.2: Steps MD5 Message
Bits
(1)
Append Padding
4 message is padded to
make the length of
message
is 448 mod 512, The length of
The an integer multiple of 512.
message 64 bits less thn
the padded
is
a single 1-bitt followed by 0 bits. The length of padding
message consists
The padding
between 1 to 512,
bits is in
- ... M, ... ML-. The total length of expanded message is L * 512 bits.
As Mo M,
P= 67452301
Q= EFCDA1389
98BADCFE
R=
S= 10325476.
Scanned by CamScanner
crypk &
Sys. Security (MU-Sem. Cryptographic Hash
6-Comp) 6-12
t used a little-endian methods, Hence initial values (IV) are represented as,
P =01 23 45 67
Q= 89 AB CD EF
R =FE DC BA 98
S = 76 54 32 10
have similar structure but differ in primitive logical function referred as A, B, C,D.
and produces 128
Each round takes input:512-bit block, processed it bit output.
T
output of
fourth round is added to the first round C, to produce
addition modulo 2
Ma
}128
16. steps
BTi7.32
16..steps
CT33..48
16.,.steps
P
Q
R.s.
16., steps
|128
Scanned by CamScanner
undion
Grypt. &
Sys. Security
(MU-Som.
6-Comp)
(5) Output 6-13
After processing Cyptographic
Hash Functinns
all L 512-bit
Theentire MD5 process blockS, the
can 128 message
be summnarized bit digest is produced
CVO =IV ns follows as a ontput.
:
CVq+l Sum32(CVq. RFd [ Mq.RFe
( Mq.,RFb
MDSSum = CVI, | Mq, RFa Mq.
[ CVq
11)
.
nds Where,
output of l60 bit message digest. The overall processing of SHA-1 is much similar to MDS.
The processing is explained as follows.
Padding means addition of bits to the original message. To make length of original
message is padded to make
massage to a value 64 bits less than multiple of 512. The
the length of message 448 mod 512.
Scanned by CamScanner
Cryptographic Hash Furer
2 Crypt. & Sys. Security (MU-Sem.
6-Comp) 6-14
of
an integcr multiple S12.The,
The length of
the padded message is 64 bits Jess than
many 0 bits as required.
padding message consists of single 1-bit,
a followed by T,
length of padding bits is in between to 512.
1
as Q, R, S, T, as.
represented as five 32-bit registers P,
P = 67452301
EFCDAB89
Q =
98BADCFE
R=
S = 10325476
T =C3D2E1FO
registen
are same as MD3. These five
method. First four registers
It uses a big-endian
as,
P, Q, R, S, T are represented
23 01
P= 67 45
Q = EF CD AB 89
98 BA DC FE
R=
S = 10 32 54 76
C3 D2 E1 FO
T=
word) Block
(4) Process Message in 512-bits (32 bit 16
as shown in Fig. 6.4.1. These rounds
It consists of four rounds of 20-step each
structure. These rounds used different
referred as F1, F2, F3, F4 have similar
primitive logical function.
bit output. The
Each round takes input 512-bit block processed it and produced l60
output of fourthround is added to the first round CV, to produce CVq+1
Scanned by CamScanner
Cryptographlc Hash Furction
Crypt. & Sys. Security (MU-Sem. 6-Comp) 6-15
K, 6E D9 BB A1
K, = 8F IB BC DC
K4 = CA 62 C1 D6
Output
(5) messagc digest is produced as
After
processing allL 512 bit blocks, the 160 bit
output.
compression function uses
a
feed forward operation where the chaining
The SHA output obtained (last step) after
input of the first round is added to the
variable CVq as shown in
steps to produce the next chaining variable CVg+1
80
execution of
Tt32
P Q! R! sl
FK,W[..19]
20 steps
FKGW(20..39
20 steps
Fgk,W[40.,59
20 steps
P
FK,w (60..79)
20 steps
160
CVg+1
Scanned by CamScanner
Cryptographic Hash Funcir
Crypt. & Sys. Security (MU-Sem. 6-Comp) 6-16
where.
. a chaining mode
first. block ín
IV= initial yalue of the PQRST buffer, used to deal with the
Differentiate between
MD-5 and SHA Dec..15, Dec. 16,
May 18, 5 Marke
Q. 6.4.2
(Ref. sec. 6.4.1) fromn each other in desig
differs
MD4. Both are quite similar. They
Both are derived from
goals.
MD5
SHA-1
Sr.
No. message digest. Hence i
uses a 128 bit
message digest. Hence it| It Brute - force
1. It uses a 160-bit SHA1 against
weaker than
is stronger against
Brute - force attacks is
attacks.
than MD5.
against cryptanalysis
SHA-1 is not vulnerable against| MDS is vulnerable
2.
cryptanalysis.
Scanned by CamScanner
a Crypt. &
Sys. Security(MU-Sem. 6-Cormo)
6-17 Coyptographic Mash Ftens
Applicatlons of Cryptographic Hash Functions
6.4.2
Appllcatlons of Gryptographte Hanh Funetiond
1. Data Authentication
2. Digital Signatures
3. Password Storage
4. Key Generation
CryptographicHash Functions
Fig. 6.4.2: Applications of
Authentication
1. Data
identities and ensure that the origin of an electronic message is
of
Usedto
establish proof or
a message has been modified not.
coITectly
identified and to checkif
Signatures
+ 2. Digital
private key and lidentify the proof of message.
message digest using
Encrypt
Storage
3. Password
get
password is compared
with that in the storage: hackers cannot
Message digest of
4. Key Generation
can be made computationally expensive
Key can be generated from digest of pass-phrase;
to prevent brute-force attacks.
Scanned by CamScanner
Cryptographic Hash Furrir
Crypt. & Sys. Security (MU-Sem. 6-Comp) 6-18
:
Syllabus Topic MAC
G= E(k,
P,C,]}
C, = E(k, P, C,-1}}
Scanned by CamScanner
Fiunctiont
(MU-9om 6-Comp) Coyptograchic Hast
Cypt. & Sys. Security 6-19
Step
1
Step Step 3
Cormpare
Step 4
Secret key Secret key
MAC
Slgnlficance of
65.1
MAC ensures that only receiver can identify the original message.
mentioned earlier
modifies the original message he cannot modify the MAC Hashl, in
As M
1.
attacker
Even if modification, receiver's calculations of MAC Hash2 will differ from it.
case of
Hash l used to calculate the MAC is
is not modifying the MAC? Because key
attacker
receiver of the message. The attacker don't know the key used
Why
to sender and
knówn only reason he attacker cannot modify the MAC.
transmission, the
uring not from any third person
assures that message
A
B
is coming from
case receiver
In this only to
2.
key K used at the time of encryption and decryption is known
secret
because the message.
and receiver of the
sender authentication.
confidentiality and
3 MAC provides data
on DES
Code based
652 Message Authentication
Authentication Algorithm.
MACS 1S referred to as the Data
One of the most widely used operation of
Cipher Block Chaining (CBC) mode of
The algorithm is designed
using the
6.5.2.
DES, as shown in Fig, blocks
mode the given plaintext message is divided into
(CBC)
In Cipher Block Chaining plaintext block
each-64-bits blocks get encrypted independently. The
of 64 bits each and
same size (64-bits each).
produces ciphertext of
same key and transfers the
encrypted (DES encryption) using
The given plaintext is
encrypted data (ciphertext) to
receiver.
of
as using the Cipher Block Chaining (CBC) mode
The algorithm
can be defined
Scanned by CamScanner
Cryptographic Hash Functita
Crypt. & Sys. Security (MU-Sem, 6-Comp) 6-20
Message M= P,Pz...Pn
Pn
P
P-t
P
K DES
DES oncryption
DES
K DES K encryption
encryption encryption
Ch= MAC|
Cn-1.
operation
CBC mode of
Fig. 6.5.2: MAC design using DES in
Authentication Code (DAC)
Data
Using DES encryption algorithm, E and secret key Ka
also called MAC is calculated as follows.
Authentlcation Code)
6.5.4 HMAC (Hash based Message
XOR
Secret key
Transmiting Key ipod
FMessage m
XOR
|Transmitting Key Hash (H)
HMAC
Scanned by CamScanner
Som. 6-Comp)
& Sys. 5ecuTIY (MU 6-21 Cyptograptic Hash Furetiens
Ct
Complete HMAC Operatlon
6.5.44)
Digest, Algorithm: The message digest algorithm used
Message (MDS, SHA-I etc.)
) message whose MAC is to be calculated.
m
M- The input
(D Thesharcd|
secret key used in HMAC
The string
OX36 byte repcated 64 times
ipad d- times
string OX5C byte repcated 64
opad- The
(Two.fixed
and different 64 byte strings ipad and opad)
step 1
OSI = Output of
OS2 = Output of
step 2
must be equal to length of key, i.e. length of
message m
The length
of
key (K) must
Step I: be equal
to number of
bits iin the original message block. For example in original 7
key is 170 bits and message length (i) 512 bits then odd 342 bits into
initial length of
key length and
make it equal size
Secret key
now transmitting and XOR with ipad to produce OS1 (output of stage 2
Step 2: variable).
(OSI is a
step message
to output of
2
Append message
m
i.e. original m
i) added with output
Step 3: of step2 which will produce message digest (OS1 + m)
applied on the output of step 3. This will produce output
The MDS and SHA -1 is
Step 4:
Hash (H).
key
K
with opad to produce output variable called OS2(output of
XOR the secret
Step 5:
step 1)
Hash H OS2Here the message digest calculated in step
with
4 taken into
Step 6: Add
output of step 5.
consideration (Hash H) and appended with
generate
on output of step 6 (0S, + Hash H) to
Step 7: Message digest algorithm is applied
final output called as MAC.
form as,
We can also write above steps in mathematical
Where,
k = secret Kay
Scanned by CamScanner
Cryptographic Hash f,
Crypt. & Sys. Security (MU-Sem.
6-Comp) 6-22
= X OR opcration
3. Once the hashis generated which will Without secret key it is not. possible ta
not give any clue to the attacker about attacker to identifies and validate the cored
original content of the message. MAC.
4. Most popular message digest Most popular MAC are MAC using DES
Scanned by CamScanner
Sys. Security (MU-Som. 6-Cofnp)
Gypt. &
6-23 Gryptographic Hash Functirno
00..0
kE Derive Tweak
E
E k-b
Output
Fig. 6.6.1:CMAC
Scanned by CamScanner
Crypt. &
Sys. Securty (MU-Sem. 6-Comp) 6-24 Cryptographia
Hash
To generate an (-bit CMAC tag (0) of a message (m) using a b-bit block cipher
sccret kcy (k), one first gcncrates two b-bit ky) using the
sub-keys (ky and
algorithm (this is equivalent to multiplication by r and & in a finite field GF(2'),
Let <
denote the standard left-shift operator indicate bit-wise exclusive
and
1. Calculate a temporary value ko =
E(0).
2. a
If msb(ko)
=0,then k = ko <1, else k, =
(ko <K1)
1
definite
C; where Cis
caN
that depends only on b.
(Specifically, Cis the non-leading coefficients
k = 1010, and k, =
0100 0011 = 011l2.
... ..,
Divide message into b-bit blocks m = m, | | m- l where m, ny- are comp
M
1.
3. Let co = 00...0,.
Scanned by CamScanner
6-Comnl
Security(MU-Sem. 6-25 Cryptographic Hash Functions
a cvpt. & Sys.
return VALID; else, return INVALID.
2.2. If T= 1,
widely used in Govt and industry.
CMACis
message size limitation
Rut it has
paddino
T can be overcome using Z keys and
Cipher-based Message Authentication
Thus forming the
Code (CMAC).
Chapter Ends...
Scanned by CamScanner
Module3
CHAPTER
Digital Certificate
Syllabus
Digital Certificate : X.509, PKI.
Q. 7.1.1 Give the format of X.509 digital certificate and explain the use of a digital
signature in it. (Ref. sec. 7.1) Dec. 15,5 Marks
Q. 7.1.2 What is a digital certificate? How does it help to validate the authenticity of a
user? Explain the X.509 certificate format. (Ref. sec. 7.1).Dec. 17, 10 Marks
Digital certificate is an electronic file that is used to identify people and resources over
insecure channel or a networks called Internet. Digital certificate also enable secure.
confidential communication between sender and receiver using encryption.
For example when we travel to another country, our passport provides a way to establisi
in the
Our identity and gain entry. Digital certificate provide similar identification
electronic world.
authorized digta
The role of Certification Authority (CA) is to issue certificates with
to validate
signature. Much like the role of the passport office, the role of the CA is
so that it cannot be tamperco
certificate owner's identity and to sign":the certificate
unauthorized user.
Scanned by CamScanner
Security(MU-Sem. 6-Comp)
& Sys. 7-2 Digital Certificate
CA has signed
a
certificate, the owner can present web
Once a their certificate to people,
network resources to
provc their identity
for communications over
confidential
sies andchannel.
insecure
standard called as X.509 defines Structure of digital certificate. The International
Telecommunication
A Union (ITU) permittcd this standard in 1998.
of K.509 digital certificate.
71.1.shows structure
Fg.
Digital Certificate contents
Certificate version number
Validity Details
Extensions to certificate
to
A standard typically includes a variety of information pertaining its
digital certificate
ateT nd lo the Certification Authority (a trusted
agency that can issue digital certificate)
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp) 7-3 Digital Certificate
In creating the certificate, this information is digitally signed by the issuing CA. The CA
signature on the certificate is like a tamper-detection seal on packaging any tampen
with the contents is easily detected.
Scanned by CamScanner
& Sys. Security
Coypt. (MU-Sem. 6-Comp)
iicale 7-4 Digital Certificate
By inspecting the digital certificate on a
web site, users
can help prevent identity theft and
fraud.
ie.
lo721 What is PKI ? Explain the different PKi Architectures. (Ret. sec. 72)
0722 Explain Public key infrastructure X.509 with the help ofarchitectural block
diagram. (Rèf. sec: 72)
to a
ely. 0.723 Does a public key infrastrücture use symmetric or
asymmetric encryption?
Explain your answer. (Ref. sec.
se
7.2)
CA'S Pabli:Key Infrastructure (PKI) is cryptographic technique used to secure electronic
ering Dlornation with the help of certain techniques such as digital certificates and digital
SIgnature and transmission of this infomation securely over internet.
PKl consists
of certain security policies, software's and techniques that are required for
Eey generation, key management, secure storage of generated keys and distribution
s for FEnerated
keys.
y, as A
public key and
infrastructure a number of services
toshnologies.,
is created by combining
the
To complete this technology, there are various components
of PKI are
t Tequired.
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem.6-Comp) 7-5 Digital Certificate
Q.72.1 List the certifying authorities inindía and worldwide Also list the steps to acquire
the digital certificate. (Ref. sec. 7.2.1(A)
As mentioned in previous section Certification Authority (CA) is a trusted
unit that helps
to issue certificates.
A CA takes the certificate request from owner, verifies the
requested information
according to the terms and conditions of the CA, and yses its private key to
apply digital
signature to the certificate.
Responsibility of the CA is to identify the correct identity of the person
who asks for a
certificate to be issued, and make sure that the information contained within the certificate
is legal and later digitally sign on certificate.
The CA may generate a public key and a private key (a key pair) or the person applyng
for a certificate may have to generate their own key pair and send a signed request
containing their public key to the CA for validation.
After the verification from CA it sends certificate for final verification to registration
authority (RA).
Scanned by CamScanner
& Sys. Security (MU-Sem.
Cpt.
ificate 6-Comp)
7-6 Digital Certificate
121(C) PKI
Cllents
Scanned by CamScanner
Crypt. & Sys. Security(MU-Sem. 6-Comp) 7-7 Digital Certificate
2
The role certifiçate distribution system is to perform following tasks:
Generate public and private key pairs. Certify the validity by signing with public key.
o Revocation of expired or lost keys.
Distribute or publish the certificate along with the public keys in the directory service
server.
Secure e-mail and messaging use key pairs for encryption of messages and files, and for
digital signatures. The most common secure c-mail / messaging protocol is Secure
Multipurpose Internet Mail Extensions (S/MIME), which extends the Multipúrpose Intemet
Mail Extensions (MIME) standard.
Web Access
Browsers and We observers use encryption for authentication and confidentiality and for
applictions like online bank in and online shopping. Typically, using Secure Sockets Layer
(SSL), servers authenticate themselves to clients. SSL also encrypts traffic.
Chapter Ends..
Scanned by CamScanner
tificate
CHAPTER
key.
Module3
service 8 Authentication
Protocols
ransfer,
saction
Syllabus
User
Authentication
and Entity Authentication,
One-way and mutual
Needham Schroeder Authentication authentication
and for schemes,
protocol, Kerberos Authentication
Secure protocol.
Internet
y
and for 81 User Authentication
ets Layer
is a process that allows a device to verify the identity of someone who
I'ser authentication
Scanned by CamScanner
Cypt. &
Sys. Security (MU-Sem. 6-Comp) 8-2 Authentication
Protocols
It is also important if you must identify your users betore you let them connect to
resources on the cxternal network.
pk
(sk, pk) 4 Gen
B1
at-Ps(B -)
ls it Chatie?
Scanned by CamScanner
(MU-Sem. 6-Comp) Authentkcation Protocols
Security
Copt. & Sys. 8-3
Thecommunication betwcen
the prover and verificr must be authentic.
must generate (p,, s,) Gen and convinces others
establish electronic identity, Charlie
To
public information p, represents him as show in Fig. 8.2.1.
that the
i or her opponent
authentication protocol must convince the verificr that his
cnntity
The
possesses the secret S:
authentication protocol is ifunctional if an honcst verificr Vk
entity
An
Always
accepts an honest provider P-
Physical and Legal
ldentities
821 network with
set up a
authentication is possible only if all participants have
Entity
communication links.
authenticated
1.1.11.3 1.1.11.5
1.1.10.2
1.1,10.3
1.1.10.1
Identities
Fig. 8,2.2: Physical and legal
to establish a convincing
bound between
- A role of a entity
authentication protocol is
identities.
tysical network address and legal
locations and move from one physical node to
Agne legalidentity can be in måny
physical
zncber node.
B3 Authentication Protocol
Authentlcatlon Protocol
2. Mutual Authentication
Scanned by CamScanner
K Crypt. & Sys. Security (MU-Sem. 6-Comp)
8-4 Authentication Protocols
Both communicating users (sender and receiver) are verifying each other i.e. mu an
authenticatio
Communicati
authentication mechanisns helps to verify identity of the sender.
Scanned by CamScanner
Authentication
(hMU-Sem. 6-Comp)
Protocols & Sys. Security 8-5
Authentication Protocols
the session key from Key Distribution Center for communicating with B.
now. for If group of
people
wants to securely communicate with Key Distribution Center
Drd. It then providing every
then looks up group member
a
single key called
a
master key or secret
key. Authentication servers are
This is
known as a capable to delivers good quality session keys and distribute
securely to client who
requested it.
ation. Withdrawing bentication server also maintains a table containing a name and a master
. key or secret
For authentication key of each client.
we know) or use of
The cecret key isused to authenticate client to the authentication server and
then for
securely transmission
of data between client and the authentication server.
There are different protocols are used to perform this task but among this the well known
a protocol called as Needham-Schroeder Protocol.
Authentication is
nder must prove its
any Syllabus Topic : Needham Schroeder Authentication Protocol
sender, before
8.3.2 Needham - Schroeder Protocol
must
networks they
e tist mutual
Ppioachwas
protocol was published in 1978 by Needham and Schroeder. This
receiver proposed for various purposes that includes secret-key and
ntended to 3enration and distribution
public key
message of those keys between sender and receiver.
edthat the Necdham
and Schroeder protocol uses a an
authentication
secret key known to the sender and also to
mutul server.
Sender and receiver share
other i.e. communication
a secret key and use it for secure
with authentication server.
Scanned by CamScanner
Cypt. & Ss
Authentication
Protocols
Now
6-Comp) 8-6
& Sys.
Security
(MU-Sem.
Slep 6: sess
4Cypt. Needham-Schroeder Secret-key Protocol
main
Detall steps of server for communication
rcquests for session key to authentication
a The
authenticatie
Sender
A
(contains the same shared secret key Kab, as well as the name of the sender
A
After receiving replay from authentication server, sender decrypt the ticket
and
Step 3:
sends the ticket {A, Kab) to the receivet B. A sends the ticket to B which is not u
encrypted format because it was previously encrypted by authentication sen
using B's secret key Kb.
(A, Kab) Kb
Step 4: B decrypts the ticket received from A using the secret key Kb and compar
sender identity. B is again encrypting the ticket using shared secret kèy Kab and
8.4
generates nonce N1 and sends it back to receiver. This can be represented as Kerber
E (N1) Kab
In this step B got the session key (Kab) for communicating securely with A. .8.4.1
Q.B42 Exp
Step 5: Sender is decrypting the nonce N1; using the shared secret key Kab this proveu
Exp
senders identity. The sender sends response N1+1 encrypted using ne (Re
secret key Kab. Keberos
Scanned by CamScanner
Security(MU-Sem. 6-Comp)
entication SYs. 8-7
cpt. & Authentication Protocols
Protore
Ocols scnder
A
and receiver B
can
Now securcly communicate with cach other using
or session key gencratcd.
communication
to authenticaion weakness of this protocol is that for large networks it is not
The
main possible for single
s network suthentication server to gencrate and distributc number of session key which is
practically
address
o demonstrate possible.
not
hentication the weakness is that if session key bctwcen sender A and recciver B
server Another is stolen, and the
attacker can casily copy
B is recorded, the contents of a
ticketto
sender by performing A
steps.
Jast 3
enerated 3. Authentlcatlon request
key Kh
nonce
N (to match
quest
sent), ticket
of the sender 1. Request
A)
pted with sender
it. Themessage
Sender A
2. Replay Receiver B
Authentication server
wpt
the ticket and 4. Authentication response
B which is not in
5. Sender responds to receiver
mentication server
Scanned by CamScanner
8-8 Authentication
Crypt. & Sys. Security (MU-Sem. 6-Comp) Protocols
protocol.
as a token that proves thc identity of a user.
Kerberos uses the concept of a tickct
tickets
.
Tickets are digital documents that store session keys. Instead of password,
any Kerberos services.
issued during login session and then can be used in
:
For client authentication phase requires two tickets
Ticket Granting Ticket (TGT), which act a identifier for user and session key
A service ticket to authenticate user to gain access to user for particular service.
Th same. concept of ticket is used likewise we use railway tickets it has time duration
expiration dates after that ticket become invalid.
In Kerberos these ticket includes different contents like time stamps to indicate an, stat
and expiration time, after time expiration the ticket become invalid.
The timestamp is the timeset by Kerberos administrator depending upo how much time
service is required to the client.
1. Kerberos Servers
To accomplish the task of secure authentication, Kerberos uses a trusted third partyi
called a Key Distribution Center (KDC).
The role of an Authentication server is to store a.database like secret key of the Use
and its services.
The secret key of a user is generated using one-way hash of user provide passworo
netwo
The-main aim of the Kerberos is provide centralize authentication of entire 3,
-than storing the sensitive information at each user. machine, the
Ses
rather
information will be maintained at particular secure location only.
Scanned by CamScanner
Security (MU-Som. 6-Comp) 8-9 Authentication Protocols
Authentication
Kerberos
Authenfication
server
Cleartext servico request
Client
Clent-TGs session key
Ticket-Granting ticket
Ticket-Granting
|Ticket-Granting ticket Server
Authenticator 1
Client
Clear-to-server ticket
Service
Clear-to-server ticket
Client
2
Authenticator
Authenticator 2 response
This phase is called as Authentication phase because during this phase only
authentication can be done bétween authentication server, ticket-granting server and
srice provider.
As shown in Fig. 84.1, first client and authentication server authenticate themselves
to each other.
Chent and Ticket granting server authenticate themselves. Finally client and
Tequestedservice provider authenticate themselves to each other regarding which
nformation/ service
. Authentlcatlon
client wants.
Details
Daing authentication
phase user username and password on the client
Tmachine
which
has to provide
cryptographically hashed to create a secret key for the client.
Scanned by CamScanner
Cypt. & Sys. Security (MU-Sem. 6-Comp) 8-10 Authentication
Protocols
After client verification done with authentication server, AS will replies the following
details to client as shown in 8.4.1.
The client Ticket Granting Sever (TGS) session key Kt, cncrypted using che..
secrets key Ke (which now storcd in authentication server).
The Ticket Granting Ticket (TGT) encrypted using the secret key of the Tieh.
granting server. The ticket granting ticket includes the client ticket granting se
session key Kt and its validity period.
The client now decrypt the Ticket Granting Server session key Kt using his secret ke
Kc. To request as service client sends following two message to Ticket Grantin
Server (TGS).
The Ticket Granting Ticket and the name of the service Sr that client wants t
request.
Authentication token which includes client ID and time stamp, encrypted using
messages.
The client server ticket sent by the ticket granting server in previous step.
The client ID and the time stamp encrypted suing client server session key hs.
The service provider decrypts the client to server ticket using secret key NS
server sessiot
obtains the client server session key Ksc. With the help of client
stamp information. To proveu
Ksc, service provider decrypt the client ID and time o back #
it
stamp by l and send
final identity service providers increment the time
client.
Scanned by CamScanner
& Sys. Security ((MU-Sem. 6-Comp)
8-11
Authentication Protocols
The client decrypts and verifies this
responsc using
Once this verification get succccd, client to server
now client - session key Ksc.
server can
Kerberos protocol was specially start.
design to check
the authentication of
insccure network. the client over
Two types Kerberos versions are exits
i.e. Kerberos 4
and 5.
DIference between Kerberos Verslon 4 and Verslon 5
Kerberos version 4
Kerberos version 5
Na.
Kerberos v4 was released prior to
the The version 5 was
1.
version 5 in the late 1980's. published 1993, years
after the appearance versionin
of 5.
Ticket support is Satisfactory in this Ticket support is well
2.
version
extended. Facilitates
forwarding, renewing
and postdating
tickets.
nses the "receiver-makes-right"
| It uses the. ASN.1 coding system.
encoding system.
Since the same key is used repeatedly In V5 this is avoided by requiring a sub
to gain a service from particular
session key which is used only for one
server, there is a risk that an attacker connection.
replay messages from an old
.
can
session to the client or server.
6. Kerberos uses IP addressing Kerberos V5 can use any address since the
address is now: tagged with type and
length.
1.
|In V4the ticket lifetime has to be In V5 ticket lifetime one can specify an
specified in units of 5 minutes. explicit start and finish times allowing
arbitrary lifetimes.
can contain now
O
only a few IP addresses Kerberos V5 tickets
contains
and other addresses for types multiple IP addresses and addresses for
of
protocols.
network protocols. different types of networking
Chapter Ends...
Scanned by CamScanner
value
Hash on
signature
signa
Digital te
Module 4 9 algorithms
CHAPTER First
1. corresp
Digital Signature Schemes Next s
2. genera
Third
3.
messa
Syllabus
-
Digital Signature Schemes RSA, EIGamal and Schnorr signature schemes.
Digital, signatures are essential in today's modern world to verify the sender of a
document's and his identity. As ment
A digital signature is represented in a computer as a string, of binary digits and computer is key, wh
using a set of rules and regulations (algorithm) to identify the person signing the document
as well as the originality of the data can be verified.
Public k
Every
A digital signature is defined the signature generated electronically from the digital
signatu
computer to ensure the identity of the sender and contents of the message cannot be
modified during transmission process. 9.2 Dig
Digital sighature techniques achieve the authenticity, integrity and non-repudiation of the
data over Internet.
to
Concept of digital signature is that sender of å message uses a signing key (Private Key)
sign the message and send that message and its digital signature to a receiver ove
insecure communication channel.
The receiver uses a verification key (Public Key) of the sender only to verify the origna
the message and make sure that it has not been tampered with while in transit as shoWu
Fig. 9.1.1.
Scanned by CamScanner
CrYpt. &
Sys. Security (MU-Som.
6-Comp)
9-2
Digital Signature Schernes
Hash value of a
meSsage when
encrypted with
Signature on that e-Document. the private key of a person is, his digital
pigital signature is an cxample of
asymmetric
algorithms to complcte the proccss. key cryptography
which uses three different
1. First step is key generation
algorithm which
corresponding public key. generates private key and a
Sonder
Rocoivor
Confidontial
dooument Sgnatura Insecurg
or massage Soommunication
chahnel Vatication
Sender ptvate.
H koy (signing key) Sender publio
key (vertfication key)
1. Message authentication
2. Message integrity
3. Non-repudiation
Fig. 9.2.1 : Digital Signature Goals
Scanned by CamScanner
Crypt. &
Sys. Socurity(MU-Som. 6-Comp) Digital Signaluro
9-3 Schorns
1. Message authenticatlon
A digital signature technique can provide message authentication. Digital signature is used
to establish proof of identities and cnsure that the origin of an clectronic message :.
correctly identificd.
2. Message integrity
Digital signatures are used to detect unauthorizcd modifications to data which assures tho
the contents of massage are not changed after sender sends but before it reaches t
intended receiver.
3. Non-repudiation
There are situation where a user sends a message and later on refuses that he had sent that
message. This is known as non-repudiation because the person who signed the documezt
cannot repudiate the signature at a later time as shown in Table 9.2.1.
Authentication copied.
in
handwriting expert to achieve achieve non-repudiation
non-repudiation. Digital Signature.
areas
Now-a-day's digital signature techniques is used in many application
like sends
connpa
all software
confidential e-mails, during secure payment transfer and possibly or
to achieve authentication and integrity D
universities, educational institutions those want
confidential information.
Scanned by CamScanner
ure
Schemes Copl. & Sys. Security (MU-Sem. 6-Comp)
9-4 Digital Signature Schemes
Syllabus Topic : Dlgltal
SIgnature Schemes
ture
is used olrital Signature Algorithms/ Schemos
message
is
> (MU - May 16, Dec. 16)
9.3.1 Explain any digital signature algorithm
la.
(Ref. sec. 9.3) In detail.
e
May 16, Dec. 16, 6/3 Marks
Ssures Following are the widely uscd digital signature
that schemes to generate the digital signatures.
eaches to Dlgital Slgnature Algorlthms/
Schemes
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Digital Signature
9-5 Schemes
8. Signature Verification
Use signer's Public Key (e,n) and Compute Vm
n
Vm S
m°modn
mod
Both sender and receiver know the value of n. In addition, the sender nust knre.
encryption key 'e' and receiver must know decryption key 'd'.
System parameters
Let H be the hash function.
Let a be the prime number.
Let g<abe a randomly chosen generator.
Key generation
Scanned by CamScanner
& Sys..Security(MU-Sem. 6-Comp) 9-6 Digital Signature Schemes
4Cypt.
documents.
Aese steps arc performed by signer of
generation
Signature
r message m, signer needssto perform following steps.
Tosigna
i:a-1)=l; l<i<a-1
g g'mod(a)
Compute
$- (H(m)
- xgr ) k"mod (a – 1)
step.
Ifs=0 then repeat above
is called as Digital
- The pair (qr, s) signature of message m.
The signer has to repeat all
these steps during every signature generation.
Verification
o
Digital signature (gr, S) of message m was verified as follows.
0<q,<a and
0
<s<a-1
gm) = yq mod a.
Where,
H(m) =
a
xq,+ Si mod -1
According to format s little theorem
is
qr S
(s)x(e)
We know that y = q mod a
Above equation can be rewrite as follows,
H(m) mod a
8= (y) x(gr)
Hence proved.
Here, H(m) = SHA-1(m) is 160- bít string output produced by secure Hash Algorithm.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
9-7 Digital Signature Schemes
Schnorr digital signature scheme is mainly based on discrete logarithm. Using this sche
we generate a digital signature.
It minimizes the message-dependent amount of calculation required
for gencratino
digital signature.
The main aim of signature generation is it does not depend on the actual message.
This is done, when the processor is in the idle mode.
At the time of signature generation message dependent part
requires multiplying a 2n-hi
integer with n-bit integer.
This method is mainly based on prime modulus m with m - 1having a prime factor n of
appropriate size som-1= (mod n)
We use n = 20
m=2and
P is a 1024 bit number and n is 160 bit number.
In the first part.this approach is the
generation of public/private key.
For this purpose we use following steps:
1. Choose two prime m and n such a way that n is a
prime factor of m -1.
2. cho0se one integer called as a such that o<"
=1 mod m. The value a, m and n comprise
a global public key. That key is common to group users.
of
3. After the 2d step choose any random integer
called as 'P that may consist of
we
0<P<n. this is called users private key.
4
After all of above we generate public key by calculatingU=
nothing but user's public key.
a mod m this value s
Scanned by CamScanner
Digital Signature
Schemes
y = + Pe)
Calculate (A mod n.
The signature contains
4
the pair (e, y)
can findthe signature using following way
Any other user :
Calculate x
=a'u'mod m
1.
=
Check that e H
(MIIx)
Then see that the verification work is same as
like:
Kaau'a' aaa a=x(mod m)
hence,
HMIIx) = H (Mlx)
Chapter Ends..
Scanned by CamScanner
Rortes
Module5
CHAPTER
Infe
Network Security Basics S0L
SOL
10.
layer
Fiitere
not ste
ARP It is c
Syllabus
vulnerabilitios (Layor wiso), Packot Sniffing, time
: TCP/IP
Network security basics syn flood, DNS Spoofing.
port scanning, IP spoofing, TCP Take
spoofing,
blend
forur
(Layer wise) Whe
Syllabus Toplc TCP/P Vulnerabltles
:
detai
If ve
10.1 TCPAP Vulnerabilities (Layer Wise)
logir
as to
10.1.1 Applicatlon Layer
is gr
largely by programs for network
Description :The application layer is used
program in an application-specific format, and Thr
communication. Data is passed from the
the
later encapsulated into a transport layer protocol.
transport layers, the application Thi:
Since the IP stack has no layers among the application and
presentation and session layer sent
layer must contain any protocols that act like the OSI's
me
protocols. This is typically done through libraries.
is encapsulated into The
Data sent over the network is send into the application layer where it
AS
down into the lower layer
the application layer protocol. From there, the data is send
atta
protocol of the transport layer.
tab
are TCP and UDP. Common servers hav
The twO most common end-to-end protocols
while cliens A
particular ports assigned to them (HTTP has port 80; Telnet has port 23; etc.)
may set u
use ephemeral ports. Some protocols, such as File Transfer Protocol and Telnet A
a session via a well-known port, but then forward the actual user session
to ephemerd
Ce
de
ports.
Scanned by CamScanner
&
Sys. SecuTY (MU-Sem. 6-Comp)
10-2
Network Security
Basics
Routers and Switches do not make use of
this layer but bandwidth
Resource Reservation Protocol (RSVP). throttling applications
do, as with the
An example of
an attack
injection
sQL
igjection is a
technique that exploits a security
SQL weakness happening
an application. The weakness in the database
layer of is prescnt when user input is cither
escape characters embcdded incorrectly
filtered for string literal in SQL statements or user
not strongly typed land thereby unexpectedly cxecuted.
input is
f alid. the user is given access. In other words, the web application that controls the
Iosin bage will communicate with the database through a series of planned commands so
as to verify the usemame and password combination. On verification, the user legitimate
is granted suitable access.
- Through SQL Injection, the hacker may input exclusively crafted SQL commands with
the target of bypassing the login form barrier and seeing what lies behind it.
This is only doable if the inputs are not properly sanitised (i.e., made invulnerable) and
sent direcidy with the SQL query to the database. SQL. Injection vulnerabilities provide the
means for a hacker to communicate directly to the database.
Thetechnologies vulnerable to this attack are dynamic script languages including ASP,
ASP.NET, PHP, JSP, and CGI. All an attacker needs to perform an SQL Injection hacking
atsck is a web browser, knowledge of SQL queries and creative guess work to important
table and field names. The utter simplicity of SQL Injection has fuelled its popularity.
A way to defense
A Detwork-based intrusion detection (DS) tool such as Snort can be set up to detect
certain types of SQL injection and XSS attacks as they take place. Snort actually has a
Cerault rule set that contains signatures for detecting these intrusions.
Scanned by CamScanner
Crypt. & Sys. Security
(MU-Som. 6-Comp) 10-3 Notwork
Socurity Bati
However, they can be casily bypassed
by an attacker, mainly by converting
input string into its hex-cncoded the malie.
value.
10.1.2 Transport Layer
Description
:The transport layer's responsibilities contain end-to-end message
capabilities independent the core
of
flow control. End to end message
network, along with error control,
transte
ragmentation
transmission or connecting applications at
.
layer can be categorized as he transpA
cither :
1
connection-oriented e.g.
TCP
2. connectionless e.g. UDP
The transport layer can be thought
of accurately as a transport
whose responsibility is to mechanism C.g. a vehi
make sure that its contents
destination safely and completely, (passengers/goods) reach :
delivery.
unless a higher or lower
layer is responsible for .
The transport layer provides
this service of connecting
the use of ports. Since IP provides applications collectively
only a top effort delivery, thro
layer of the TCP/IP stack to the transport layer is thef
offer dependability. Note can
data link protocol such as that IP run over a dependa,
the High-Level Data Link
transport, such as RPC, Control (HDLC). Protocols ara
also can present reliability.
An example of an attack
A way to defense
Scanned by CamScanner
Security (MU-Sem. 6-Comp) 10-4 Network Security Basics
Sys.
Copt&
all scans will be followed by an actual attack, as the hacker may determine
HOwever, not no weaknesses that they can take advantage of. This could
network currently has
that the number of alerts that do not require attention.
large
Jeadtoi cffect of this that the staff may lose faith in the IDS and
is
10.1.3
Network Layer
of receiving packets across a single
Description : Network layer solves the problem
are X.25, and the ARPANET's HostIMP Protocol.
network. Examples such protocols
of
was
added to
the adyent of the concept of internetworking, additional functionality
nd source network to the destination network. This
namely receiving data from the
this layer,
across a network of networks, known as an
neIually involves routing the packet
internet.
internetwork or (lower-case)
from
performs the basic task of receiving packets of data
In the Internet protocol suite, IP
a number of different upper layer protocols;
source to destination. IP can carry data for are
a unique protocol number: ICMP and IGMP
these protocols are each recognized
by
protocols 1
and 2, respectively.
such as ICMP (used to send out diagnostic
Some of the protocols carried by IP,
data) are
transmission) and IGMP (used to, handle IP Multicast
information about IP an
perform internetwork layer functions, illustrating
layered on top of IP but
stack and OSI model.
Incompatibility between the Internet and the IP
What
as OSPF, and RIP are also part of the network layer.
routing protocols, such their payload is totally alarmed with
the network layer is that
nakes them part of
particular encapsulation of that payload is
ainagement of the network layer. The
imelevant for layering purposes.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
Network Security
10-5 Basits
An example of an attack
Initiator Listener
Connect() Listen()
SYN
TCB transitions to
Established state
(Data packets exchanged)
Scanned by CamScanner
.
Sys. Security (MU-Sem. 6-Comp)
Cypt. & 10-6
Network Security
Basics
situation leads to a
clear potential DoS
This attack where incoming
allocation of so many TCBs that a host's
kerncl memory is
SYNS basis
the
cxhausted.
to avojd this
memory
exhaustion, operating
In order systems gencrally
"backlog" parameter with
a listening socket associate a
that scts a cap on
the number of TCBs
concurrentlyin the SYN-RECEIVED state.
ouse TCP
attempts to be dependable, the target host
keeps its TCBs stuck in SYN
prCEIVED for a relatively long time before
giving up on the half connection and reaping
them.
In the
meantime, service is denied to the application process on the listener for rightful
new TCP connection
initiation requests. Fig. 10.1.1 shows a simplification of the sequence
of events involved in a TCP SYN flooding attack.
A way to defense
- Both end-host and network-based solutions to the SYN flooding attack have merits. Both
types of defense are frequently employed, and they usually do not interfere when used in
combination.
Because SYN flooding targets end hosts rather than attempting to tire out the network
capacity, it seems logical that all end hosts should implement defenses, and that network
bascd techniques are an elective second line of defense that a site can employ.
OIN-RECEIVED timer), these techniques should efinitely not be relied upon, Based on
Scanned by CamScanner
cypt. &S
Crypt. & Sys. Security (MU-Sem. 6-Comp) 10-7 Network Security
Basics
experimentation and analysis, SYN caches seem like the best end-host mechaniem
hand. Access
Media
This choice is motivated by the facts that they are capable of withstanding profo, MAC Spo
attacks, they are free from the negative effects of SYN cookies, and they do not necd a attempt te
heuristics for threshold setting as in a lot of hybrid approaches. networka
Among network-based solutions, there does not seem to be any tough argument fo sendi
SYN-ACK spoofing firewall/proxies. By
attacker a
Because these spoofing proxies rip the TCP conncction, they may disable som tc
the host
high-performance or other TCP options, and there seems to be little advantage to thi.
Until the
approach over ACK-spoofing firewall/proxies.
CAM tab
Active monitors should be used when a firewall/proxy solution is administrative,y
impossible or too costly to deploy. A
way to
Ingress and egress filtering is frequently done today (but not ubiquitous), and is1 The best
Commonly acknowledged practice as part of being a good neighbor on the Internet. automatic
attaching
Because filtering does not cope with distributed networks of drones that use straijht
attacks, it needs to be supplemented with other mechanisms, and must not be relied upcn Detection
by an end host. Occurrenc
known Ot
10.1.4 Data Link Layer
Once det
Description : The link layer, which is the method used to move packets from the netwt
connectin
layer on two different hosts, is not actually part of the Internet protocol suite, becaus:?
10.1.5 Phys
can run over a range of different link layers.
The processes of transmitting packets on a certain link layer and receiving packets
fron!
Deseriptie
network cad
given link layer can be controlled both in the software device driver for the networkce
as well as on firmware or expert chipsets. These will perform data link functions
suchs
Scanned by CamScanner
(MU-Som. 6-Comp) 10-8 Notwork Sacurity Basics
ottack
of an
Control
(MAC))Addressspoofing :
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 10-9
Network Security
Basics
An example of an attack
When any data has to be transmitted over the computer network, it is broken down i
smaller units at the sender's node called data packets and reassembled at receiver's no
in original format. It is the smallest unit of communication over a computer network.
Ir:
also called a block, a segment, a datagram or a cell.
The act of capturing data packet across the computer network
is called packet sniffing.l
similar to as wire tapping to a telephone network. is mostly
hackers to collect information illegally about network.
It used by crackers a
Syllabus Topic: ARP Spoofing
Scanned by CamScanner
Network Security
Basics
Beyondthis,
ARP spoofing attacks are often used to facilitate
other attackssuch as :
ponlal-of-service attacks
Pot. Scanning
104
1
Vanilla: The scanner attempts tö connect to all 65,535 ports.
Port scanning in and of itself is not a crime. There is no way to. stop someone from port
ng your computer
while you are on the Internet because accessing an Internet server
"ens a port, which opens a door to your computer. There are, however, software products that
stop a port scanner
from doing any damage to your system.
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp) 10-11 Network Security
Basics
Ir poofing
(MU - Dec. 15)
Q. 10.5.1 Wite in brief about: 1P spoofing. (Ref. sec. 10.5) Dec. 15, 5 Marks
spoofing.
The attacker first sends SYN packets with the spoofed (faked) IP address to the victim in
order to establish a connection.
The victim creates a record in a data structure and responds with SYNIACK message to
the spoofed IP address, but it never receives the final acknowledgment message for ACK
establishing the connection, since the spoofed IP addresses are
unreachable or unable to
TCP SYN flood (a.k.a. SYN flood) is a type of Distributed Denial of Service (DDo!
attack that exploits part of the normal TCP three-way
handshake to consume resources n
the targeted server and render it unresponsive.
Scanned by CamScanner
coypt. & Sys. Security(MU-Sem,
.6--Comp)
10-12
Notwork Security Basics
e server, unaware
of the attack, receives multiple, apparently
legitimate requests to
etahlish communication: It responds to
each attempt with a SYN-ACK packet
from each
open port.
The malicious client either does not send the expected ACK, or if the IP
address is
sDoofed never receives the SYN-ACK in the first place.
Fither way, the server under attack will wait for acknowledgement
of its SYN-ACK
packet for some time.
10.7 DNS.Spoofing
Domain Name Server (DNS) spoofing (a.k.a. DNS cache poisoning) is an attack in which
altered' DNS records are üsed to"redirect online traffic to a fraudulent website that
resembles its intended destination.
Once there, users are prompted to login into (what they believe to be) their account, giving
types of sensitive
Lne perpetrator
the opportunity to steal their access credentials and other
information.
Scanned by CamScanner
Grypt. & Sys. Security (MU-Sem. 6-Comp)
10-13 Network Security Basics
Chapter Ends...
Scanned by CamScanner
CHAPTER
Module 5
11 Denial of Service
Syllabus
Denial of Service: Classic DOS attacks,
Source Address
Distributed Denial spoofing, ICMP flood, SYN
flood, UDP flood, of Service, Defenses against
Denial of Service
Attacks.
Denial of service and distributed denial of services is a type of attack that causes
legitimate users unable to use services or the resource, or services become unavailable to the
Jegitimate users.
Scanned by CamScanner
2 Crypt. &
Sys. Security (MU-Sem. 6-Comp) 11-2 Denial of
Servica
attacker's main target for websites or services which include financial site bank site or
Unt
The (49
creditcard gateway systems.
The targeted network which are root for DOS are mobile phone network or
So
credit card 11.1.1(B
gateway network.
What an
Buffer overflow technique is used to make denial service attack.
attackers does
is
a
it takes packet (where is unit of data) divide into small chunks, the attacker chel
the IP addres of the particular network in that packet and floods the network of Q.11.1
with repeated request. As IP is a fake, from attacker's machine.
This acts consumes bandwidth which let other service to fail or
unavailable forother
user.
(1) Floo
A DOS attack does following actions Attac
1. Flood whole network with unnecessary traffic. packe
v
2 Damage connection between two systems so that communication cannot Occur. It is
3. Disrupt services to legitimate users. (2) Ping
4. Prevents individuals to access network services.
Sendi:
11.1.1(A) Classiflcation of Attacks indica
Scanned by CamScanner
Sys..Security (MU-Sem. 6-Comp) Denial of Service
Cypl.& 11-3
Sometimes hecause of huge popularity among users the particular wets suddenly end up.
attack
4)Flood
on flooding or overloading victim's system
Attacker keeps
with
'n' numbers of ping
packets which result into huge traffic which the victim itself cannot handle.
but difficult handle.
very simple to launch
It is
attack
(2) Ping of Death
Sending huge
ICMP packet (These packets are used in IP layer or network layer for
indicating.error message). The attacker sends this huge oversize
packet to the victim's
or freeze resulting in DOs.
system which causes victim's system to crash
Scanned by CamScanner
SYN
SYN-ACK
ACK
way handshake
Fig, 11.1.1:3
SYN
SYN-ACK
SYN
Legitimate connection
s refused
Scanned by CamScanner
(M-Sem. 6-Comp) Denial of Service
Sys. Security 11-5
Copt &
with cach other
l Teardrop attack: It is an attack whenpackets are overlappecd
are
receiver is not able to reassemble them, usualy corrupted packets
and the
attacker to hang or freeze the system.
send by
which slow
an attack of sending invalid ICMP packet to the target
Nuke : It is
5.
computer till it is completely stop.
downthe affected
Smurf
A
Spoofing
11.2 Source Address
using IP
establishes a large number of "half-open" connections
In this attack, attacker
spoofing.
Scanned by CamScanner
S
& Sys.
Sys. Security(MU-Sem.
6-Comp) 11-6
Denial
of Servic
1Cpt.
are a nu
Crypt. &
2 There comma
Syllabus Toplc ICMP Flood
:
The-ncomma
11.3 ICMP Flood The -I
comma
O. 11.3.1 Explain ICMP flood
attack. (Ref, seo.11.3) The-t
a
Ping flood, also known
as ICMP flood, is a common Denial of Service (DoS) Note that in
access to extra
attack
which an attacker
takes down a victim's computer by overpowering it with ICMP in
et, particularly ag
requests, also known as pings.
victim's network with request packets, knowing
Theattack involves flooding the thatte
reply packets,
network will react with an equal number of
a
tatget with ICMP requests include the Floc
Additional methods for bringing down
as scapy. uecf 114 SYN
convention tools or code, such hping and
Write
This strains both the incoming and outgoing channels of the network, consuring a.11.4.1
considerable bandwidth and resulting in a denial of service.
It is a TCP S
Attack Description network connee
acknowledgem
Normally, ping requests are used to test the connectivity of two computers by meaens
An attacker in
the round-trip time from when an ICMP echo request is sent to when an ICMP eche
reply sends an a
is established. During an attack, howevér, they are used to overload a target networt
w
attacker needs to have physical access to the computer in order to discover out i
address. A successful attack would result in the target computer being taken down.
communications bëtv
A router disclosed ping flood targets routers In order to interrupt
Computers on a network. It is dependent on the attacker knowing the internal P
a0are
to uio
a local router. A successful attack would result in all computers connected
Scanned by CamScanner
Security (MU-Sem. 6-Comp)
11-7
Denial of Service
are a number of ping commands
There that can be used
command which is used to aid an attack, including
-n to specify :
The the number of times a request
command, which is uscd to is sent.
The--l specifytheamount of
data sent with
conmmand, which is used each packet.
The -t
to continue pinging until
order for a ping
the host times out.
Note that in
flood to be sustaincd, the attacking
extra bandwidth than the victim. This computer must have
acceSsto limits the ability to carry
a out a DoS attack,
prticularly against large network.
An attacker initiates
a
TCP connection with server with a
SYN message. The server in
replysends
an acknowledgement message. (SYN - ACK) message.
causes server to
The client (attacker) does not respond back with acknowledgement which
wait.
up the buffer space for
Dne to whichit is unable to connect with other client. This fills
SYN message preventing other for communicate.
SYN
SYN-ACK
ACK
way handshake
Fig. 11.4.1:3
Scanned by CamScanner
&S
Copt
Crypt. & Sys. Security (MU-Sem. 6-Comp) 11-8 Denial of 4
2 Servios
However
1. Clients sends synchronize (SYN) packet to server. randon
Servers send syn-ack (SYN- ACK) to clicnt. to
2
resu
3 back
Clients responds with ACK packet and connect is established As a
11.4.1. client Verif
shown in Fig. a, 1.
SYN Seetl
2.
Repls
3.
Thus, for
sending m
SYN-ACK
The attack
unnecessar
location(s)
Connection are all full
Most opera
SYN responseS
Legitimate connection
is refused
11.6 Distrit
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
CYpt& 11-9
Denial of Service
UDp flood attack can
However, a be initiated
by sending a huge number of UDP packets
random ports on remote
a
host.
to :
resul, the distant host will
Asa
Verify. for the application listening at that port;
1
no application is listening at
that port;
Sce that
2
with an ICMP Destination Unreachable packet.
Reply
3
for alarge number of UDP packets, the ill-treated system will be forced into
Thus,
many ICMP packets, eventually leading it to be unreachable by other clients.
sending
attaacker(s) may also spoof the IP
address of the UDP packets, ensuring that the
The
unnecessary ICMP return packets do not reach them, and anonymizing their network
location(s).
ease this part
operating systems
of the attack- by limiting the rate at which ICMP
Most
sent.
responseS are
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 11-10 Denial
of Senvca
Scanned by CamScanner
Denial Security (MU-Sem., 6-Comp)
of Serve 11-11 Denial of Service
is the real attacker,
Finally, there the mastermind behind
control
program, the real attacker can the attack. By using
a
Daemòn Daemon
attacker Daemon
to
Bxamples Daemon
of
Victim Real attacker
-
traffic.
Fig. 11.6.1: Chaotic handshake
preventing
Although it seems that the real attacker has little to do but sends out the "execute"
onminand, he/she actually has to plan the execution of a successful distributed denial
of service attack.
The attacker must infiltrate all the host computers and networks where the daemon
se attacks -attackers are to be deployed.
d of four and
The attacker must study the target's network topology and search for bottlenecks
host that vulnerabilities that can be exploited during the attack.
presence master prograns, the real attacker is
Because of the use of attack daemon's and control
not directly involved during the attack, which makes it
difficult to trace who spawned
t victim. the attack.
Scanned by CamScanner
nenial
2 Crypt. & Sys. Security (MU-Sem. 6-Comp) 11-12
i Sevvea
(the victim). The victim is the target of large amount of traffic that the amplifiers
a
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
Copt & 11-13 Denial of Service
Shaft is modeled after Trinoo. Communication between the control master program
and attack daemons is achieved using UDP packets. The control master program and
the attacker communicate via a simple TCP telnet connection. A distinctive feature of
Shaft is the ability to switch control master servers and ports in real time, hence
making detection by intrusion detection tools difficult.
TFN2K uses TCP, UDP, ICMP, or all three to communicate between the control
naster program and the attack daemons. Communication between
the real attacker
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem, 6-Comp) 11-14 Denial
of ServicA
ChapterEnd
Scanned by CamScanner
Denial
ofSevica
ks
CHAPTER Module 5
enses 12 Internet Security Protocols
ess, against a
there
e
network are
and
k protects
prevents the Syllabus
res instaling
the Intemet Security Protocols : SSL, IPSEC, Secure
Email: PGP, Firewalls, IDS and
types, Honey pots.
can no
longer
efend against
Svllabus Topic: Internet Security Protocols -
SSL, IPSEC
attacks, host
aniques. For
12.1 Secure Socket Layer (SSL)
hat the host
size of the > (MU - Dec. 15, Dec. 17)
dshake, and o 121.1 List
the functions of the diferent protocols of SSL Explain
the handshake
protocol. (Ref. secs. 12.1 and 12.1.1(A) Dec. 15,5 Marks
ot required, 121.2 What are the different protocols in SSL? How do the client and sever establish
an SSL connection? (Ref. sec. 12.1) Dec. 17, 5 Marks
ork services
apering and Secure Socket layer invented by Netscape communications in 1994. Secure Socket layer is
an internet protocol used for securely exchanging the information between client's web
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-2 Internet Security
Protocos
SSL SSL
iionSsL layer protoco
postion positlon ssL layor protoco
Transport layer Transport layer,
IP
Secunity Intemet layer IP Intemet layer
security
Physical layor
WPhysical layer
SSL encrypted data
Scanned by CamScanner
Sys. Security (MUJ-Sem. 6-Comp)
&
fCt 12-3
Internet Security Protocols
receiving encrypted
(fpon data, server removes
decrypted data to application the SSL hcader
sendsthe layer. and decrypts the data and
composed of four protocols
SL is
in two layers,
12.1.2. which support
Fig. SSL as shown in
four, the two most important
Out of the
protocols
Handshake
Protocol and the
SSL Record that are atthe
hcart of SSL arc
Protocol, the SSL
Cipher Specification the other two
Change and the SSL Alert protocols such as SSL
protocols,. Protocol
play a minor
previous twO role relatively
to
these higher-level protocols
The roleof is the connection
cipher techniques for data encryption establishment, use
of
and alert (warning, requirea
error
starting actual data transmission process if any) generation before
between client
and server.
sSL architecture
/ SSL internal protocol structure
Authentlcation,
Support for encryption, algorithms
and alert massagey
SSL session SSL hand
connectlon
SSL change
shake SSL Application
establishment dpher alert
protocol specfication protocol
protocol (HTTP, FTP)
SSL record protocol SSL protocol
layer
Message authentication,
confidentiality
and integrity
TCP
Transport and
IP layer internet
We will discuss SSL Handshake Protocol and the SSL Record Protocol in details.
Scanned by CamScanner
12-4 Internet Security Protocls
Crypt. & Sys. Security (MU-Sem. 6-Comp)
The first sub-protocol of SSL called handshake protocol used for Secure communication
between client and the server using an SSL enabled connections.
Clilent hello
The
Step
Server hello
()
Servar oetiflcate (i)
cllent certificate request
server key exchange Step 2
Client certificate
(iv)
Clent key exchange
certificate verification
change cipher specitication
client handshake finíshed
Step 3 ()
(i)
Scanned by CamScanner
Grypt. & Sys. Security (MU-Sem. 6-Comp)
12-5
Internet Security Protocols
1.
Iis used by client and server to start communication
using SSL enabled connection.
2. The bandshaking is done 4 phases:
Phasos of handshaking
G Client hello
) The highest SSL version number which the client can support.
(i) A 32-bit timestamp and a 28-byte randomn field that together serve as nonce during key
exchange to prevent re- play attacks.
(Gi) A session id that defines the session (a variable length session identifier).
(ov) There is a cipher suite parameter that contains the entire list of cryptographic algorithms
Server
client and server, will
) version number. the highest among both SSL number of
The SSL
be supported by client and other will be supported by server.
this
used for master secret generation, however
M)A 32 byte random number that will be
Tandom number is totally independent from the
random number of client.
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Som. 6-Comp) 12-6 Internet Security Protocole
(iv) A cipher suite contains the list of all cryptographic algorithms hat is sent by the cli.
from which the server will sclcct the algorithm.
(v) list of compression methods sent by the server
A
the client from which will sclect
the
method.
In this phase, the server authenticates itself if it is nccded. The server sends its certificate,
its public key, and also request certificate (digital certificate) from the client.
Certificate : The server sends a certificate message to authenticate itself to the che.
If the key exchange algorithm is Diffie Hellman than no need of authentication
Server key Exchange : This is optional. It is used only if the server doesn't sende ix
digital certificate to client.
Certificate Request : The server can request for the digital certificate of client T.
client's authentication is optional.
Server Hello done : The server message hello done is the last message in phase )
This indicates to the client that the client can now verify all
the certificates received
by the server. After this hello message done, the server waits
for the client's side
response in phase 3.
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
Cypt.& 12-7
Internet Security Protocols
: Finish
d) Phase 4
server send messages
The client and to finish the handshaking
The Grst two messages are protocol. It contains 4
steps. irom the client i.c. change cipher specs, finished.
responds back with change cipher spec The
server and finished.
Change cipher spec
: It is a client
side messagc
protocols telling about the current status of
cipher and parameters which has bcen made
active from pending state.
Finished: This message announces the finish of
the handshaking protocol from client
side.
Cipher spec ::This message is sent by server
Change to showthat it
the has made all
pending state cipher protocols and parameters to active state.
of
sSt, uses the Alert protocol for reporting eror that is detected by client or server, the
Tahle 12.1.1shows the types of alert messages. SSL alert protocol is the last protocol of
sSL used transmit alerts (warnings, errors, fatal etc.) if any via SSL record protocol to the
client or Server.
The SSL alert protocol format is shown in Fig. 12.1.5. Alert protocol uses two bytes to
and "g" value indicate a fatal error (if fatal error terminate the session/ connection).
or client detects
Whereas second byte indicates predefined error code either the server
1
error
any error
it sends an alert containing the error (error occurred during handshaking,
0ccurred during data processing at server or client side, certificate defeats, etc.)
Level Alert
Fatal/waming Error code
1 byte 1 byte
Scanned by CamScanner
Secur
Sys.
&
data
Crypt. & Sys. Security Applcatlon
(MU-Sem. 6-Comp)
12-8 Internet Security
Protocol distributlor
Table 12.1.1:Types of alert messages fragmentation
Data
Alert Code Alert Message
Descriptlon
close_notify compress
No more message from sender
10 unexpected_message Data
An incorrect message reccived
20 bad_record_mac add
A wrong MAC received MAC
30 decompression_failure Unable
to decompress.
40 handshake failure encry
Unable to finalize handshake by the sender. Data
42 bad certificate
Receiveda corruptedcertificate. Appending SS
42 header(
Nocertificate Client has no.certificate to send to server. record
SSL record protocol is basics for data transfer and specially used to build a data path
between client and server and encrypt the data path before communication.
SSL record protocol provides different service like data authentication; data
Scanned by CamScanner
Security( MU-Sem. 6-Comp)
ity Protocols &. Sys.
CIPt& 12-9
Internet Security
Protocols
Application data Massage / data
distribution.
Data
fragmentation Data 1 Data 2 Data 3
Scanned by CamScanner
Sys
Crypt. & Sys. Security &
(MU-Sem. 6-Comp) copt
12-10 Internet Security E
SSL
Prctocis Preper
record header refer Fig cncryp
12.1.6 consist 8-bit content type to whichideentify
of
of the message whether any
application data or connection termination or nature C
message. any
crtor
M
Next field is Major Version which is 8-bit field used to indicate latest version of S
SSL.
Use
(e.g., 3). Minor Version which is 8-bit ficld indicates the lowest version
of SSL M
use (e.g., 0).
S
Plaintext (compressed) compressed length which is 16-bit field indicates
/ the lengh
the plaintext being compressed. of
Finally sends SSL layer encrypted data to TCP and IP (Transport and Internet
layer)fox
necessary transmission over network
At the receiver end, the encrypted blocks are decrypted and then checked
authentication, data confidentiality and data integrity, reassemble
for data
these data into 12.2 IP Sec
singe
unit, and delivered to the application-layer protocol.
W
The Record Protocol provides two services in SSL connection : o. 12.2.1
(F
a) Confidentiality : This can be achieved by using secret
key, which is already defi
Encryptior
by handshake protocol.
avail this two f
b) Integrity : The handshake protocol defines a
shared secret key that is used to assura
themessage integrity.
Following are the operations
performed in Record protocol
after connection is established
and authentication is done
of both client and server.
1. Fragmentation : The original message
that is to be sent is broken
size of each block is less into blocks. The
than or equal to 2 (16384)bytes.
2. Compression : The
fragmented blocks are 12.2.1
noted that the compression process
compressed which is optional.
It should be
Aut
must not result
into loss of original data. It is desig
3 Addition of MAC :The
Message authentication
used to authenticate a message code (a short piece information first prote
of
for integrity and assurance data auth
is to be calculated of message) for each bloch
using shared secret
key. transit) a
4. Encryption :The
overall steps including message access
but the encryption is encrypted
using symmetrie s th
should not increase datal
the overall block size. IP p
The
mai
datato
rE
Scanned by CamScanner
Security (MU-Sem. 6-Comp) 12-11 Internet Security Protocols
Sys.
Copt&
Header : After all the above operations, header is prepended
Prepend in the
encrypted.block which contains following ficlds :
A
Minor Version (8 bits) specifics the minor version of SSL uscd, for example if
contains 0
sSL version 3.0 is in use than this ficld
Compresscd length (16 bit) specifies the length in bytes of the original plain text
block.
Protocols
a9 P Security
> (MU- May 16)
12.2.1
Write in brief about IPSec protocols for security.
l. (Ref. sec. 12.2): May 16, 5 Marks
Encryption of data and its authenticity is prime concern for secure communication, to
t his two features, IPSec provides two protocols at network layer:
IP Securlty Protocols
1. Authentication Header
transit)and non-repudiation but doesn't provide data confidentiality (if attacker able to
access the contents of a message) because Authentication Header does not encrypt the
data/ IP packet.
The main functionality of this protocol is protection against replay attacks (sending same
Gata to receiver again and again) and protection against tampering of ata over a network.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem, 6-Comp) Internet Security
12-12 Protocole
Authentication Header is also used to protect the upper-layer or the cntire IP packet. u.
the help of message authentication code (MAC - used to generate fixed length value fro
message and secret key to provide authentication) using well known hashing algorithms
T A
brief description of each field
The next header is an 8- bit filed which is uscd to identify the type of payload/ data
carried by IP packet.
Identifies the type of header immediately following this header.
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
&
Protocols COYDt
12-13
Parameter Index (SPI) (32 bits) Internet Security Protocols
ket,with Shrurtoy
luefrom SPI is
a 32-bit field used in
combination
gorithms security protocol to uniqucly with sourcc
AH IP
and
packet t belongs, we will identify a security address, destination IP address
which IP discuss association
SA it next (SA) for the traffic to
ated ficld also defining which bit.
and This different security
orotocol calculate the Message Authentication Code algorithms
(MAC). and keys werc
uscd to
Sequence
number (32 bits)
Authentication Data
o Modes of Operation
() AH Transport Mode
(ü) AH Tunnel Mode
Fig.12.2.3 :
Modes of Operation of AH
) AH Transport Mode
is placed between original Header and
Iransport mode the authentication header
In
original TOCP header as shown in Fig. 12.2.4.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) 12-14 Internet Security
Protoccs
IP AH Original data
TCP
header header.
(b) After applying AH
Scanned by CamScanner
Cypt.& Sys. Security (MU-Sem.
6-Comp)
12-15
same Internot Security Protocols
ESP has the fields as defincd
instead of having just a header, in AH, but itintegrates
it divides these ficlds in a different way
header, ESP (railer and ESP authentication these ficlds into
thrce components: An ESP
designed for confidentiality
block asshown
Itis and integrity
in Fig. 12.2.6.
of
combination of AH.ESP adds a messages,
headcr ESP can be used alone or with
adding ESP header and trailer to
a
for and trailer. the payload. Following are
the steps
In the initial step, ESP trailer
Step1 : is addedto IP
Payload payload.
Step 2:
and trailer or encrypted
After the
encryption ESP header
Step3: is added to
ESP header, payload the cncrypted packet.
Step4: and ESP trailer
arc used to create
This authentication authenticated data.
Step 5: data is added at the End
of Trailer.
Step 6: Lastly the IP header is added.
e main functionality
bem. Encryption
of ESP 1s to provide the
confidentiality to
algorithms (1riple DES, IP packet by encrypting
nin the packet with a
key and transform
Blowfish, and IDEA
an
etc.) used to combines
the
ncket now it into encrypted form. The encrypted
then transmitted to the
destination, and decrypts
The detail description
it using the same algorithm.
of Encapsulating Security Payload
(ESP) fields is given below :
ESP Header
Iis variable length filed contains transport layer segment or IP packet which is
is
protected by performing ESP
encryption.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-16 Internet Security Protocols
ESP Traller
ESP trailer field contains padding (0-255 bytes), pad length 8-bits and next heade
8- bits.
Padding (0-255 bytes)
Padding filed used to expand plain text message to required size or to align the encryptei
data by adding padding bits to the actual data which provides confidentiality to traffe
flow.
lf an encryption. algorithm requires the plaintext to be a multiple of some number of bytes
(c.g., the multiple of a single block for a block cipher), the Padding field is used to expand
the plaintext (consisting of the Payload Data, Padding, Pad Length, and Next Header
fields) to the required length.
The same bit length as of pad length used to identifies the type of encrypted data in the
Payload Data field.
Identifies the type of data contained in the Payload Data field (an upper-layer protocol
TCP, UDP, or an IPv6 extension header).
Scanned by CamScanner
&
Sys. Security (MU-Sem, 6-Comp)
ity Protocols M Cpt 12-17 Internet Security Protocols
variable length ficld whosc
This is length depends upon
variable-length ficld (must encryption algorithm used.
A be an integral number of
Integrity
Check Value computed over 32-bit words) that contains the
ext header thc ESP packet minus
mentioned earlier ESP cncrypts the Authentication Data field.
As transmission. thc data the rcason it provide data confidentiality
during
of Operation
Modes
encrypted
work in both modes namely :
to traffic ESP can
Modes of Operatlon of
ESP
er of
bytes
to expand (0)
ESP Transport Mode
xt Header
(i) ESP Tunnel Mode
Fig, 12.2.7 : Modes of Operation
er Transport mode
of pad ) ESP
In this
case ESP header is added before the transport layer header (like
TCP,UDP) and
Hoe is added after the IP Packet whereas if authentication is required then authentication
data is added after the ESP trailer.
der
Original ESP TCP Original data ESP ESP
IP. header header trailer auth
vption header
(b) After applying ESP
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Intornet Security
12-18 Pratocols,
Authenticated
Encrypted
Scanned by CamScanner
Copt. & Sys. Security (MU-Sem.
Ols i 6-Comp)
12-19
SA Uses
different parameters Ainternet Security Protocols
parameter index to perform data
security (SPI). handling bctween sender and receiver
TP address of the host (usually like
destination
protocol format (AH or ESP); IP address of
and security end user);
we protocol cncryption algorithms;
parameters have discussed identifier
in pervious bit still (SPI). Almost all
these
parameters. let us have small
look out on these
Security Parameter Index
(SPI) : A 32-bit
particular security association number used
between any connected to uniquely identify a
AH or ESP packet for linking the each secure devices. The SPI is placed
packet to the security in
octination IP Address : association.
Destination IP address a
involved in communication or of host. router or firewall
the address of who
he devices for which
are established. security associations
On
Security Protocol Identifier
(SPI) :To identify which protocol
for security associations. (AH or ESP) is used
lf both are used then they have separate
security associations
A
Syllabus Topic: Firewalls
Firewall is called as barrier place between inside and outside network to protect
organization from inside and outside hackers. It also filters all traffic between intranet and
extranet which runs through it.
Scanned by CamScanner
Cypt&S
Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-20 Internet Security Protocols
I: All inside and outside traffic must pass through the firewall. This is possible only
because of physically blocking of all access to the local network except via the
firewall.
2 The traffic defined by the local security policy will only allowed to pass through the
network. Different types of firewall are used to define the policies as per the norms
decided.
3. The firewall itself is immune to penetration. Different techniques are used to control
access and enforce the site's security
policy.
Service control: This policy helps to determine which type of internet services that can
be accessed inbound and outbound, Firewall can filter traffic on the basis of 1P address
and TCP port number. It also act as proxy server that receives and interprets each service Following are th
Scanned by CamScanner
Security (MU-Sem. 6-Comp) Protocols
& Sys. 12-21 Internet Security
Llmltatlons of
Flrewall
1. Viruses
2. Attacks
3. Architecture
4. Configuration
5. Monitoring
6. Encryption
7. Masquerading
8. Vulnerabilities
4 1. Viruses
because virùs uses different
Not allfirewalls have full protection against computer viruses
encoding techniques to encode files and
transfer them over Internet.
+ 2 Attacks
entering in to or out of the
A firewall cannot prevent users or attackers with modems from
internal network, thus bypassing the firewall and its
protection completely.
4 3. Architecture
security
architecture depends upon single security mechanism failure. If that
iTewall opens
failure. affects on entire firewall programs which
nechanism has a single point of
the loop falls for intruders.
4 Configuration
administrator about incorrect configuration. Only
Piewall doesn't have mechanism to tell
can configure firewall properly.
professionals in the field of network security
ned
Scanned by CamScanner
Soc
Sys.
&
Crypt. &
Sys. Security (MU-Sem. 6-Comp) Cypt
12-22 Intemot Security Protocols
Following
arethe
5. Monitoring
Firewall doesn't give notification
about hacking. It will notify
OCcurrences. The reason is, organization only about threat
demands additional hardwarc, softwarc
and
different networking tools as per there requirement
hence there is no control on it.
6. Encryption
Firewall and Virtual Private Networks (VPNs)
don't encrypt confidential documents and
E-mail messages sent within the organization or to outsiders.
Dignificd procedures and
tools are needed to provide protection against confidential
documents.
7. Masquerading
Firewalls cn't stop hacker those who steal login id
and password of authentic user to gain
access to a secure network. Once
attacker gains full access of the entire network, attácker Packet FilterF
can delete or change the
4L
network policies of organization. simp
Itis the most
Vulnerabilities Packet filtering is c
some
Firewall can't tell other venerability that might allow a protocol type
hacker access to your internal
network. I the firewall is pla
In the Fig.
12.3.3 Firewall Architecture and Types 12.3.3
network 1
and allo
(MU - Dec. 16, May 17) Also the
traffic usi
Q. 12.3.5 Explain the different types of firewalls and mention of the packet
the layer in which they rather =
operate. (Ref sec. 12,3.3) Thebiggest
Dec. 16, 7 Marks disadva
Q. 12.3.6 What are the types of firewalls ? loset policies.
A firewall is a kind of reference monitor. All network traffic passes through firewall.
That's why it is always in invoked condition.
A firewall is kept isolated and cannot be modified by anybody other than administator.
Local
(Pro
Flg,12.2
Scanned by CamScanner
Sys. Security (MU-Sem, 6-Comp)
cypt & 12-23
Internet Security Protocols
f
Following are
the Common architectural
implementations of fircwalls :
Implementations
of firewalls
1. Packet filtering
gateways or screoning routers
2. Stateful inspection firewalls
3. Application proxies
4. Guards
5. Personal firewalls
.fthe firewall is placed just behind the router then the traffic can be analyzed easily.
h the Fig. 12.3.3 it is shown that how packet filtering gateway can block traffic from
Detwork 1 and allow traffic from network 2.
Also the
traffic using telnet protocol is blocked. Packet filters do not analyze the contents
dthe packet rather they just check IP address of the packets as shown in Fig. 12.3.3.
Te biggest disadvantage of the packet filtering gateway is that it requires lot of detailing
toset policies.
Eample
Packet Remote
filtering (Blocked)
network 1
gateway
HTTP
Telnet Remote
(Accepted)
Local (Protected) Network
network 2
Scanned by CamScanner
Grypt. & Sys. Security
(MU-Sem. 6-Comp)
12-24 Internet Security
Protocols
lIf port 80
is blocked. If some applications
essentially nced use of port 80
we have to provide all then in this cate
the details of those applications for
which port 80 is nccded. A
2. Stateful Inspection Firewall
that
Packet filtering is done one packet at time.
their attack. Attacker can split the
Sometimes attacker may use this technique
script of attack into different packets so that fL Itc
complete script of attack cannot be identified by etc.
packet filtering firewall.
To avoid this stateful inspection firewall
kecps record of states of the packets from Erample
packet to another. Thus scquence of packets and
conditions within the packets can
identified easily.
In 0
3. Application Proxy stude
Packet filters cannot see inside
addresses for filtering.
the packets. From the packet headers
they just get In A stu
ap
An
It can S
Syman
can be
Rermote
access
12.3.4 FiL
Remote
file fetches
Q.12.3.8
Fig. 12.3.4: Firewall Proxies
Example
Scanned by CamScanner
& Sys. Security(MU-Sem.
COYpt 6-Comp)
12-25
Internet Security Protocols
Guard
Erample
In
order to increase the speed of the internet a
school can set download limit for
the
students.
A
student can download only 20mb data per day etc.
Personal Firewalls
4 5.
a. 12.3.7 What is personal firewalls? 2 (Ref sec.. 12.3.3(5)
For a perSonal
use to keep separate firewall on a separate machine is
quite difficult and
Flrewall Conflguratlons
LAN
2. Firewall on Separate
Router
3. Firewall with
Proxy and Screening
Configurations
Fig. 12.3.5: Firewall
Scanned by CamScanner
Sy8.
Coypt &
2 Crypt. & Sys. Security(MU-Sem.
6-Comp)
12-26 Internet Security Protocols Firewal
1, Firewall with screening router
AN
Outside network
nrk
Screoning router
Fig. 12.3.6
The screening router is placed in between intranet
and extranet. Another name fre
screening router firewall is network level or packet-filter screening
firewall. Protocol attributes are If
used for performing the screening of p
incoming packets. address to
The attributes like source or destination address, type LAN is not e
of protocol, source or destination
port, or some other protocol-specific attributes
plays a vital role. A screening router Introdu
performs packet-filtering and is utilized as a 124
firewall. In a few cases a screening router
may be utilized as perimneter assurance
for the internal network or as the whole firewall With the rap
solution.
issue for com
2. Firewall on Separate LAN
As e
defined
Unauthorized internet users from accessing private i
networks connected to the internet are (data/secret
prevented by firewall, especially intranets. All messages
entering or leaving the intranet others, becat
(i.e., the local network to which you are connected)
must pass through the firewall, which their
examines each mnessage and blocks those that do not meet secrits
the specified security constraint. these valuab
To overcome the problem of the exposure of LAN, a proxy
firewall can be installed on is As these orga
Own LAN.
their vision a
Many
efforts
Outside network anti-virus
so
LAN in operating =
Proxy gateway
But still
dete
network
scar
inthefield
o
Fig. 12.3.7
Scanned by CamScanner
Protocols
Security (MU-Sem. 6-Comp) 12-27
Internet Security
Sys.
&
LAN
Proxy firowall
Outside
/netvork
Screoning router
Fig. 12.3.8
ensures the correct
installed behind the proxy fircwall, then it
router is
screening
firewall. In other words it
a double is
guard protection. If anyone fails
f proxy
sddressto
exposed.
LANiS not
Detection
Introduction to Intrusion
124
years, security has becomes an essential
expansion of Internet during recent
With the rapid
comnputer systems.
. computer networks and
issue for most valuable assets
of a security system
is to protect the
defined earlier the
main aim many
As
like banks, companies, universities and
an organizations
Ätalsecret information) of secret information in
some form, and
or
organizations have data
thers, because these availability of
protecting the privacy, integrity, and
their security policies
are keen for
information or data.
these valuable depending on
security policies and requirements
As these organizations
will have different
Scanned by CamScanner
Crypt.
8 Sys.Security
(MU-Sem.
1oovercome 6-Comp)
existing allabove 12-28
on but different problems
bS solution researcher
detectionlet us understand called in
\nterne
Security
the field
andthen some IntrusionDetection of computer Protocols
12.4.1 what key
Intruslon isintrusion noints like System seCurnly
(IDS). came
detection what Before with
Q. 12.4.1 Detectlon system? is intrusion? discussing
Whatare hat is intrusion
the strengths
Q. 12.4.2 (Ref.sec. 12.4.1) andlimitations
What intruder oflntrusion
Before is Detection
efining andintrusion System?
Intrusion detection
An Intruder Detection system?
firstunderstand (Ref. sec.
integrity. is a person whatis an
12.4.1)
Intruder's who intercepts Intruder?
Intruder may gains unauthorized system availability,
damage access
When an thatsystem
or to a system confidentiality and
attacker or disturbs with criminal data
illegal action intruder attempts data.
intensions.
many such as denial to break
request of service into an information
that is called for connection setup attacks,
scanning
a
system or
pertorms
as an using fake networks, an
intrusion. IP address, ping scan,
Intrusion etc. which sending
detection is legally
-identifies is an important not allowed
network intrusions technology
access such as abnormal that monitors network
and malicious
attacksto computer network behaviours, traffic, events and
The general systemns. unauthorized
example netwotk
asking doctor of intrusion
what happen detection
to me. is when we
sample to laboratory Doctor suggests suffer from some
disease and
for detection. for blood checking
The blood report and sends blod
given by pathologies
count, WBC, is just detection
RBC, hemoglobin, of disease (number
doctor suggests etc.) then after of plateles
medicine to cure checking the
entire history
the disease. of blood repat
Here blood report
is intrusion detection
checking blood report where as medicine
is called intrusion detection given by the doctor
aic
relief depends upon the system. Finaly
doctor's education, experience how fast patient god
Scanned by CamScanner
& Sys. Security (MU-Sem. 6-Comp)
12-29
Internet Security Protocols
Syllabus Toplc :
IDS and Types
Intrusion Detection System software that monitors the events occur in a computer
is
to find out
ststems or networks, analyzing what happens during an execution and tries
to achieve confidentiality,
indications that the computer has been misused in order
? Intrusion detection
on the
or network activity to find possible attacks
System examines or monitors system
system security policies, standard security
system or network. Signs of violation of
practices are analyzed.
them from
Prevention is the process of detecting intruders and preventing
rusion
intrusive effort to system.
Scanned by CamScanner
KT Crypt. & Sys, Security (MU-Sem, 6-Comp) 12-30 ntefnol lecuity Protocola
2. Inside Intruders : Internal intruders, who have permission to access the system win
some restrictions, In this case, the intruder already has legitimate access to a compater
system, but utilizes any of the previously mentioned techniques to gain addition
are more harn
privileges and misuse the computer system, Sometimes inside intruders
than outside intruders. It is observed that 80% of intrusions and attacks come from wit.
organizations.
Following are the possible type of attacks that intrusion detection needs to face :
Type of attacks
2. Ping scan
).Operating system attacks, which target bugs in specific operating systems and cante
fixed with patches;
Scanned by CamScanner
Sys..Secunty (MU-Sem,
CYpt & 6-Comp)
12-31
SYNIpackets with the Intemet Security Protocols
sends spoofed
(faked)IP
Connection. address
tothe victim in order to establish a
O Rlogin : The RLOGIN attack is characterized by a high rate of connections from one node
toanother, often within a small period of time. In this attack, the intruder is attempting to
gain access to
the system.
Need of IDS
uusion Detection has its primary goal the detection of abuses of computer systems also
t performs a variety of functions like:
Monitoring and analyzing user and system activity.
Scanned by CamScanner
Crypt. &
Sys.Security (MU-Sem.
6-Comp)
12-32 Internet Security Protocols
2 Auditing system configurations
and vulnerabilities. 124.3 In
3. Assessing the integrity of critical system
and data files.
124.7
4. Recognition
of activity patterns reflecting known la.
attacks. The ca
5. Statistical analysis
for abnormal activity patterns. stateful
pro
6. Operating-system audit-trail management, free.
with recognition of uscr activity reflccting erTor
policy violations.
IDS should offer reports of attacks in 124.3(A)
real time, ideally as the intrusion
allowing security personnel to take is in progress
corrective action. It is a
IDS should cooperate with other security mechanisms, observe
increasing the overall security of
systems. Ideally, IDS should be capable
of detecting failures or attacks on other security network
mechanisms, forming a second level defence.
of
Signatu
IDS should be capable of responding to intrusive behaviour:
by increasing its monitoring packet
in the relevant sections, or by excluding or restricting intrusive
behaviour.
1fan at
IDS should protect itself against attacks, ensuring that
the integrity of the greater system, patterme
and audit information up to the point of compromise remains intact,
and ensuring that a
compromised or hostile component cannot adversely affect the functioning the system Signatu
of
as a whole. docume
Other than monitoring network intruder and policy violations, the IDS can be useful in are pres
Scanned by CamScanner
& Sys. Security (MU-Sem. 6-Comp)
8
coypt.
rotoco! 12-33
Internet Security Protocols
Detectlon
1243 Intrusion Methods/
Technlques
Explain methods
fa124.7 for intrusion detection
system
categorization of
Detection methodologies (|DS).(Ret. seC. 12.4.3)
analysis. Most of arc : Signature
caeful protocol the IDPS uses Bascd, anomaly
these techniques based,
lecting rorfree. to reduce or make network
124.34) Slgnature Based Detectlon
ogress
IIis a procesS of comparing the signatures of known
threat with the events
rity of ohserved. Here the current packet is been matched that are been
with log entry
network. of the signatures in the
2curity
as
Signature is defined the pattern (structure) that
we
search inside a data packet.
contain Source address, destination The data
toring packet may address, protocol, port
number etc.
f an attacker adds any
malicious code into these
data packet he
is generating attack
wstem, pattern or signature.
that anature based IDS create databases of such attack pattern
for detecting the known or
ystem
aumented attacks. Single signature is used to detect one or more types
of attacks which
are present in
different parts ofa data packet.
ful in
Signature based IDS used to monitor the events occurred in the network and match those
events against a database of attack signatures to detect intrusions.
- It also uses a rule set to identify intrusions by watching for patterns of events specific to
known and documented attacks.
less For example, we may get signatures in the IP header, transport layer header (TCP or UDP
beader) and application layer header or payload.
the SIgnature based intrusion detection system sometimes also called misuse detection
ar lechniques. It checks for the attack pattern with the existing stored database pattern and if
Scanned by CamScanner
Cypt.
Crypt. & Sys. Secunty (MU-Sem. 6-Comp) 12-34 Internet Security Protocols rescarc
over a
r Advantages
Anom
An atvantage of misusc-detcction IDS is that it is not only useful to detcct intrusions. h..
it will also detect intrusion attempts. order t
anomal
Elective at detccting known attack without too many false alerts as comparc to anomal.
detection technique. This ca
Most of the current network intrusion detection system uses misuse detection techni
for finding the attack pattern and detcct them according to the rules and regulation
...
Frthermore, the misuse detection IDS could detect port - scans and other events a
r Disadvantages
Detecting only known attacks therefore it cannot identify new attacks efficiently
If there is single variation into attack signature it invalidates the attack signature or nnakl.
1. Th
to detect it.
Thresho
Constant updating of attack pattern is required.
compar
12.4.3(B) Anomaly Based Detection
2. Pro
Q. 12.4.8 Explain Anomaly-based Instruction Detection System. (Ref sec. 12.4.3(B)
Profiles
It is the process of comparing activities which are supposed to be normal against observed checkin
events to identify deviation. Advanta
An DPS uses Anomaly based detection techniques, which has profiles that represet
An ano
normal activities of user, host, connections or applications.
observes any
For example inform and
a
Web activities are a normal activity done in a network. Anomaly based IDS works on tie Disadva
notation that "attack behavior" enough differ from "normal behavior" (IDS developer ma
Anomal
define normal behavior).
unpredic
Normal or acceptable behaviors of the system (e.g. CPU usage, job execution ime e
It also
the system behavior looks abnormal i.e. increasing CPU speed, to0 many job execution
a hasd
characte
time then it is assumed that the systems is out of activity. Anomaly
normal
detection is based on the abnormal behavior a In additie
of host or network. user's
Database for such type of network, ani be
IDSis the events generated by user, host and difficult
"normal" behavior collected fron
of the systems. These events (historical data) are
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
copt. & 12-35 Intornot Security Protocols
1.Threshold detection
Threshold detection
A L
all users for all groups and frequency of all events is measured
Thresholdis defined for
threshold.
comparing with
Based detection
4 2 Profile
are matched against the collected statistics for
Drofilesof individuals are created and they
checking the irregular patterns.
T Advantages
network. If it
system observes and checks the deviation of normal
An anomaly detection it will immediately
or suspicious in the network from normal deviations
cbserves any changes
Disadvantages
due to the
generate large number of false alarms
Anomaly detection techniques
unpredictable behaviors of
users and networks.
to
events, records in order
"training data set" of system
lI also requires
extensive
characterize normal behavior patterns. a
changes over time (for example,
normal behavior usually very
n addition, because a user's moves from one host to another host),- it is
USer's behavior
may change when he behavior.
historical data of normal and abnormal
diticult to collect the
Scanned by CamScanner
2 Crypt. & Sys. Security(MU-Sem. 6-Comp) 12-36 Internet Security
Protocols
3. N
12.4.3(C) Stateful Protocol Analysls
These
Unlike anomaly based
detection which uses host and network specific profiles DDOS
stateful protocol analysis relies on Vendor developed
universal profiles. The stateful
analvsis means the IDPS is able of checking protocol
pre defined in them. It can
the network, applications, and protocols that 4. H
identify unexpected sequence of threats in form of commande
These
Dlsadvantage of stateful protocol analysis
AmonE
Stateful protocol analysis are extensively resource demanding.
the net
These methods don't capture threats or
attacks that don't hamper the general
protocol in network. ac. 124.4(A)
12.4.4 Types of IDS As the
a. 12.4.9 networ
Explain types of Intrusion detection systems
(|DS). (Ret. sec. 12.4.4)
o. 12.4.10 Describe the different types of IDS
and their limitations. (Ref. sec. 12.44)
The types of IDS are differentiated
mainly by the types of event they monitor
scrutinize.
There are four types of IDS.
Types of IDS
Technologles
2. Wireless
4. Host Based
Scanned by CamScanner
Sys. Security (MU-Sem,
COpt & .6-Comp)
Intemet 12-37
Security
Protocols Network Behavionr Analyse Internet
Security Protocols
nctwork behavior
These analyze
specific pDOS(Distributed Denial identify
profiles., of Servicc) the trcats that
S. attacks, create
The stateful the unusual traffic overflow,
Host Based
malwares,
and protocolsprotoco 4.
and policy
violations.
m of commands. that are monitors the
These IDS host andthe cvcnt occurs
Among above four types of IDS within that
two are important host.
hosts.
be networks and and most commonly
used to monitor
the general 124.4(A) Network based IDS (NIDs)
accepted
usage and popularity of
Internet is increasing
As
the
:
network are increasing for example TCP
hijacking, DOS,
tremendously,
the atacks to
IP Spoofing etc. the
2.4.4)
9c. 12.4.4)
t
they monitor or Target Host
Normal User
Network HUB
attacker
Outside Attack Patterns
Network IDS
How to
detect
Unknown
Attack?
Scanned by CamScanner
COYpt&
Sys. s
1 Host
< Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-38 Internet Security Protocols
(244E)
NIDS continually monitors nctwork traffic and discovcrs that if hacker/ intrucder me uSually
attempting to brcak into a system. HIDS
audit
trail is
When NIDS installed on main server which consist of multiple hosts in a singlc networl. use
soplication, or
i detects attacks present in the multiple hosts by checking incoming packets that looks An
unordinary.
gencrally in
HIDS
NIDS uses raw network packets as the training dataset for offline detcction collected f
Foaturesof H
well known research laboratory such
(DARPA).
as Defence Advance Research
Project Agency
s HIDS focus m
As defined carlier it can be installed on servers, workstations, personal computers continuous]
machines dedicated to monitor incoming network packets from switches, routers and It that
to check
probes for intrusions.
It
generally lo
Advantages of NIDs c
-
A well placed network Based IDS can monitor a large network. r Advantages
As defined ea
NIDS just listen to the network; it does not interfere in the network.
horse or other
NIDS can be made very secure against attack and made invisible to many attackers.
HIDS analyz
Network-based IDS use live network traffic for real time attack detection and also decrypted by
operating system independent.
It is able to m
G Disadvantages of NIDS
Disadvantage
It becomes difficult for NIDS to recognize the attack in large or busy network due to high
- Host-based
traffic is there in network. It will be difficult for NIDS to analyze. I
host. Monitor
NIDS cannot analyze the network if communication is in encrypted format.
and log gener
Difficult to detect the whole process of attack, usually detect only the initial level of
When host-be
attack. data can
be in
We have seen a different type of IDS but we must know how these IDS detect whether -
Host based
given packet is malicious and the system behaviour is abnormal. There are two main types I
attacks
becau=
of detection techniques for analyzing events generation, system logs, audit trails, ad
malicious packet activities namely : anomaly detection and misuse detection also called
signature based IDS. 12.5
Electror
(NIDS) usually consists of a network sensor with a Network Interface Card (NIC) or LA
card operating in casual mode. The IDS is placed along a network segment or bounuey
and it monitors all traffic on that network segnent. Q.12.5.1.
Write
Scanned by CamScanner
Intornet Security
Protocols
Security (MU-Sem. 6-Comp) 12-39
s.
and log
generation. source the amount of
system logs as an information
When host-based IDS
use operating
system.
requiring additional local storage on the
data can be increase, scan
network denial of service and network
Host - based IDS are not
suitable for detecting
those packets received by individual host.
ztacks because it only
checks only
Secure Email- PGP
Syllabus Topic:
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-40 Internet Security Protocols
We all are aware that most popular use of Internet is to send the cmail and chatting with
the triend's, partner cte. But have you cver think that if we are sending mail to intende
person is going in his inbox only?
Security concerns have estimated that only about one in every 100 meSsages is secured
against interception and modification attacks. Are we awarc that sending an email
business partner or friends in clear text message is going through thousands of machin
(between sender and receiver before it reaches to intended recipients?)these machine.
might read and saved the contents of email for future use?
Many people think that name given in sender of the mail identifies
who actually sends it
When you send a message through email, we cannot guarantee
that it will be deliver to
correct destination or received exactly what you sent.
And even there 1s a n0 Way of
knowing that the message is received read and
forwarded by attacker.
Because of wide spared problem email
of modifications, sending it to wrong destination
by intermediate parties, email spoofing, we
need a competing solution to overcome and
address the issues of authentication,
integrity and reliability
sender and receiver. of the messages between
The public key cryptography play an
important role because of two
intended sender can decrypt the message keys used, onl
using his public key as message encrypted using
private key of the sender.
The solution is called as Pretty Good
Privacy (PGP) program/ software
secrecy and non-repudiation which provide the
of data sent over Internet especially by email.
Pretty Good Privacy (PGP) is a
popular open-source freely available
software packagd
techniques used to encrypt and decrypt
email messages over the Internet.
PGP is an e-mail security program
written by Phil Zimmermann in 1991,
PGP progam
become a de facto standard for
e-mail security used to store
can benon-readable the encrypted files so thet
by other users or intruders.
This program also be used to send an encrypted
digital signature, let the receiver veril
sender's identity and know that the message was
not changed or modified wr
transmission.
Once the file is encrypted using PGP program
only the intended recipient can ec
Once message content digitally singed by sender,
the sender guarantee to the reciy
that message or file comes from valid sender and not by attacker.
Scanned by CamScanner
& Sys. Security (MU-Sem. 6-Comp)
12-41
signature functionality Intornot Security Protocols
pigital of PGP guarantees
.and not from an intruder. that the messagc
sender or file come
from the
Worklng of Pretty Good Privacy
Parameter Algorithm
Description
Scanned by CamScanner
Crypt, &
Sys, Becunity (MU-Bem, 8-Comp) Internet Socurity
12-42 Protoccln
1.POP Authontlcatlon
2,PQP Contidentially
4. PGP Compronalon
6.PGP Sogmontation
1. PGP Authentlcatlon
1.
Ramesh has (private/public) key pair (Rd/Re) and he wants to send a digitally
sizned
message m to Suresh.
2. Ramesh hashes the message using SHA-1 to obtain SHA(m).
3. Ramesh encrypts the hash using his private key Rd to obtain ciphertext c given by
c= encryptae(SHA(m)
4. Ramesh sends the pair (m,c)to Suresh
5. Suresh receives (m,c) and decrypts c using Ramesh's public key Re to
obtain signature S
S = decryplre(c)
Suresh is sure that the message is correct and that came from Ramesh. Furtherrm:
Ramesh cannot later deny sending the message since only Ramesh has access tO
private key Rd which works with respective
public key Rd.
2. PGP Confidentiality
1, Ramesh wishes to send Suresh a confidential message m.
2. Ramesh generates a random session key k
for a symmetric cryptosystem.
3. Ramesh encrypts k using Suresh's public
key Be to get.
Scanned by CamScanner
Protocols
Security(MU-Sem. 6-Comp) 12-43 Internet Security
Srs.
CSpt&
= encryptpe(k)
k'
message m with the session key k to get ciphertext c
encrypts the
Ramcesh
c,= encrypt(m)
4 the values (kc)
sends Suresh
Ramesh
receives the
values (k',c) and decrypts k' using is private key B,to obtain k.
Suresh
decryptB(k'")
k =
session key k to decrypt the ciphertext c
and recover the message m
uses the.
Suresh
decryptk(c)
m=
symmetric key cryptosystems are combined in this way to provide security for
Public and efficiency for encryption. The session key k is used only to
exchange and then
key
message m and is
nott stored for any length of time.
encryptm
Authentication and Confidentiality
PGP
+3. can becombined so that Ramesh can
authentication and confidentiality
schemes for
Thc
message which is encrypted before transmission. The steps required are as
n confidential
follows :
signature c for
his message as in the Authentication scheme
m
generates a
1 Ramesh
cncryptra(SHA(m))
C= c
message and the signature
m
using a symmetric
cryptosystem to obtain ciphertext C
C = encrypt(m,c)
public key
3 He encrypts the session key k using Suresh
k' = encryptpe(k)
k = decryptpa(k')
to obtain m and c
Sresh decrypts the ciphertextC using the session key k
(m, c) = decrypta(C)
1.
it he uses Ramesh public key
Re
now has the message m. In order to authenticate
Suresh
Scanned by CamScanner
Sys.
&
46Cypt
Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-44 Internet Security
Protoccs
Each24
If SHA(m) = decryptRe(c) 2 6
Each
Then the messuge is authcnticated.
3 This val
4
PGP Compression 4.
PGP can also compress the messagc if desired. The compression
algorithm is
PGPSes
ZAP
decompression algorithm is UNZIP. andthe cons
Another
1. The original message m is signed as before to obtain automat
c= PGP
cncryptr(SHA(m) receipt, th
On
Now the original message m is compressed to obtain
Following are
2
M= ZIP(m) Authenti
a 1.
3. Ramesh generates session key k
and encrypts the compressed message
and the signature Non-repL
using the session key 3.
C = encrypt;(M,c) 5.
CompreS
4. The session key is encrypted using 7. Segment
Suresh's public key as before.
5. Ramesh sends Suresh
the encrypted session key and ciphertext
C. 12.5.2 Backdc
6. Suresh decrypts
the session key using his private
key and then uses the session key ts we
decrypt the ciphertext C to obtain M and c Suppose,
(M,c) = decrypt(C)
can get unau
a Backdoor i
7 Suresh decompresses the message to
M obtain the original messagem
A Backdoor
m = UNZIP(M)
provide unaut
8
Now Suresh has the original message m
and signature c. He verifies the signature usina A backdoor i
SHA-1 and Ramesh's public key as before.
encryption al
5. PGP E-Mail Compatibility
A Backdoor
r
Many electronic mail systems can only transmit even
blocks of ASCII text. This creates be imple
problem when sending encrypted data which is
in cipher text formn might not coespod Just to
give ar
to ASCIIcharacters that can be transmitted.
statement
PGP overcomes this problem by using Radix-64
for
gave
conversion. unauthc
Suppose the text to be encrypted has been converted into binary using Networks
ASCl coding
encrypted to give a ciphertext stream of binary. Radix-64 conversion maps. aro decrypts ha
VPN
binary into printable characters. There
are
1. The binary input is split into blocks of 24 bits (3 Backdoors. t
bytes).
Scanned by CamScanner
Security (MU-Sem. 6-Comp)
12-45
Internet Security Protocols
block is then split into four sets
each of 6-bits.
wilt then
haveavalue between
6-bitset 0 and
, Fach
value is
encoded into a printable
character.
2-1(=63).
Segmentation
PGP
constraint of e-mail is that there
is usually a maximum
Another message
oautomatically hlocks an cncryplca messago length.
into segments of an
must be) re-assembled appropriate length.
P
receip,
the. segments before the
decryption process.
are the service offered by the PGP:
On
Allowing
Authentication 2. Confidentiality
Non-repudiation 4
Integrity
Segmentation
Suppose, have saved your password in laptop. So, anyone who has access
wWe
the laptop,
unauthorized access to your account. And tht is a
can get simple way of saying what
Backdoor is.
a method for bypassing normal authentication a
A Backdooris in system and thus,
ovide unauthorized remote access to the system to malicious users.
A backdoor is a "feature" in the software of. PGP like an utility functions but not
in the
ccotion algorithm that allows an outside party to decrypt which is encrypted by PGP.
A Backdoor may be implemented as a hidden part of a program or a separate program or
even be implemented by hardware.
conditional a
Just to give anexample, in 2003 a Backdoor was planted in Linux Kernel. In
was replaced with '=. As a result, it
for checking root access permission, '=
=
staterment
gave unauthorizd access to malicious callers. Even very recently, in 2015, Juniper
that automatically
Networks have warned about a malicious Backdoor in their firewalls
decrypts VPN traffic.
Backdoors and Asymmetric
re two types of Backdoors -Object Code
Backdoors.
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. Clis
6-Comp) 12-46 Internet Security Protocols The
chpset
In Object Code Backdoors, software source code remains
fe
keyto
unchanged, but the object code
gets modified maliciously. As the object code is designed to
was def
be machine readable, i
Decomes much more difficult to detect. These types are inserted in the on
of Backdoors encryptic
disk object code or inserted at some point during compilation, linking or loading.
Recompiling the software source code may get rid of the Backdoors. So, malicious user: escA
Key
Sometimes change the compiler source code in such a way that, whenever
it compiles needed t
links and loads the source code. the Backdoor is inserted. These Backdoors can autho
be fire
by recompiling the compiler and removing the Backdoor inserting codes. an
Normally, Backdoors are symmetric. Anyone who finds the Backdoor, can in turn use
But, Asymmetric Backdoors can be exxploited only by the attacker who
i
plants it, even i
the Backdoor implementation becomes public. This type of attacks are termed ae 12.6
Hon
Kleptography and they can be carried out in software, hardware or in combination of
both. The theory of Asymmetric Backdoors is a part
of a larger field named A honey
Cryptovirology.
or new
Counter measures hackersE
Once Backdoors are detected, rebuild a clean system and transfer Multiple
data.
Another method is to use Diverse Double Compiling or DDC. There ar
It requires a different
compiler and the source code of the compiler to be tested.
That source code, while employe
compiled with two different compilers, would result in two different stage-1 complers
informat=
showing same behaviour.
hackers'
Thus, the same source code compiled in two different stage-1
compilers, must result in
two identical stage-2 compilers. This method was Honeypo
applied to verify that C compiler of
GCC Suite contained no Trojan, using the icc as the other compiler. as
Normally, Operating
firew
Systems vendors implement these type of methods to make sure they are not distributing a addition,
compromised system. systems.
Scanned by CamScanner
CYpL &
S/s. Security (MU-Sem.
6-Comp)
12-47
Internet Security Protocols
Clipper Chip was a U.S. government
The
promoted as an encryption encryption
chipset was chipset introduced in 1993. The
device with a
facilitate encryption gOvernment-held (escrow) master
key to in
the face of sccurity
by 1996, threats. The controversial
was defunct
but the concept Clipper Chip
evolved into
encryption tool, which is used worldwide. the Pretty Good Privacy (PGP)
escrow (also known as a "fair
Key cryplosystem)
decrypt encrypted data are held
is an arrangement
neededto escrow so in which the keys
in that, under certain
authorized third party may
gain access to those keys. circurnstances,
n
Syllabus Topic : Honey
Pots
Honeypot
126
- Multiple
l honeypots can be set on a network to
form a honeynet.
There are many advantages to honeypots. "The main one is the case with which they are
mploved. Another advantage 1s
that although honeypots seek small amounts of hacker
information, the information is considered highly valuable for studying
and uncovering
hackers' motivations.
Honeypot systems are not perfect, however. They contain the usual technology risks such
s firewall penetration, broken encryption methods and failure to detect attacks. In
addition, honeypots are unable to detect attacks against systems that are not honeypot
systems.
There are two different kinds of honeypots. They are classified based on their deployment
method :
:
Used by companies and corporations for the purpose of
o
Production Honeypot
researching the motives of hackers as well as diverting and mitigating the risk of
attacks on the overall network.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Internet Security Protocols
12-48
CH
Honeypots are not always designed to identify hackers.
Honeypot developers are often more interested in getting into the minds of hackers, which
as well as to educate other professionale
then permits them to design more secure systems,
about the lessons learned through their efforts.
Overall, honeypots are considered an effective method to track hacker bchavior
and
13.1 E
13.1.1
Q.13.1
A se
But
Exa
1.
2.
3.
4.
Th?
1.
Scanned by CamScanner
Module 6
CHAPTER
13 Software Vulnerabilities
Syllabus
Vulnerabilities : Buffer Overflow,Format string, cross-site scripting, SQL
Software
Malware:Viruses, Worms, Trojans, Logic Bomb, Bots, Rootkits.
injection,
Examples
or her work is good enough.
1. Naive user : Fit for his
tests while programming.
2. Programmer :Passes all his / her
specifications are covered.
3. Manager : All requirements and
testing.
implementation, functioning and
4. Developer :Correct
work
pressure, deadlines, side
by
introduced. Mainly these faults are caused
requirements etc.
Ihe fault fixing, system performance
Scanned by CamScanner
Software Vulnerabilities
13-2
6-Comp)
Socurity (MU-Som.
Crypt. & Sys. understood then again it may cause
not clearly.
requirements are differcnt
components in the program have
analysis phase if implementation. Again intentional or accidental flaws in
and may producc
Wrong coding which
cach other attackers to cxploit vulnerability.
communicate with are used by
to
program. Accidental
faults such faults.
thoroughly to avoid
the nust be done can check that what
Therefore testing testing also. Testing
limitations for this program should not do. Again progam
are sonme what
But there check structures as well as changing
It cannot
program should do. data
complex coding, complex
complexity i.e.
challenges for testing.
technologies are the
program analysis software security. Care should be taken
3. By judging
approaches for
one of the best deployment stage. While developing program,
It is
requirement analysis to considering all the scenarios.
right from be performed carefully by
debugging should and techniques can be
testing and
specialized security methods
on the analysis
Based
implemented.
1. Buffer overflows
Q. 13.1.4. What is buffer oveflow in software security ? (Ref, sec. 13.1.2(1)
overtlow Spact
Attacker can insert malicious data values / instruction codes into
be
limits cannot
Array bound checking is not performed by C compiler, pointer
defined ás well.
Example : int B[15];
Here the aray bound is (0 to 14). i.e. B[O]J...B(14].
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
oftware Vulnerabilities fcYpt. & 13-3
Software Vulnerabilities
inserted after that bound
again If anything thenthe adjacent
it may
n the programcause Attacker can overwrite users data,
changes users
data is overwritten.
accidental have changes OS instructions. Thus can get instruction, overwrite OS data,
flaws in complete control of a
ploit vulnerability,. also known as aliasing. program or OS. This is
Running normal
n check After attack
that what
o. Again program Program
Instructions Program
well as changing Instructions
Data
Data
HEAP
should be taken Dynamic Memory HEAP
Mallcious codel
eloping program,
all the scenarios. Procedue Call Prooedure Call
hniques can be Frame Frame
Buffer Bufferoverflow
Modified Returm
Retum address
Address!
Tors. As shown in Fig. 13.1.1 attacker changes the return address and thus can transfer the
.
15, 5 Marks control of the program.
|2 Incomplete mediation
e errors are not
0.13.1.5 What
is incomplete mediation in software security ?
urity. Program
(Ref. sec. 13.1.2(2)
as sensitive
Due to incomplete mediation serious
security threats can be introduced
condition.
data may get exposed and can result in uncontrolled
=
htp://www.onlinestore.com/purchase/total 935.
Example : URL:
server,
request to the
W space. can edit the total
User cost and resubmit the
be URL: http://www.onlinestore.com/purchase/total =035.
ts cannot
Such kinds of vulnerabilities are very dangerous.
permissions
vulnerabilities. Such editing
such
Proper care
should be taken to avoid
Should not available to the user.
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-4 Software Vulnerabilitles
Example :
If two thrends are sharing their root and current directories then, Let
Thread X's current working directory is /college.
Y calls chdir(department")
be.
Proper locking mechanism can prevent this kind of attack. Time lags should
considered. After checking values it must be locked using digital signatures and
certificates. Thus after check data cannot be modified.
Q. 13.1.6 What are different types of malicious code ? (Ref, seo. 13.1.3)
Q. 13.1.7 What is malicious code ? (Ref.,. sec. 13.1.3)
Q.13.1.8 What are the different types of
malicious software's ? (Ref. sec. 13.1.3)
Malicious software is software where an attacker can get partial or full control of the
program. Thus attacker is free to do anything that he / she want to do.
Malware is currently the major source of attacks and fraudulent activities on the Internet
Malware is used to infect computers. Malware, short form is malicious software or also called
as malicious software.
Scanned by CamScanner
Vulnerabilities
MU-Sem 6-Comp)
Software
Securiy 13-5
Malicious Software
Tpes of Tados
r Trojan Horses
Bacteria
Botnet
) computers under control of an attacker.
Batnet is a network of zombies, 1.e. compromised
connected to the
Bot is a program loaded
on ZOmbie computer (a zombie is a computer
a
Internet that has been compromised by hacker)
that provides remote control mechanisms
an attacker. Bot - a small program to remotely
control a computer.
Zombies
Scanned by CamScanner
2 Crypt. & Sys. Security (MU-Sem.
6-Comp) 13-6 Software Vulnerabilities
It is a computer program. Along with some useful code or function, some hidder
malicious code or function is there which may hamper performance of security
mechanisms. Useful information can be stolen by attackers.
(3) Bacterium
Bacterium is pecial kind of virus. Virus is getting attached with different files byt
bacterium does not get attached to a specific file.
Logic bomb is generally used in DoS (Denial of Service) attacks. When specified
conditions are met it activates malicious program logic. It may damage system resources
greatly.
(6) Rabbit
It is a kind of virus / worms that replicates itself without any limits. The intension is to
exhaust resources.
Scanned by CamScanner
Sya..Socurlty (MU-Som. 6-Comp) 13-7 Softwarg Vutnerabilitiss
cYp.&
worm and virus are, virus necds a host prograrmme to
basic differences betwecn
The sprcad itself whercas worm does not need host it propagates independently
propagate or
slowly.
but
spreads or infects system without priory informing the user the actívities like
Virus
deletion of ile,
halting of system ctc. virus can affect system mildly, effecting the
can cause severe like denial of service.
system'ss data or
Almost all
viruses come with some of the eXCcutable files, Whereas worm are standalone
. cnter system by finding loop hole in the system andtake advantage of file
software they
transport fcatures of system.
Types of virus
system. other
Boot sector also spreads
system
The itself sector while rebooting
virus infect
system.
Computers if same disk is shared to other
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-8 Software Vulnerabilities
A program virüs gets active when program containing these vius gets opened
program.
(.bin, .exe, .ove), once if gets open it starts copying itsclf and infect other
It infects the program files. When this virus is active it will affect boot sector also
after booting or starting up it will affect other computer also.
"Dubbed Brain" the first computer virus was a stealth virus it tries to disguise itself
so that antivirus software may not able to recognize it.
1
E-mail worms
message of any infected websites.
It spreads through infected email
Scanned by CamScanner
Vulnerabilities
Security (MU-Sem. 6-Comp) Softwarg
13-9
Ss.
opt &
worm
Internet
vulnerable, it
network resources which are available and system. If it found
4 scans al access.
advantage and gain
will
take
Chat) worms
(Unternet Relay
IRC
copy of itself through link in infected
k
websites.
places a
I
Network Worms
sharing
copy of itself in a: folder which is sharable and spread via P2P network.
places a
It
Virus and Worm
1814(C)
pifference between
difference between Virus and Worm ? (Ref. sec. 13.1.4(C)
13.1.11 What is the
a
Virus Worms
Feature
Sr
INo.
as
5. | Prevalence Worm existence is moderate
More than 100, 000 known
compare to virus.
computer virus have been there
through only few have attacked
system.
etc.
Famous melissa, conficker
vius and worm are ILOVE YOUvirus Morris worm,
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-10 Software Vulnerabilities
Example
(1)' Trapdoor / backdoor
Scanned by CamScanner
&Sys, Securlty(MU-Som. 6-Comp)
ftware &
Vutnerabilit OP 13-11
Software Vulnerabilities
) Rootkits
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-12 Software Vulnerabilities
2. Kernel Mode
Kernel mode rootkits are installed like an OS hence can corrupt the functionality of
complete Os. These Rootkits are very hard to detect. It can be detected only after
Some event,or crash.
3. Firmware
At svstem
Firmware's are dangerous amongst all. Malcode is created insidea firware.
startup this malware will be reinstalled. It is very hard to remove.
:
It is explained as follows
Attacker:
1. Xsends a message to Y, which is intercepted by
your account. Please send account number".
X "Iwant to deposit money in
message to Y; cannot tell it is not really from X.
Y
Scanned by CamScanner
Secunity (MU-Sem. 6-Comp)
&Ss.
13-13
ot controlling techniques :
Softwaro Vulnorabilities
arethe
fundamental principles of programming
Use of like encapsulation,
modularity and
hiding.
information
most effective. Reviews,
reviews are Walkthrough and
inspection techniques
controlI program threats. can be
Seddto
HAzard
analysis gives systematic approach to identify
potential threats.
can be performed to minimize the
Testing flaws in the system.
It ensures correct
implementation and working of the program.
Good design
makes it easy for development and
Itesting.
Risk prediction :and mangement ensures easy risk management.
13.2
Buffer Overflow
It is also known as buffer overun. It deviates from a standard, where the process stores
an buffer overruns the buffer's boundary and overwrites adjacent memory locations.
uet overflow can be triggered by inputs that are designed to execute code or alter the way
Pgram operates. Bound check can prevent buffer overflow.
The languages are : C
and C++,
as it
which are commonly associated with buffer overflow
Ovides memory.
no built in protection against accessing or overwriting data in any part of
ffer overflow was intended to hold.
occur when a process tries to store data in buffer then it
Scanned by CamScanner
Software Vulnerabilities
13-14
? Crypt. & Sys. Security (MU-Sem. 6-Comp)
Shellcode
NOP-Sled
nononEN
nop relative jump
3.. Heap buffer overflow : In Buffer overflow, the overflow occurs when an applicadon
copies more data into buffer then the buffer was designed to contain.
The heap space 1S
dynamically allocated by new), malloc), calloc() dynamically allocated
in runtime.
Scanned by CamScanner
Security (MU--Sem. 6-Comp)
&Sys.
fCYpl 13-15
Software Vulnerabilities
Svllabus Topic :
SoftwareVulnerability
Format String
Format String Attacks
133
ntroductlon
The
format string attacks occur when the submitted
data of an input string
command by particular application. is evaluatcd as
a
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Software Vulnerabilities
13-16
%c. Character
Example 1
#include <stdio.h
void main
int i = 77:
a
char 'a';
Scanned by CamScanner
Security (MU-Sem. 6-Comp)
Cypt.&
Ss. 13-17 Software Vulnerabilities
Erample 2 an
programmer passes attacker-controlled buffer as
the argument to a
print£()
Tf the
attacker can perform and writes to arbitrary memory addresses. The following program
an error:
the
antains such
#include <stdio.h>
char buf[100]:
strncpy(buf, argv[1], 100):
printf(bu);
Scanned by CamScanner
P Cypt., & Sys, Securlty (MU-Som. 0-Comp)
13-18 Software
Vulnerates
If attacker pass %s into the printf) function which will fetch a number from the stort
Ireat this number as an address, and prints the memory contents pointed
by this addresa .
slring, until a NULL charncter (.e., number 0) is encountered.
In this cse whatever number fetched by the printf
function might not be the address. the
memory displayed by this numbcr might not exist because of such illegal
fetching of mernory
address the program willerash such type of attack is called as formát string attacks
Scanned by CamScanner
Security (MU-Sem..6-Comp) 13-19 Software Vulnerabilities
cypt.&Ss.
attacks based on XSS is almost limitless, but they commonly
include
variety of
The private data, like cookies or other session information, to the attacker,
transmitting
victim to. web content controlled by the attacker, or performing other
redirecting the
on the user's machine under the guise of
malicious
operations the vulnerable site.
Reflected XSS Attacks
Storedand
1341
generally be categorized into two categories : stored and reflected. There
attacks can
XSS
much less well-known
type of XSS attack called DOM Based XSS.
third,
ša Attacks
Stored XSS
1342
attacks are those where the injected script is permanently stored on the target
Stored
a database, in a message forum, visitor log, comment field, etc.
servers, sSuch as in
XSS terms,
of Cross-Site Scripting, which covers all these is a
vs. Client XSS, where DOM Based XSS
Dlored vs. Reflected XSS
and Server
subset of Client XSS.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-20 Software Vulnerabilities
content.
news item could
an attacker to modify a press release or
An XSS vulnerability allowing
consumer confidence.
a company's stock price or lessen
affect
dosage
site could allow an attacker to modify
An XSS vulnerability on pharmaceutical
a
Syllabus Topic
: SOQL Injection
injection attack
Q. 13.5.1 Explain briefly with example, how the SQL
Dec. 17,3 Marks
(Ref. sec. 13.5)
are inserted into
a source code injection technique in which malicious SOL statements
It is
content.
entry field of database to dump data base
where confidential data is stored.
Attacker targets the database organization
the database server stored in database table by
information from
Its main focus is to get
query.
malicious query since database can be accessible by
sending
the attacker sends is
user enters an additional database via web form,
When legitimate alwajs
same form field. The attackers before proceeding
own command through web
database has any loop is it vulnerable or not.
checks whether organization's
Scanned by CamScanner
cYpt. & Sys. Socurily (MU-Sem. 6-Comn)
13-21
Software Vulnerabilities
r Steps for SQL Injection
attacker
looks for login pages
The
() HTML commands like POST or
scarch pages or
feedback pages or
GET, pages that display
Atacker checks the source
(2) code of the web page
source. by right click on
web page and view
checks term <form> tag
(3) It everything
vulnerabilities, insides <form> tag
getting </form >have potential of
Chapter End..
Scanned by CamScanner
Lab Manual
Scanned by CamScanner
List of Experiments Experim
Imple
: RSAL
Alm
A Experiment 3: For varying message sizes, test integrity of message using encryption
using iptables..
Experiment 7: Setting up personal Firewall ..L-60
Scanned by CamScanner
using Java along know
scheme
in keys <o(n).
must
or
private
C++
signature
<e sender
algorithm
size. the
Digital public
=l Block formula.
addition,
Experiments
o(n))
generate
and RSA 1. java
= d'.
cryptosystem
(e, =
n given
gcd o(n)
and
In key the
mplement
can n.
decryption running
i.e. mod key the
we a#b. of
n) Encryption using
value
agorinm ed
RSA
is
where
to or n). obtain and
prime o(n)
know
of assignment {d, formula,
the
of b
compilation
analysis
KSA (b-1).
mod = = know
List and relatively
key e be must
P<nand
follows
a Plaintext, can
Using d=e the
key. numbeS private
this. *
PlaintextP key. receiver receiver
and using
decryption 1)
is
mplementation
Gamal.
language. as (a- e
that
where,
decryption
for
of workS
*b that,
n), ciphertext = version
1 prime such P and
= and
Experiment abiective
a (e, C=Ciphertext,
Calculate
key latest
objective
ypion
e out d java.io.*;
:
Solution
Select
Select Public Where,
jg: Find
P=C
DOth
ption
JDK
The
1
1 3 4 aiport Rport
5 !
1.
5.
algorithm...L-6
L-22
L-25
L-25 L-33
... L40 L47 .L-47
L50 .L53 .L-60
using **... ........
'stem isage
twO
thm
orithm
ions
..
Dols.
mal the tcp, ing
ge
Scanned by CamScanner
Crypt. & Sys. Security (MU-Som.,6-Comp)
L-2
public class Sample LabManual
{
longy,
ter
for(long i=4; i<phi; it+) Biglntege
{
if(a==1)
{
e=i;
i=phi; Biglntege
Biglntege=
retum e;
catch(Exx
long x=m, y=m;
Syetem.0
e=GCD(phi);
Teturn
ob
lor(long a=0;a<e-l;a+).
Scanned by CamScanner
(MU-Sem. 6-Compl
cMot. & Sys. Security L-3
A Lab Manui
x=x*y:
ene=x on;
return
enc;
Jong y,
temp=phi+l,x;
Biglnteger object2=null;
for(long i=l;i<phi; i+ +)
e)%phi) ==l)
d=i;
i=phi;
}
objectl =objectl.pow(int)d);
object2=objectl.mod(object3):
steh(Exceptiòn exception)
tum object2;
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) L-4 Lab Manua
try.
{
:
System.out.print("n Enter First Prime No ":
p=Integer.parselnt(in.readLine):
System.out.print("n Enter Second Prime No::
q=Integer.parselnt(in.readLine);
ene=Encryption(n,phi,m):
System.out.print("n Enerypt. :"+e);
KEY
catch(Exception exception)
iprogram name).
Scanned by CamScanner
6-Comp)
Sys. Secury (MO-Sem. L-5
A cot.
&
Lab Manui
Output
Files (x86)Vavaljdk1.7.0 25\bin>javac RSA
C:Program
13
Enter First Prime No:
Encrypt. KEY: 7
: 117
Encrypled DATA
Decrypt. KEY:103
Decrypted DATA: 13
Enerypt. KEY:5
Encrypted DATA:2
Decrypt. KEY
:5
Decrypted DATA : 11
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem.
6-Comp) L-6
LabManual
R= md P No.
3 Ramesh sends this R to suresh. Ms.
4. Suresh independently selects another secret large random integer numberb, and calculate Qty.
S such that.
S =
a
mod P
5, Suresh sends the number S to Ramesh.
6. Now Ramesh is calculating his secret key by using R=s mod P
Sx = R° mod P
as
= Ramesh and Suresh can agree for future communication
called k
8. If Rr Sy then
agreement algorithm.
proved. (K is called symmetric key).
9. We have Ry = Sx =Khence
Th
import java.util.*; Goods
onc
TIming:
java.math.Biglnteger; 1C
import
{
public class DiffieHellman
one new Biglnteger("1);
final static Biglnteger
Scanned by CamScanner
Security (MU-Sem. 6-Comp) L-7 Lab Manu
Sys.
WCopt.&
main(String arg•|) {
static voidI
publie
= new
Scanner stdin
Seanner(System.in);
Biglnteger P:
System.out.pprintln("Enterr
the first prime nunber p of your choice");
BigintegerKeyBCalculates = resulta.modPow(b,p);
test = test.add(one):
retum test;
Scanned by CamScanner
Cypt
J
Save above program by using DiffieHellman.java in JDK bin directory or set path before
Compilation. Now compile the program using javac DiffieHellman.java and run using java
DiffieHellman Expe
Output
CAProgram Files (a86)\Javaljdkl:7.0 25\bin>java DiffielHellman
Aim:Q
Enter the first prime number pof yourchoicel7 Objecti
Enter another prime number inq7
It
Ramesh: select your secrt number a.5 128- b
Ramesh can sends the value of R to Suresh 11, algorith
messag
Suresh select youryour secret mumber b3
Soluti
Suresh now sends value of S to Ramesh 3.
imp
im
Enter another prime number in qll
Ramesh: select your secret number a.5
is 14.
The Secret key Rk Ramesh calculates
power 3 mod 17
Suresh takes 10 raises to the
calculates is 14.
The secret Key Sk Suresh
Scanned by CamScanner
Secuiy
(MU-Sem, 6-o, L-9 Lab Manual
covpt. & SYs.
Experiment 3 :
For varying message sizes, test integrity of message using
MD-5, SHA-1, and analyse the performance of the two
protocols. Use crypt APIs.
program in Java to implement MD5 algorithmfor key
Experiment 3(a) : Write
generation and cipher verification,
program to implement MD5 algorithm for key generation and
Our aim
is to write java
Aim : cipher verification.
0bjective
Ron This algorithm takes an input of arbitrary length and
Rivest.
was developed by - bit
produced. The input message is producéd in 512
It blocks. This
- message digest is
128- bit - message digest is produced. The input
an input of arbitrary length and 128 bit
algorithm takes
-
512 - bit blocks. Following steps explains the procedure of MD5.
messagee is produced in
i
Solution :
algorithm.
Refer Chapter 6 for complete steps of MD5
Following Program Demonstrate the MD5 algorithm in details
import
java.io.ByteArraylnputStream;
import java.io.File;
inport java.io.FilelnputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
impont java.io.UnsupportedEncodingException;
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) L-10 Lab Manual
private static final int S23= 14;
for
private static final int S24 = 20;
private statie final int S3] = 4;
private static final int $32= ll: int
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp) L-11
Cypt. & Lab Manual
LabManual i
<buf.length: i-++)
or(int i
= 0; i
Oxt0) >>4:
(bul[i] &
h (bulJ &
OxOn:
intl=
sb.toString0:
retum
x, int y, int z)
nivate final int F(int
x, int y, int z)
private final int G(int
y, z)
private final int H(int x, int int
reburn
(x^y ^z);
x, int n)
private final introtate left(int
Scanned by CamScanner
Cypt: & Sys. Secuity (MU-Sem. 6-Comp) L-12 Lab Manua
a += (F(b, c, d) + x + ac);
a t= (G(b, c, d) + * t ac);
a=rotate left(a, s);
a
t= b;
retuim a;
private final int HH(int a, int b, int c, int d, int x, int s, int ac)
at (Hb, c, d) + x +ac);
a= rotate left(a, s);
a t= b;
return a;
private final int II(int a, int b, int c, int d, int x, int s, int ac)
a t= (Ib, c, d) + x + ac);
a= otate left(a,
le s):
a t= b;
retum a;
Scanned by CamScanner
LabManual A cypt. &
SYS.
Seouy(MU-Sem. 6-Comn) L-13
Lab Manual
inti=0:
= 0:
t
er (6j <len; it+.j += )
int a = state[0}:
int b = state[l];
int c = state[2|;
int d = state(3]:
int x] = new ini[16};
Roundi */
0xd76aa478); /% 1 */
a=FF(a, b, c, d, x[O], S11,
2
d= FFd, a, b, e, x[1], S12, Oxe&c7b756);/*
Ox242070db);/* 3 */
C= FFe, d, a, b, x[ S13,
2],
Oxclbdceee): /*4 */
b= FF(b, c, d, a, x[3], S14,
x[ 4),S11, Oxf57c0faf); /* 5 */
a FF(a, b, e, d,
Ox4787c62a),;/"6*/
FF(d, a, b, c, x[ 5], S12,
d=
a, S13, Oxa8304613);/*7 /
C= FF(e, d, b, x[6],
S14,
Oxfd469501); /"8
c,
d, a, x{ 7],
lb=FF(b,
Scanned by CamScanner
Crypt. & Sys.
Security (MU-Sem.
6-Comp)
L-14
a= FF(a, b,c, d, x{
81, SI1, 0x698098d8); LabManual
d= FF(d, a, b, c, x[9], S12, /*9 */
0x8b4417af):
c= FF(c, d, a, b, / 10 */
x[l0], S13, Oxffff5bbl);
/* 11*/
b= FF(b, c, d, a, x[l1], S14,
Ox895c7be); /*
a= FF(a, b, c, d, x[12], 12 */
S1l, Ox6lb901122); /*
13 */
d= FF(d, a, b, c, x[13], S12, Oxfd987193):
c= FF(c. d, a, b, x[14], S13, /* 14 */
Oxa679438e); /*
b= FF(b, c, d, a,x[15], S14, Ox49b40821): 15 */
/* 16 */
* Round 2 */
a = GG(a, b, c, d. x{
1], S21, 0xf6le2562);
/* 17 */
d= GG(d, a, b, c, x 6], S22, 0xe040b340);
/* 18 */
e= GG(c, d, a, b, x{ll], S23, Ox265e5a51); /* 19
b= GG(b, c, d, a, x[ O], S24,0xe9b6cTaa);
GG(a, b, c, d, x{ 5],
/* 20*/
$21, 0xd62f105d); /* 21
d=GG(d, a, b, e, x{10], S22, 0x2441453);
c= GG{c, a, /* 22 /
d, b, x{15], S23, Oxd8ale681);
/* 23 *
b= GG(b, c, d, a, x[ 4], S24, Oxe7d3fbc8);/ 24
a= GG(a, b, c, d, x{ 91, S21, 0x21elcde6); */
/*25*/
d= GG(d, a, b, c, x{14], S22, Oxc33707d6);
c= GG{e, /* 26 */
d, a, b, x{ 3], S23, Oxf4d50d87);
27 )
b= GG(b, c, d, a, x[81, S24, Ox455al4ed);
a= GG(a, b, c, d,x{13], S21, Oxa9e3e905); /*28*
*/ /* 29
d= GG(d, a, b, c, x[ 21, S22, Oxfcefa3f8);
30 *
c= GG(c, d, a, b, x[ 7],
$23, Ox676f02d9); 31 *7
b= GG(b, c, d, a, x[12], S24, Ox8d2a4c8a);
/* 32*
8 Round3*)
a = HH{a, b, c, d,
x[ 5], S31, 0xffa3942): /%
33 */
d= HH(d, a, b, c, x{ 8], S32, 0Ox8771f681l);
/*34 */
c= HH(c, d, a, b, x[l1], S33, Oxód9d6122):
/* 35 *|
b= HH(b, c, d, a, x[14|, S34, 0xfde5380c); /* 36
*/
a= HH(a, b, e, d, x{ 1), S31, Oxatbeea44);
/* 37 *)
d= HH(d, a, b, c, x{ 41, S32, Ox4bdecfa9); /* 38 *)
Scanned by CamScanner
LabManual & Sys. Security (MU-Sem. 6-Comp)
fcypt. L-15
HH(c, d, a, b, x( 7], S33,,Oxfbb4b60): Lab Manual
HH , c, d. a,
/*39
xl0), S34, Oxbebfbc70): /* 40 )
. HH(a, b, c, d, x|13|. S81, Ox289b7ec6);
/* 41 /
a, c,
-HHd, b, x[ 0J, $32, Oxeaal27fa); /* 42 */
HHC, d, a, b, x[ 3], S33, Oxd4ef3085):
/*43 */
c, a,
b= HH(b, d, x6J, S34, 0x4881d05); /* 44 */
,= HH(4. b, c, d, x[ 9), S31, Oxd9d4d039): /* 45 %/
d= HH(d., a, b, c, x[12), S32, 0xe6db99e5): /* 46 *|
e= HH(e, d, a, b, x|15]. S33, Oxlfa27cf8): /* 47
/
þ= HHb, c, d, a, x[ 2, S34, Oxc4ac5665); /* 48 */
Round 4
*/
a= II(a, b, c, d, x[ O], S41, Oxf4292244); /%
49 */
d= Id, a, b, c, x[ 7], S42, Ox432aff97);
/* 50 /
C= Ic, d, a, b, x[14), S43, Oxab9423a7); /* 51 */
b= II(b, c, d, a, x[ 5], S44, Oxfe93a039); /* 52*/
a= II{a, b, c, d, x[12], S41, Ox655b59c3);
/* 53 */
d= II(d, a, b, c, x[ 3], S42, Ox8fOccc92); /*
54*/
c= IIe, d, a, b, x[10], S43, Oxffeff47d);
/* 55 */
b= I(b, c, d, a, x{ 1), S44, Ox85845ddl); /* */
56
a= II(a, b, c, d, x[ 81, S41, Oxófa87e4):/*
57 */
d=IIfd, a, b, c, x[15], S42, Oxfe2cebe0);
/* 58 */
c= II(c, d, a, b, xf6], $43, Oxa3014314); /* 59 */
b= II(b, c, d, a, x{13], S44, Ox4e081lal);
a= IIa, b, c, d, x[ 4], S41, Oxf7537e82); /*60/
/%61*/
a,
d= II(d, b, x[l I], S42, Oxbd3af235);/* 62 */
c,
e= II(c, d, a, b, x 21, S43, Ox2ad7d2bb); T
63 */
b= II(b, c, d, a, x{ 9), S44, Oxeb86d391); /* 64 */
state(0] + = aj
slate[1] += b;
state[2 += c;
slate|3] += d;
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
L-16
LabManual
count +
(len<< 3);
int partLen = 64- index;
int i = 0; prik
else
i=0;
update(padding, padlen);
Scanned by CamScanner
& Sys. Security (MU-Sem. 6-Comp)
LabManual Cypt. L-17
Lab Manual
bdate(bits, 8):
encode(state, l6):
eturn
it+,j +=
4)
for
(5j <len;
& 0xff):
outputj] (yte) (input[])
wutputlj + 1]= (byte) (input[i] >>8) &
Ox);
outputi + 21 = (byte) (inputfi] >> 16) & 0xf):
atputj +.3] = (byte) (input[i] >> 24) & Oxff);
retun output;
This method constructs the input stream diges, and return it, as a
a String, following the MD5 (fe1321) algorithm,.
input stream.
hrowsIOException
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp)
L-18
gages Lab Man
byte bufferl] = new byte[BUFFER_SIZEJ:
int got =
-l;
if (digest != null)
return digest;
while ((got = in.read(buffer)) > 0)
update(buffer, got);
this.digest end):
return digest;
if (stringp)
throw new RuntimeException
(this.get Class()-getName)
+ "processString]"
+ " not a string.");
try
returmgetDigest);
}catch ([OException ex)
f
Scanned by CamScanner
Security(MU-Sem. 6-Comp) L-19 Lab Manual
fCoypt. &. Sys.
as a proper string.
Get the digest,
*
getStringDigest)
publie.String
= null)
if(digest
w new RuntimeExceplion (this.getClass()-getName(0
+ "IgetStringDigest"
+": called before processing."):
stringify(diges);
return
byte
bytes[=null;
try
bytes = input.getBytes(enc);
} catch (UnsupportedEncodingException
e)
this.stringp = true;
Scanned by CamScanner
Cypt. &
Sys. Security (MU-Sem. 6-Comp)
L-20
Lab Manual
state[(0] = 0x67452301;
state[1] = Oxefcdab89;
state[2] = Ox98badcfe:
state[3] = Ox10325476;
this(input, "UTF8");
/**
* Construct a digestifier for
the given input stream.
* @param in The
input stream to be digestified.
this.stringp = false;
this.in = in;
this.state = new int[4];
this. buffer new byte[64]:
this.count = 0;
state[0] = Ox67452301;
state(1] = Oxefedab89;
state[2] = Ox98badcfe;
state[3] = Ox10325476;
Scanned by CamScanner
Sys. Security (MU-Sem.
(
6-Comp) L-21
rCOpt &
Lab Manual roidimain(String args) Lab Manual
gsOEeeption
Alengthh != 1)
ast.out.println"Md5 <file>):
isteexi(l);
se H] = md5.getDigest (0:
Seem.out.println(stringify(b):
lo get correct output please create one text file (Give any name
to that text file here I have created one text
ile bl.txi text provide in bl.txt is Cryptography as an input to MD5
& System Security)
algorithm .
&
System Security
&
produce the digest as
the text Cryptography
encrypt
(36302dca512627086453563f66198a
Scanned by CamScanner
Crypt. & Sys. Security
(MU-Sem. 6-Comp) L-22
Experiment 3(b): tHanual Lab
Write program
a
in Java to implement SHA-1
using Libraries (API). algorithm
b
Objective
Aim of this assignment
is to implement Secure
Refer Chapter 6 for theory
Hash Algorithm - 1
using Librarie (ADr
of SHA-I
Solution:
import javax.crypto.*;
import javà.io.*:
import java.security.*;
public-class SHA
String Message=null;
try
catch(Exception exception)
return Message;
}
MessageDigest digestl=MessageDigest.getinstance("'SHA-1"):
digestl.update(Message.getBytes0);
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
Cp. & L-23
Lab Manual
Lab Manual i valuedigest1.digest0;
biell
A-1 Mac mac=Mac.getlnstance("HmacMD5"):
algorithm
escinil(key);
pac.update(value):
ibrarie (nac.ddoFinal):
(API).
SringBuller
- buffer=new StringBuffer():
+ +)
siat i=0;í<digest.length;i
Oxff:
int valuel
=digest[i] &
ialuel< 1l6)
{
buffer.append(0);
buller.append([nteger.toHexString(valuel);
store =buffer.toString);
catch(Exception exception)
+.
System.out.print("n Exception :" exception);
retum stores
}
String Message,holderl,holder2;
try
generator=KeyGenerator.getinstance('AES");
KeyGenerator
generator.init(128);
SecretKey
key=generator.generateKey0;
Message=Getdata):
=Compute(Message,key);
bolderl +"1);:
Digestl : [" holderl
System.out.print(n Message
Scanned by CamScanner
| Crypt. & Sys. Security
(MU-Sem. 6-Comp)
L-24 Lab Manual
Message = Getdata0:
holder2=Compute(Message,key}:
System.out.print("n Message Digest2 :
if(holderl.equals(holder2)
"+ holder2 +
"J:
{
else
catch(Exception exception)
{
Output
C:Program Files (x86)UavaljdkI.7.0 25\bin>javac
SHA.java
It will two note but students can run
it
Scanned by CamScanner
(MU-Sem. 6-Comp)
Sys. Security L-25
Lab Manual
Ferzt &
Same..
Not
Lab Manual
els
same message
Runit again
with
gle & i
(x86)Uavajdkl.7.0
I _25bin> javac SHA.java
Aaram
Flles
Files
(x86)Javaljdkl.7.0_ _25\bin>java SHA
fgram
Digestl : elbO6lca3fc6017ob18799dallfMb0061]
fsge
Jessage
Digest2 : felb06lca3fc6017obl8799dalbO06)
Msge Is Same.
Keen in mind that for every old/new
message SHA-1 always generates new message
gest
c SHA.java -
Study of packet sniffer tools wireshark
:
4
Experiment
wireshark and capture icmp, tep, and
Experiment 4(a) : Download and install
mode.
http packets in promiscuous sure that packet
a packet analyzer & capture the network traffic. Make
Aim : To install networks, it cannot detect
captures the live packets from different
analyzer only was done by using intrusion
malicious or not. This detection
whether the packet is Students can
IDS in experiment number 9. The
discuss
detection system (IDS), will Wireshark as it is freely
available
have selected
Select any packet analyzer tool hereI
on Internet.
Oljective capture
analyzer will try to
analyzer. A network packet think of
Wreshark is a network
packet
detailed as possible. You could
data as on inside a
tries to display that packet examine what's going
A packets and
measuring device used to what's going
on inside
anetwork as a examine
packet analyzer an electrician to
Atwork voltmeter is used by
cable, Just likea
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Lab Manual
L-26
an electrIC cable (but at a higher level, of coursc). In the past, such tools were cither very
expensive, proprietary, or both. However, with the advent of Wireshark, all that has changed.
Wireshark is perhaps one of the best open source packet analyzers available today.
:
Solution
A brief history of WIreshark
In late 1997, Gerald Combs needed a tool for tracking down
networking problems and
former name of
wanted to learn more about networking, so he started writing Ethercal (the
the Wireshark project) as a way to solve both problems.
Ethereal was initially released, after several
pauses in development, in July 1998 as
In late 1998, Richard Sharpe, who was giving TCPIP courses, saw its potential on such
courses, and started looking at it to see if it supported the protocòls he needed. While it
didn't at that point, new protocols could be easily added. So he started contributing
dissectors and contributing patches.
The list of people who have contributed to the project has become very long since then,
and almost all of them started with a protocol that they needed that Wireshark or Ethereal
did not already handle. So they copied an existing dissector and contributed the code back
to the team.
In 2006 the project moved house and re-emerged under a new name: Wireshark.
In 2008, after ten years of development, Wireshark finally arrived at version 1.0. This
release was the first deemed complete, with the minimum features implemented. Its
release coincided with the first Wireshark Developer and User Conference, called
SharkFest.
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
L-27
fCypt. &
Lab Manual
useittto learn network protocol internals.
Lab Manual People
Beside these
examples, Wireshark can be
ols were helpful in many
either very other situations
too.
all that has
changed. Fastures
today.
are, some of the many features Wireshark
following provides
e :
Available UNIX and Windows,
Thhe
World's Most Popular Network Protocol Analyze
WRESHARK
since then,
Fiks
or Ethereal Webslte
rls be used farcaghngh Pa Open
Op dealy pun
the curent conlyuatinn.
ttvth
code back SeCaçhun Heb balbe for detos. Opon Racent:
Users Gulde
Sample Captures a
Searity
Scanned by CamScanner
9Crypt. & Sys. Security (MU-Sem. 6-Comp) L-28 Lab Manual
fo
Wireshark Maln Window
Capture option dialog box
The
Wireshark: Capture Options
Capkure
Irtarfoce: Loca v b57naz Droadzonm icttrene Gigobt Ethermct Drver:'Devicci
Padtess: 10,120.83.75
Link-layer header type: Ethernet v
Cate packets n proriscuous made Re
tue packets in prap-ng fuTnat (experinental)
Buffer size:
1
mesabrtes)
D
init ceh psket to bytes
Captura Fltor: Ccnpis EFF
Capture Hla(+) DEplay optlons
Fia: Browsa..
Updake lst of packets in re tns
D
Use ndtipe fies
M Automahc scroling in live capture
Natne REScutlon
¢rteis)
Enabie MAC nameresokten
Stop Capbure.
.. aftber
Capturing live network data is one of the major fcatures of Wireshark. The Wireshark
:
capture engine provides the following features
Capture from different kinds of network hardware (Ethernet, Token Ring, ATM, ..).
Stop the capture on different triggers like: amount of captured data, captured time,
captured number of packets.
Smultaneously show decoded packets while Wireshark keeps on capturing.
Filter packets, reducing the amount of data to be captured.
Scanned by CamScanner
(MU-Sem. 6-Comp)
Security ( L-29 Lab Manual
Sys. S
&
Frt multiple files while doing a long term capture, and in addition the option to
Lab Manual (turinginto
bufter these files, keeping only the last x files, useful for a "very long term"
Arna ring
une.
pture engine still
lacks the following features
Simultancous capturing
from multiple network interfaces (however, you can start multiple
merge capture files later).
of Wireshark and
instances
DNer: (Device\\F capturing (or doing some other action), depending on the captured data.
Sop
Interface
Capture
10te
Options
Awireshark: Capture
Cazture
-Ccmpio EPF adapter 'Intel 8255x-based Integrated Fest Etherr
harfare: 192.166.21.102 vNetwork
192.163.21.102
Paddress:
Remote Settings
packets n real tme
Buffer stze: }1 megabyte{s)
promiscuous mode
ling in live capture JCapture packets in
pcap-ng format (experimental)
DCapture packets in
fo
dalog D Limt each packet to bytes
Cepture Fiter:
Display Options
eresolton Capture Fies) real tine
Browse.. DUbdate list of packets in
ame resoLban Fle:
scrolingin Ive capture
OUsa mut'ple fies D Automatic
ante resokbon
capture info dalog
D Hde
Sance
Name Resolution
name resolution
VEnable MAC
... nameresouticn
The Wireshark Stop Capture Enable retwork
resolution
D.. after
transport name
...). .. after
vEnable
..
TM,
Cancel
fter
ptured time, Qart
Help
Scanned by CamScanner
CYPt
Crypt. & Sys. Security
(MU-Sem. 6-Comp)
L-30 Lab Manual So
Live capture from many Open
different network medla Wire
Wireshark can capture traffic from many differcnt Publ
network media types - and despite its
name -including wireless LAN as
well. Which media types are supported,
things like the operating systcm you depends on many like,
are using. free
Import files from many other capture programs
Bec
Wireshark can opcn packets captured from a large number of other capturc programs.
For plu
a list of input formats.
Develc
Export files for many other capture programs
W
Wireshark can save packets captured in a large number of formats of other capture m
programs. For a list of output formats. W
Capturing Packets
t
est.cap
Ce tdt en Go Cepture Anayze
2ists Tdephony Ioob temas teb
vEspresson
N Scurce Destinstion Proocol Ldth Lnto
o.c00000 192.168, o.3 Br padcast ARP 42 Gratu1tous ARP tor 192.163.0.2 (FE
2 0.29g39 192.63.0. 192.168. 0.2 NBNS 92 Nare query NBSTAT 00000c
4 1.025659 192.13.0.2 224.0, 0. 22
IGMP S4 v3 Menbers hip Report Jo1n qra
31.04A366 192.169.0.2 192.168.0.1 110 Standard query SRv_idap.tcp.r
61.048552 192.168. 0.2 239.255.255.250 SSUP 175 N-SEARCH HTTPAI.1
71.050784 192.168.0.2 192.168.0.1 DNS 86 5tandard query sOR nbl0061d, O4
S1.055053 192.1E3,0.1 192.168.0.2 550P 337 HTTP/2.1 200 Ox
91.c32028 192.168,0.2 192.168. 0.255 NBNS 110 Regi:trati on NB NE1306<0>
101,111945 192.168.0.2 192.168.0.1 DNS 87 standard query A graxyccnf..
111.22€156 L921258.0.2 192.1638.0,1 62
ncu-2 http (5YNI StN524
12 1, 227252 L92.288.0.1 192.168.0.2 TCS 60 hrtp > ncu-2 SVN, ACK] Scg-0 ck
Fraze 11: 62 byes on wire (496 bits), 62 bytes cagtured (496 bits)
Ethernet II, Src: 192.168. D. 2 (00:03:5d:20:cd:02), Dst: Netgesr_2d:75:91 (0):09:5b:2d:75:9a)
Internet Protocol, Src: 192.168. 0. 2 (192.168.0.2), DSt 192.168. 0.1 (192.163. 0.1)
Trrsiss1on cotral Prot oco1, Sre Porti ncu-2 (3L96), DStPort: http (S0),SQ ,Leni
SGurc port: ncu-2 (3196)
DEStira:f on port: hrp (80)
eara
fSTr 1rdes: 5]
Seguerce rutber: 0 (relat iue sequence nunher)
Header lergth: 28 bytes
=Flags X02 (5YD
windon size value: 64240
c
0000 00 09 5b 2d 75 3d 00 Db Sd 20
9a oD 02 OB 00 45 00 E.
020 G0 o
be Te o 50 3c 36 95 F8 03 DO 00 00 70 02
o030 Fa f 27 e0 00 00 02 04 05 bå oi 1 04 02
Scanned by CamScanner
.Security (MU-Sem. 6-Comp) L-31
Lab Manual
LabManual Software
Source
source software projcct,
#reshark is an open and is relcascd under the GNU General
and despite License (GPL). You can frccly use Wireshark on any
its number of computers you
-ends on worrying about liccnse keys or fees or such. In addition, all source
many ie without code is
available under the GPL
ntr
Bause of that, it is very casy for people to add new protocols to Wireshark, cither as
or buitt into the source, and they often do.
rograms. phgins,
For
elopment. and malntenance of Wireshark
was
Wireshark initially developed by Gerald Combs. Ongoing development and
paintenance of Wireshark is handled by
the Wireshark team, a loose group of individuals
ber capture
bugs and provide new functionality.
sho fix
Tre have also been a arge number of people who have contributed protocol dissectors
n Wireshark, and it is expected that this will continue.
Vou can find a list of the people who have contributed code to Wireshark by checking the
hout dialog box of Wireshark, or at the authors page on the Wireshark web site.
Wireshark is an open source software project, and is released under the GNU General
are
Public License (GPL). All source code is freely available under the GPL. You
you
grauc selcome to modify Wireshark to suit your own deeds, and it would be appreciated if
contribute your improvements back to the Wireshark team.
P.
nb
to community:
You gain three benefits by contributing your improvements back the
04:
5424 Other people who find your contributions useful will
appreciate them, and you will know
ACk
that you have helped people in the
same way that the developers of Wireshark have helped
people.
your changes even more, as there's always
- The developers of Wireshark might improve your
may implement some advanced things on top of
room for improvement. Or they
code, which can be useful for yourself
too.
fixing it
Wireshark will maintain your code as well,
The maintainers and developers of with what
are made, and generally keeping it in tune
When API changes
or other changes done often). you
can
updated (which is
Wireshark. So if Wireshark is included
IS happening with
website and your changes will already be
get a new Wireshark
version from the
without any effort for
you.
Scanned by CamScanner
Crypt. & Sys. Security
(MU-Sem. 6-Comp)
L-32 Lab Manual
Crl + Up, F7 Move to the previous packet, even if the packet list isn't focused.
Ctrl+. Move to the next packet of the conversation (TCP, UDP or IP)
Ctrl+, Move to the previous packet of the conversation (TCP, UDP or P)
Left In the packet detail, closes the selected tree item. If it's already closed,
jumps to the parent node.
Return, Enter In the packet detail, toggles the selected tree item.
Conclusion
Thus we have studied a network packet analyzer i.e the Wireshark.
Scanned by CamScanner
Lab Manual
Sys. Security(MU-Sem. 6-Comp) L-33
cOpt &
can be traced based on
Experiment 4(b): Explore how the packets different
filters.
to download
&
install freely available vulnerability tool
Aim of this experiment is
any vulnerability in the network or not.
scanthe entire network and find
to
$olutlon:
Nessus
computer, Nessus is a proprietary comprehensive vulnerability scanning program. It is
In
vulher
abilities on the tested systems.
For example
Vnerabilities that allow a remote cracker to control or access sensitive data on a system.
Scanned by CamScanner
Securit
Cypt. & Sys.
Crypt. & Sys. Security (MU-Sem.
6-Comp) L-34
Lab Manual eng
3
Operation of Nessus The Nessus
scanner for the ab
In typical operation, Nessus begins by doing a port scan configuration stanc
with one of its four intcrnal ne
Scanners (or it can optionally use AmaporNmap) to patch
detcrmine which ports arc open on the checks and
target and then tries various exploits on the open ports. Nessus to
perform
The vulnerability tests, available a
subscriptions, are written in NASL (Nessus Attack Scripting
Language), a scripting and many other ty
language optimized for custom network interaction. of2008, T
In July
Tenable Network Security produces several dozen new vulnerability checks access
(called users full
plugins) each week, usually on a daily basis. These checks are available for free to the eng
The Nessus 2
general public; commercial customers are not allowed to use this Home Feed any more source projects ba
The Professional Feed (which is not free) also give access to support and additional scripts
Tenable Networ
(audit and compliance tests...).
several times sin
Optionally, the results of the scan can be reported in various formats, such as plain text.
and Windows s
XML, HTML and LaTeX. The results can also be saved in a knowledge base for
need for an ager
debugging. On UNIX, Scanning can be automated through the use of a command-line
Nessus 4.0.0.
client. There exist many different commercial, free and open source tools for both UNX
and Windows to manage individual or distributed Nessus scanners. If the user chooses to lemble eus Vatncrahy Sce
do so (by disabling the option 'safe checks), some of Nessus's vulnerability tests may try
NESSUS)
to cause vulnerable services or. operating systems to crash. This lets a user test the NoseS Watco
resistance of a device before putting it in production. Nessus provides additional welcoma
Start Scan Task
B Yau can
ve Reports
functionality byond testing for known network vulnerabilities. This sg
other ptions
t adaess Book
For instance, it can use Windows credentials to examine patch levels on computers
running the Windows operating system, and can perform password auditing using
pdate Fugns
See Also
dictionary and brute force methods. Nessus 3 and later çan also audit systems to make sure Heto
Abst Nessus
they have been configured per a specific policy, such as the NSA's guide for hardening
WindowS servers.
The "Nessus" Project was started by Renaud Deraison in 1998 to provide to the Interne
community a free remote security scanner. On October 5, 2005, Tenable Netwrk
3 to a proprietary
Security, the company Renaud Deraison co-founded, changed Nessus
(closed source) license.
Scanned by CamScanner
(MU-Sem.
6-core
L-35 Lab Manual
Secuny
&SYS.
#ogt.
of charge, though Tenable charges $100/month per
engine is still free
3
Nessus
configuration audits for PCI, CIS, FDCC and other
The
the ability to perform
scanner for vulnerability audits, the latest network
sstandards, technical support, SCADA
contiguration
audit anti-virus configurations and the ability for
patch audits, the ability to
checks and data searches to look for credit card, social security number
perform sensitive
Nessus to corporate data.
ypes of
and many other
Nessus 4.0.0.
Seanne
ad tes Vidahsy
hessus
NESSUS
ry Sstorner a
vunersbkles, ide varletyof
Welkore t tiettus Vuinerabil dhecbs fot thoutands of themost commonly updated
Aiesa s (easdte ntau use
a whh nhules hgh peed
atetve regntna
W
Me Reparte".
sarng tens, pn rto rde yo can open thern again by slecting
selectng art Scan Task", Al ecan rests wd be automatixaly saved, and
You tan tart a new BLan by
Mease congider regiterng
A swepts The arver has nct been tordasede phagns updates
Dtber outun
vew eptts
See Aho
ep
Netfut
Main Window
Fig. 1 : Nessus
Scanned by CamScanner
Cryp. & Sys. Security (MU-Sem.
6-Comp) L-36 Lab Manual
NISSUS
Manase Poltctes
Weerty used poleleg an be mnpoed here. You ean eatet e
redetoed poe when starting new s
kepote ell
Ad a new pecv X
Delete seletted polev(0)
oher optone
AsPaok
pe seroya
Segt Penpt
Scanned by CamScanner
Security (MU-Sem. 6-Comp) L-37
& Sys.
Lab Manu
Lab Mnual
SSL
Nessus Client
Nessus Server
Target Systems
Fig. 3: Nessus Architecture
sLonsisle
vulnerabilities.
twork DGX
Sccool
Scen
stsrted2tnon
Conmecon
koal
utorid
55 pluginsloe
dsprelerencer
suppertedt
Scon trished
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) L-38 Lab Manual
Nessus Server
Runs on most Unixflavors (Unix, Linux, *BSD).
Ifind it uns best on Linux, your mileage
may vary.
to
Performs all scanning functions, sends results back client.
Includes a plugin update facility.
Nessus Reports
Numerous different formats.
Scanning Methodologies
Someone scans your system(s) and makes the report available to you.
The end user requests a scan directly from the server, the machine is scanned, and report is
sent automatically.
When the user connects to the network the system is scanned automatically (Popular with
wireless and VPN).
Servers are scanned on a regular basis (maybe weekly) and results are compared.
Network Perimeter is scanned on a regular basis.
Which ones should Ido.
Scanned by CamScanner
6-Compl
Wnt & Sys. Secui (MO-Sem. L-39
Lab Manual
worst
Preparefor
the
Lab Manual
challenges What about
the appllcatlon
some application level vulnerability assessment.
Nessus does
SPI Dynamics, EEye, and ISS are better.
Tools from
permission to scan
is
Getting
half the battle.
it will not
guaranteethat crash the system.
i no
Theree is
2
challenges- How long will it take
Depends.
Number of hosts.
Scanned by CamScanner
9 Cypt. & Sys. Security (MU-Sem. 6-Comp) L-40 Lab Marual
What Is NMAP?
N-MAP features
Ping Sweeping : ldentifying computers on a network.
Port Scanning: Enumerating the open Ports on one or more
target computers.
OS Detection : Remotely determining the operating system and some hardware
characteristics of network devices.
Ping Sweeping
Source
192.168.0.8 Destination
192.168.0.10
Scanned by CamScanner
Security (MU-Sem. 6-Comp)
L41
Allve ?
Hostis Lab Manual
t NsPOnse from an active host will return
A an ICMP
ANavailatble on the network or echoreply, unless
1CMP is filtered. the IP address is
Souroe
192.163.0.8 Destinaton
192.1880.10
Port Scanning is the process of connecting
to TCP and UDP port
Ending which services for the purpose of
and applications are open on the
Target Machine.
establishes a connection
P
by using what is called a Three way
header contains one byte field handshake. The TCP
for the flags.
These flags include the following:
ACK:The receiver will send an Ack to acknowledge
data.
o SYN :Setup to begin communication on
initial sequence number.
o FIN: Inform the other host that the sender has no more
data to send.
o RST: Abort operation.
o PSH :Force data delivery without waiting for buffers to fill.
o URG : Indicate priority data.
The port numbers are unique only within a computer system.
Port numbers are 16-bit
unsigned numbers. The port numbers are divided into three ranges: the Well Known Ports
(0-1023), the Registered Ports (1024-49151), and the Dynamic and/or Private Ports
(49152-65535).
All the operating systems now honor the tradition of permitting only the super-user open
the ports numbered 0 to 1023.
Scanned by CamScanner
Cryp
Crypt. &
Sys. Security (MU-Sem.
6-Comp) L-42 Lab Manual
NMAP s
ssh 22/tcp SSH Remote Login Protocol
sanaal
telnet 23/tcp Telnet [sudo]
domain 53/udp Domain Namc Server Readin
BUildi
www-http 80/tcp World Wide Web HTTP Readi
Nmap ("Network Mapper") is a free and open source utility for network exploration or The fC
libe
security auditing. Sugge
The FIVE port states recognized by Nmap such as : lib
The f
1. Closed 2 Filtered 3
UnFiltered lib
4. Open-Filtered 5. Closed-Filter O upc
Need
1. Download Nmap from www.nmap.org and install the Nmap Software with WinPcan Afte
Driver utility.
2 Execute the Nmap-Zenmap GU tool from Program Menu or Desktop Icon.
3. Type the Target Machine IP Address(i.e. Guest OS or any website Address) SCan
Comm
Scan Type Switch Description
TCP connect() -sT Opens a connection to every potentially interesting port on
Scan the target machine.
TCP SYN scan -sS This is a "half-open" scan.
TCP FIN -sF This scan attempts to pass through packet filters by sending a
TCP FIN packet.
Xmas Tree -sX Sends a packet with FIN, URG and push flags set.
ACK scan -SA An ACK packet with random acknowledgment and sequence
numbers is sent.
UDP scan -sU This sends 0 byte UDP packets to each port on the target
machine(s).
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Comp)
fCrypt. & L-43
Zenmap
Flter Hosts
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem, 6-Comp) Lab Manual
L-44
Hosts Services Nmap Output Ports / Hosts Topology Host Details Scans
FILE *ps;
structhostent *h;
time tcurtime;
Scanned by CamScanner
Sys. S Security
(MU-Sem..6-Comp) L-45
&
Lab Manual
loctime
struct tm
Lab Manual
char "t;
fopen("ete/bbb/portscan.txt", "w"):
Scan (NULL):
Cancel time
tine = localtimei(&eutimo):
Details asctime
(loctime):
Scans|
ersion fprintfps,"
sttpd 2.0.1 fprintfips,"MnPort Scan Results : %s",):
pensSH forintf(ps,"nFollowing ports are open:n"):
3.9p1 (
ndmail 8.13.1/E
ache httpd 2.0 = NULL)
i=gethostbyname(argv[1))
pratf(Gethostbynameká error!!"):
exit(1);
structsockaddr inaddr;
printf("Socket ka error!!");
exit(1);
}
i=0;
while(1)
addr.sin zeroli]=0;
Scanned by CamScanner
Lab Manue
Grypt. &
Sys. Security (MU-Sem. 6-Comp). L-46
if(i>8)
break;
}
*)
&addr, sizeof(structsockaddr)) = -1)
if (connect(sock, (structsockaddr
close(sock):
else
fprintf(ps,"nfod "port);
close(sock);
}
fprintf(ps,"n**************** ***********n):
fclose(ps);
Output
root@localhost]# cc port_scan.c
[root@localhost]# Ja.outlocalhost
22 open
25 open
11l open
631 open
5335 open
32769 open
[root@localhos! #
Scanned by CamScanner
.
Sys. Security (MU-Sem. 6-Comp) L-47
rCoSL&
Lab Manual
Lab Manual Simulate DOS attack
xperiment 6 : using Hping, hping3
This can be done In and other toois.
two ways one Is
another using IDS tool, using hping3 tool and
stion: means
Denial service attack
of making the network unavailable for
the user
ommunicate securcly.
to
attack attempt to shut down the network, computer services and deny the use of
sources or services to authorized users.
Once attacker got entire access of network or server he can do the following
things :
Hood the entire network or server with traffic until shutdown occurs because
of
overload.
o Block ongoing traffic which results in a loss of access to network resources to the
authorized users. Different security policies like firewall, Intrusion detection system
helps to protect such type of attacks.
o Different security policies like firewall, Intrusion detection system helps to protect
such type of attacks.
What is hping3 ?
protocol. Hping is one of the
hping3 is a free packet generator and analyzer for the TCP/IP
and networks, and was used
to
de-facto tools for security auditing and testing of firewalls
now implemented in the Nmap port scanner.
exploit the Idle Scan scanning technique
implements an
The new version of hping, hping3, is
scriptable using the Tcl language and
so that the
human readable description of TCP/P packets,
engine for string based, manipulation and
related to low level TCP/IP packet
Prögrammer can write scripts
analysis in a very short time.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) L-48 Lab Manual
Perform the idle scan (now implemented in nmap with an casy user interface).
Scanned by CamScanner
&
Sys. Security (MU-Sem. 6-Comp) L-49
oo
Lab Manual rand-source :
Using Random Source
= Lab Manual
er interface). IP Addresses.
You can also
hostnames. See MAN page below. use
hide -a or -spoof
gww.hping3testsite.com =
to
Destination IP address or
website name target machines
use a here. In my case resolves IP address. You can
lso to 127.0.0.1
(as cntered
in letchosts file)
command to DoS using hping3 and nping
ple
–
Simple. SYN flood DoS using HPING3
nglo,
addr: 127.0.0.l, MTU: 65536
www.hping3testsite.com do 127.0.0.1): S set, 40 headers + 0 data bytes
flood mode, no replies will
tbe shownC
ce
çomplex TCP/IP
oing in -.
w.hping3testsite,com hping statistic
ping done: 1
IP address pinged in 3.09 seconds
Santoshdarade:# attack using
hping3.
DOS
to simulate
Conclusion: Hence we have studied how
ncoming
Scanned by CamScanner
Cypt
Crypt. & Sys.
Security(MU-Sem.
6-Comp) win
L-50 Main
Experiment 6(b): DoS Lab Manual
attack
Aim : To install intrusion systenm detection using Intrusion Detection System.
and detect whether any Delecom
by capturing the live network malicious activitics detected or
packets, JDS detect IP Spoofing not
of service attacks. (fake IP address), Denial
Objective
"An Intrusion Detection System jis
systems or networks, analyzing software that monitors the events OCcur in a computer
what happens during an execution
indications that the computer has and tries to find out
been misused- in order to achieve
integrity and availability confidentiality, nte
Trafflc ourve
stan
Scanned by CamScanner
(MU-sem. 6-Comp)
L-51
Cvpt. & Sys. Security Lab Manual
Toos Vew
DaSettg
odes bplerer Ana GGener Adater
NIC ("rod's Pshe Stedter)
Restek 10/100/1000 Dhernet
tanet
Local
9teme
op 10 Everks f
rtreet
oo 10 Everts of Irteet
Ever
Trafl
w
the tete of Sez.
Ready
Scanned by CamScanner
Lab Manua
Crypt. & Sys. Security (MU-Sem. 6-Comp) L-52
Cplre
o11 09:4137
Setting P&)ping 192.168.J0.22
P Endpoint C:ADocunentt and C0:00:46
8A Inranet 32 byte of data.
Pinying 192.168.35.22 with
ü Local bytes -32 tine1ns ITLe128
Intermet e
ly Emn 192.168.39.22: tíneslfns TTL128
Reply fron IY1b8 32 tinin ITL=128 ts of Intranet
Reply fron 7A.228 bytes s% tine<ls ITL:128
Rely froa 192.1
Piny for 192.168.38.22:
statistics Received 4. lost
B (B
loss).
Sent 4,
ts of Internet
tacke trin tines in nilliseconds:
Bns
Mini Bos, Nax inuri Dns, Averaye
Traffic Curve
10.582 KB/s
11:3
c Sav2.
Votheste
ReBdy
Jstarn
Scanned by CamScanner
Sys. SSecurity (MU-Sem. 6-Comp) L-53
CYpt &
ardeee, it Deteco
Seart nelesgbee
/Dashboard Everty Corversations Looy
A1.9-.t*
IP1 Parti
Pndoht
rranet 192 168.31.99 49296.0.0.2
fort2 rekocrius Erents Pacdets
A
49307 224.0.0.2S2
STA LStD bts
192.168.90.153 5355 UDP ESTABLISHED
S355 LOP ESTABLISHED 12a
5355UD ESTAELISD
192.168,98,159 5355:UDE 12A P
ESTABISED
192.168.96. 153 SO00922400
S355LDP ESTAB,ISED
192.168.62.171 49937224.0,.0.752
SE5:LDP
192.168.51.59 S0067 22.0.0.52
ESTABLIS-ED
0
STABLISHED O
192.168.98.140 55878 239.255.255.250 STAR 129
192.168.98.192
SO429 224.0.0.252 ISD 0
3 2.045 K
STAELISED0 1281
192.168.51.1 s0377 224.0.0.25
STASLISHED 0 2
ade
$pg-Psrt RCwNCNSsyt.
Scanned by CamScanner
Lab Manual
Grypt. & Sys. Security (MU-Sem. 6-Comp) L-54
In
rules work to block unwanted traffic.
we learncd how iptables
n ne previous guide, to demonstrate how to create a basic rule
move on to a practical cxample HTTP traffic.
nis guide, we'll resulting firewall will allow SSH and
Set for an Ubuntu
14.04 server. The
$sudoiptables-- L
Output
Chain INPUT (policy ACCEPT)
targetptot opt source destination
$sudoiptables S
Output
-PINPUT ACCEPT
-PFORWARD ACCEPT
POUTPUT ACCEFT
Once again, the default policy is important here, because, while all of the rules are deleted
from your chains, the default policy will not change with this command. That means that
if you are connected remotely, you should ensure that
the default policy on your INPUT
and OUTPUT chains are set to ACCEPT prior to flushing your rules.
S sudoiptables -F
$ sudoiptables -P INPUT ACCEPT
sudoiptables -P OUTPUT ACCEPT
$ sudoiptables -F
Scanned by CamScanner
Gypt. & Sys. Security (MU-Sem. 6-Comp) L-55 Lab Manual
Rule
Make your First
Scanned by CamScanner
Lab Manual
Crypt. &
Sys. Security (MU-Sem. 6-Comp) L-56
Output
Chain INPUT (policy ACCEPT)
targetprot opt soureedestination
ACCEPT all -- anywhere anywherectstate RELATED,ESTABLISHED
The two lines were going to use to add these rules are :
Ssudoiptables -A INPUT -p tep -dport 22 j ACCEPT
p
Šeudoiptables -A INPUT tep-dport 80-j ACCEPT
The new options are :
P tep This option matches packets if the protocol being used is TCP. This is a
:
connection-based protocol that will be used by most applications because it allows for
reliable communication.
--dport : This option is available
if the -p tep flag is given. It gives a further
requirement of matching the destination port for the matching packet. The first rule
matches for TCP packets destined for port 22, while the second rule matches TCP
traffic pointed towards port 80.
There is one more accept rule that we need to ensure that our server can function
correctly. Often, services on the computer communicate with each other by sènding
Scanned by CamScanner
Cypt. & Sys. .Security (MU-Som. 6-Comp) L-57
Lab Manual
many programs.
.IINPUT1: The -I flag tells iptables to insert a rule. This is different than the -A flag
which appends a rule to the end. The - flag takes a chain and the rule position where you
want to insert the new rule.
In this case, we're adding thus rule as the very first rule of the NPUT chain. This witl
bump the rest of the rules down. We want this at the top because it is fundamental and
should not be affected by subsequent rules.
: This component of the rule matches if the interface that the packet is using is the
i lo means that
"lo" interface. The "lo" interface is another name for the loopback device. This
any packet using that interface to communicate (packets generated on
our server., for our
sudoiptables-$
$
Output
-P INPUT ACCEPT
P FORWARD ACCEPT
-POUTPUT ACCEPT
-A INPUT-i lo j ACCEPT
RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m conntrack --ctstate
ACCEPT
-A INPUT-p tep -m tep --dport 22 -j
-A INPUT-p tcp -m tcp --dport 80-j
ACCEPT
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. Lab Manual
6-Comp) L-58
T a packet enters the INPUT chain and doesn't match one of the four rules that we made,
IS Dein8 passed to our default policy, which is to accept the packet anyways. We need to
change this.
There are two different ways that we can do this, with some pretty important differences.
can
The first way we could do this is to modify the default policy of our INPUT chain. We
do this by typing :
$ sudoiptables -P INPUT DROP
This will catch any packets that fall through our INPUT chain, and drop them. This is
what we call a default drop policy. One of the implications of this type of a design is that
it falls back on dropping packets if the rules are flushed.
This may be more secure, but also can haye serious consequences if you don't have
another way of accessing your server. With DigitalOcean, you can log in through our web
Console to get access to your server if this happens. The web console acts as a virtual local
connection, so iptables rules will not affect it.
You may like your server to automatically drop all connections in the event that the rules
are dumped. This would prevent your server from being
left wide open. This also means
that you can casily append rules to the bottom of the chain easily while still dropping
packets as you'd like.
The alternative approach is to keep the default policy for the chain as accept and add a
rule that drops every remaining packet to the bottom of the chain itself.
If you changed the default policy for the INPUT chain above, you can set it back to follow
along by typing:
$sudoiptalbles
-P INPUT ACCEPT
Now, you can add a rule to the bottom of the chain that will
drop any remaining
:
packets
S sudoiptables -A INPUT -¡ DROP
The result under normal operating conditions is exactly the same as a
default drop policy.
This rule works by matching every remaining packet that reaches it.
This prevents a
packet from ever dropping all of the way through the chain to reach
the default policy.
Basically, this is used to keep the default policy to accept traffic.
That way, if there are
any problems and the rules are flushed, you will
still be able to access the machine over
the network. This is a way of implementing a default action without altering the policy
that will be applied to an empty chain.
Scanned by CamScanner
6-Comp)
Cvot. & Sys. Security (MU-Sem. ·L-59 Lab Manual
Of
course, this also means
that any rule that any additional rule that you wish to add to the
end of the chain will have to be added before the drop rule. You can do this either by
Or, you can insert rules that you necd at the end of the chain (but prior to the drop) by
specifying the line number. To insert a rule at line number 4, you could type :
$sudoiptables -I INPUT 4 new_rule_here,
$sudoiptables -L line-numbers
Output
Chain INPUT (policy DROP)
Conclusion
Hence we have studied how to configure the firewall using iptables.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) Lab Manual
L-60
Objective
To Study what is snort, Implementation of snort.
:
Solution
Theory
Snort is an open source network intrusion prevention and detection system (DS/IPS)
developed by source fire. Vombining the benefits of signature, protocol, and anomaly-based
inspection, snort is the most widely deployed IDS/IPS technology worldwide.
Hardware requirements for this system are dependent upon the size of your network and
volume of traffic. The minimum hardware required is 1 GB RAM, a core procesSor and at
least 2 GB free space on the hard drive. Snort can be implemented on any Linux platform
or on the latest windows systems.
There are three main modes in which Snort can be configured: sniffer, packet logger, and
network intrusion detection system.
Sniffer mode simply reads the packets off of the network and displays them for you in a
continuous stream on the console. Packet logger mode logs the packets to
the disk.
Network intrusion detection mode is the most complex
and configurable configuration,
allowing Snort to analyze network traffic for matches against a user
defined rule set and
performs several actions based upon what it sees.
Snort's open source network-based intrusion detection system
(NIDS) has the ability to
perform real-time traffic analysis and packet logging on
Internet Protocol (P) networks.
Snort performs protocol analysis, content searching,
and content matching. The program
can also be used to detect probes or
attacks, including, but not limited to, operating system
fingerprinting attempts, common gateway interface,
buffer overflows, server messag°
block probes, and stealth port scans.
Scanned by CamScanner
Cypt. & Sys. Security (MU-Sem. 6-Comp) L-61
Lab Manual
WinPcap
snort.org distributes a convenient install package for Windows available at its Web site:
http://www.snort.org/dlbinaries/win32/
Download this package (generally called snort-2_1_0.exe) and perform the following
Steps to install Snort
1, Double-click the executable installation file. The GNU Public License appears.
appears.
2. Click the I Agree button. Installation Options window
Scanned by CamScanner
Lab Manual
L-62
P Crypt. & Sys. Security (MU-Sem.6-Comp)
from among
select
appropriate boxes to
3. In the Installation Options dialog box, click the
these options
:
database server.
window appears.
4. Click the Next button. The choose components
you want to Install and then
5
In the choose components window,
select the components
appears.
click the Next button. The install location window
Snortpath/etc/snort.conf
Scanned by CamScanner
Crypt. &
Sys. Security (MU-Sem. 6-Comp) L-63 Lab Manual
Whedead
e
t
Installed: 1.0.0-2ubuntul
Candidate: 1.0.0-2ubuntul
Scanned by CamScanner
LabManA
Installed: 7.8-3
Candidate: 7.8-3
# cd snort-2.8.6.1
# Jeonfigure
# make
# make install
Installation
3. Verlfy the Snort
:
as shown below
Verify the installation
# snort --version
-*> Snort!<*
o" )- Version 2.8.6.1 (Build 39) hitp:/lwww.snort.org/snort/snort-team
The Snort Team:
By Martin Roeschand
Sourcefire, Inc., etal.
Copyright (C) 1998-2010
# mkdir etc'snort
# mkdir letc/snort/rules
# mkdir /varlog/snort
Create the following snort.conf and icmp.rulesfiles
# cat /etc/nort/snort.conf
include /etc/snort/rules/icmp.rules
#cat /etc/snort/rules/icmp.rules
alerticmp any any -> any any (msg:"ICMP Packet'; sid:477; rev:3;)
Scanned by CamScanner
LabO Manuat coypt & SYS. Security(MU-Sem. 6-Comnl L-65
Lab Manual
Table 1: Rule structure
and example
Structure
Example
Rule Actions
Alert
Protocol
Icmp
Source IP Address
Any
Source Port
Any
Direction Operator
Destination IP Address
Any
Destination Port
Any
(rule options) (msg:"ICMP Packet"; sid:477;
rev:3:)
5. Execute snort
Execute snort from command line, as mentioned
below
:
# head /varilog/snortalert
11:477:3] ICMP Paiket [**)
Priority: 0)
07/27-20:41:57.230345 > len: 0
/1 type: 0x200 0:0:0:0:0:0
pkt type:0x4 proto: Ox800 len:0x64
209.85.231.102 -> 209.85.231.104
ICMP TTL64 TOS:0x0
ID:0IpLen:20DgmLen:84 DF
Type:8 Code:0 ID:24905
Seq:1 ECHO
Alert Explanatlon
Scanned by CamScanner
Crypt. &
Sys. SSecurity
(MU-Sem. 6-Comp)
L-66
Type of packet, LabManJal
and header information.
If you have a different interface
example my network for thbe network connection,
interface is ppp0. then use -dev -i option.
snort -dev-i Ink:
# ppp0-c /etc/snort/snort.conf
-l/var/log/snort/
Execute snort as
Daemon.
Add -D option to run
snort as a daemon.
#snort -D -c letc/snort/snort.conf
-l/var/log/snort
Lab Ends...
Scanned by CamScanner