TY BSC CS SEM V Information and Network Security
TY BSC CS SEM V Information and Network Security
)
SEMESTER - V (CBCS)
INFORMATION AND
NETWORK SECURITY
SUBJECT CODE: USCS504
© UNIVERSITY OF MUMBAI
Programme Co-ordinator
: Shri Mandar Bhanushe
Head, Faculty of Science and Technology IDOL,
Univeristy of Mumbai - 400098
Course Co-ordinator : Ms. Mitali Vijay Shewale
Doctoral Research,
Veermata Jijabai Technological Institute
Matunga, Mumbai.
Editor : Ms. Mitali Vijay Shewale
Doctoral Research,
Veermata Jijabai Technological Institute
Matunga, Mumbai.
Course Writers : Dr. Shraddha Sable
Assistant Professor,
S. K. College of Science & Commerce, Mumbai
: Abhijeet Pawaskar
Assistant Professor,
Thakur Educational Trusts Thakur College of
Science and Commerce, Thakur Village,
W E Highway Kandivli East,
Mumbai 400 101.
: Diana Fernandes
Assistant Professor,
B. K. Birla College of Arts, Science and
Commerce (Autonomous),
B. K. Birla College Road, Kalyan - 421 304.
August 2023, Print - 1
Published by : Director,
Institute of Distance and Open Learning,
University of Mumbai,
Vidyanagari,Mumbai - 400 098.
1 Introduction..............................................................................................................1
INFORMATION
Bartlett Publishers, 2010 AND NETWORK SECURITY
SYLLABUS
Textbook(s):
1) Cryptography and Network Security: Principles and Practice 5th Edition, William
Stallings, Pearson,2010
Additional Reference(s):
1) Cryptography and Network Security, Atul Kahate, Tata McGraw-Hill, 2013.
2) Cryptography and Network, Behrouz A Fourouzan, Debdeep Mukhopadhyay, 2nd
Edition,TMH,2011
Unit I IoT Architecture-State of the Art : Introduction, State of the art, Reference 15L
Model and architecture, IoT reference Model - IoT Reference Architecture
Introduction, Functional View, Information View, Deployment and Operational
View, Other Relevant architectural views
IoT Data Link Layer and Network Layer Protocols:
3
Information and Network • Security attacks : -
Security
The actions which comprise information security of an organization
• Security mechanisms :-
The practises that are designed to identify, prevent and recover from
a security attacks.
• Security services :-
Services which improve systems and data processing and transferring
security and also planned to counter security attacks.
Security
Attack
Passive Active
attack attack
Release of Denial of
Traffic Masquerdi Replay Modificati
message Service
Analysis ng attack on
content (DOS)
4
o Use encryption for data masking so that information is Introduction
unreadable by an intruder
• These attacks are sub categorized into following two types :-
o Release of message contents
o Traffic analysis
Release of message content
• Unauthorized access of data
• Interception of data
• Disclosure of confidential information
• Threat against confidentiality
• To prevent such attacks, encryption technique can be used for data
masking.
Traffic analysis
• Observing online data traffic pattern
• Analysing frequency and length of data packets
• Threats against data confidentiality
5
Information and Network Active attack
Security
• Attacks which attempt to modify resources of the system or their
operations are called as active attack
• The victim gets notified about this type of attack as it involves data
modification
Protective measures :-
o Use of strong password is recommended
o Use of one time password for authentication during
communication
o Use of session keys to prevent access once session time out.
6
Replay attack Introduction
Data Modification
Non
Authentic Access Confeden Availabil
Intergrity repudiati
ation Control tiality ity
on
Connecti
Connecti
Peer Data Connceti Connecti Selective Traffic on Connecti Destinati
on with Origin
Entity Origin on onless Field Flow without onless on
recovery
recovery
Authentication
9
Information and Network
Security
Access Control
• Prevention from unauthorized access to a resource
• Policies that define who can access what
• Limiting and controlling access of host and its applications.
• If the users or services are authenticated then access controls are
allotted to them.
o Role management
▪ Roll of a user
▪ It defines which user can access what resources.
o Rule management
▪ It defines which resources can be accessible under what
circumstances.
• Access Control List (ACL) matrix needs to prepared
which defines list of users, their roles and what they can
access.
Confidentiality
• Assuring data privacy
• Protecting unauthorized data access
• Securing data transmission from passive attacks
• Only intended sender and receiver should be able to see contents of
the message.
o Connection
▪ Protection for all user’s data over a connection
o Connectionless
10
▪ Protection for all user’s data over a single data block Introduction
o Selective field
▪ Confidentiality is made applicable on selective fields over
a connection or on a single data block
o Traffic flow
▪ Protecting analysis of traffic flow including source,
destination length, frequency or any other parameters of
traffic
Availability
11
Information and Network Integrity
Security
• Data received by the receiver is exactly same as send by the sender
Non repudiation
12
• Protection against refusion of identities by sender or receiver after Introduction
transmitting a message
13
Information and Network
Security Specific Pervasive
Trusted
Encipherment
Functionality
Digital
Security Label
signature
Access Event
Control Detection
Security Audit
Data Integrity
Trail
Authentication Security
Exchange Recovery
Traffic
Padding
Routing
control
Notarization
16
o Security Audit Trail Introduction
1.7 QUESTIONS
• Syngress.The.Basics.of.Hacking.and.Penetration.Testing.Aug.2011
17
2
CLASSICAL ENCRYPTION TECHNIQUES
Unit Structure :
2.1 Symmetric Cipher Model
2.2 Substitution Techniques
2.3 Transposition Techniques
2.4 Steganography
2.5 Questions and References
2.0 OBJECTIVES
18
• Plain text – Original data that is to be feed as input to the algorithm Classical Encryption
Techniques
• Encryption algorithm – Various algorithms used to convert plain
text into cipher text. These algorithms are classified as substitution
and transposition algorithms.
• Secret key should be kept private and secure and not shared to anyone
else who are not involved in communication
Characteristics of cryptography
Cryptography Techniques
20
2.2 SUBSTITUTION TECHNIQUES Classical Encryption
Techniques
Example
• Plain Text :- WELL DONE TYCS
• Cipher Text :- ZHOO GRQH WBFV
Monoalphabetic Cipher
• Plain: A B C D E F G H I J K L M N O P Q R S T U
V W X Y Z
• Cipher: D K V Q F B J W P E S C X H T M Y A U O L
R G Z NI
Example
• Plaintext: IF WE WISH TO REPLACE LETTERS
• Cipher text: WI RF RWAJ UH YFTSDVF SFUUFYA
21
Information and Network Playfair cipher
Security
• This technique uses keyword
• Characters in keyword are arranged in 5x5 matrix row wise from left
to right and from top to bottom
• Repeated characters from keyword have to be written only once in
matrix
• Fill the rest spaces in matrix with remaining characters from A – Z
which are not a part of keyword.
• I and J can not be written separately. They need to write in same cell
of matrix.
For example :- Keyword BALLOON
B A L O N
C D E F G
H I/J K M P
Q R S T U
V W X Y Z
Encryption process
• Break plain text into group of 2 characters
o Eg Plain text :- MAROON
o MA RO ON
• If both alphabets are same add x after first alphabet
o Eg Plain text :- BALLY
o BA LX LY
• If only one character is left add x at end
o Eg. Plain text :- MORNING
o MO RN IN GX
• RULE 1
• If both characters from a group appears in the same row, replace with
immediate right characters respectively.
B A L O N
C D E F G
H I/J K M P
Q R S T U
V W X Y Z
o Consider above matrix
22 o Plain text :- ON
o Cipher text :- NB Classical Encryption
Techniques
o Next character of O is N and Next character of N is B is same
row
• RULE 2
• If both characters from a group appears in the same column, replace
with immediate below characters respectively.
B A L O N
C D E F G
H I/J K M P
Q R S T U
V W X Y Z
o Consider above matrix
o Plain text :- FM
o Cipher text :- MT
o Character below F is M and character below M is T is same
column
• RULE 3
• If both characters forming a group are not in the same column or row,
replace them with character on corners of rectangle. First character
must be present on the same row.
B A L O N
C D E F G
H I/J K M P
Q R S T U
V W X Y Z
• Example
23
Information and Network • Keyword :- PLAYFAIR EXAMPLE
Security
P L A Y F
I/J R E X M
B C D G H
K N O Q S
T U V W Z
24
Vigenere Cipher / Polyalphabetic cipher Classical Encryption
Techniques
• Consider plain text and keyword
Additive cipher
• Also called as shift cipher
• Similar to modified version of Caesar cipher
• Key is considered in numeric format
• Plain text characters need to be shifted to the right according to
specific positions
• If key = 7, A → H, B → I and so on
• Plain text :- S E C U R I T Y
• Cipher text :- X J H Z Z N Y A
G O M R I G
O D O N N
Multicolumnar cipher
2.4 STEGANOGRAPHY
28
2.5 QUESTIONS Classical Encryption
Techniques
1. What are substitution techniques? Explain any one with the help of an
example.
2. Explain Mono-alphabetic cipher with an example.
3. Explain Hill cipher with an example.
4. What is Polyalphabetic cipher? Explain with an example.
5. Explain Rail Fence cipher with an example.
6. Briefly define Caesar cipher with an example.
7. What are transposition techniques? Explain any one with the help of
an example.
8. Define the following terms:- Brute force attack, cryptanalysis
9. Write a note on steganography.
10. Explain playfair cipher encrypt the plain text “SECRET MESSAGE”
by using keyword “PROBLEM”.
• Syngress.The.Basics.of.Hacking.and.Penetration.Testing.Aug.2011
29
3
BLOCK CIPHER AND THE DES
Unit Structure :
3.1 Block cipher principles
3.2 DES
3.3 Strength of DES
3.4 AES
3.5 Multiple encryption and Triple DES
3.6 Block cipher modes of operations
3.7 Stream Ciphers
3.8 Questions and References
3.0 OBJECTIVES
For cryptography various types of symmetric key and asymmetric key
algorithms are used.
These algorithms have two key aspects associated to them:
– Algorithm Type: it defines what size of plaintext should be
encrypted in each step of the algorithm.
– Algorithm Mode: it defines the details of the cryptographic
algorithm.
30
Stream Cipher Block cipher and the DES
Block Cipher
31
Information and Network
Security
32
3.2 DES (DATA ENCRYPTION STANDARD) Block cipher and the DES
• It is a cryptographic algorithm.
• That means, 64 bits of plain text is consider as input for DES and
which produces 64 bits of output which is cipher text.
• The same algorithm and key are used for encryption and decryption
with minor differences.
• Before starting DES process, every 8th bit of the key is discarded to
produce a 56 bits key.
33
Information and Network
Security
34
Initial Permutation (IP): Block cipher and the DES
1 58
2 50
3 42
4 34
……….. ………
64 7
58 50 42 34 26 18 10 2 60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6 64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1 59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5 63 55 47 39 31 23 15 7
35
Information and Network – During each round, from this 56-bit key, a 48-bit subkey is
Security
created using a process called key transformation.
– 56-bit key is divided into two parts of 28-bits
– These parts are shifted towards left by one or two positions.
– For round number 1,2,9 or 16, shifting is done by one position
and for rest of rounds shifting is done by two positions.
– After shifting random 48 bits are selected.
– This process is also known as compression permutation.
Step 2
Expansion permutation:
– 32-bit RPT is expanded to 48 bits as 48 bits key length is
generated in step 1.
32-bit RPT is divided into 8 blocks of 4 bits each.
Next each 4-bit block is expanded to 6-bit block, by adding 2 extra
bits, that is the first bit of the block 1 is the last bit of the block 8 and
the last bit of the block 8 is the first bit of the 7th block
And thus 48-bit RPT is obtained.
32 1 2 3 4 5 4 5 6 7 8 9
8 9 10 11 12 13 12 13 14 15 16 17
16 17 18 19 20 21 20 21 22 23 24 25
24 25 26 27 28 29 28 29 30 31 32 1
– 48-bit key is XORed with 48-bit RPT
36
– Result is considered for next step, which is S-box substitution. Block cipher and the DES
Step 3
• S-box Substitution:
– This step accepts 48 bits output from XOR operation of
previous step and converts it into 32 bits using substitution
technique.
– Substitution process is performed by eight substitution boxes
(S-boxes).
– Each box takes 6 bits of inputs and produces 4 bits of output.
– The 48-bit block text is then divided into 8 blocks of 6 bits each.
– Each block is given to S-box.
Final Permutation:
– Finally, at the end of all 16 rounds, Final Permutation is
performed only once.
– A simple transposition is based on Final Permutation Table.
– Output of the Final permutation is 64-bit encrypted block.
– The below is table for final permutation values.
39
Information and Network
Security
3.4 AES
• The more popular and widely accepted and adopted symmetric
encryption algorithm nowadays is Advanced Encryption Standard
(AES).
• At least six time faster than triple DES.
• Plain text block size is 128 bits or 16 bytes
• Key length can be 128, 192, 256 bits
• AES processes entire block of data as a single matrix in each round
using substitution and transposition.
• The key which is provided as input is expanded into an array of forty
four 32 bit words.
• Four distinct words are considered as a key for each round.
• This algorithm can be implemented on software and hardware both,
so it seems to be the strongest security protocol.
• Its higher key length size makes it more tough against hacking.
• Its common application are e-commerce, wireless communication,
financial transactions, secure data storage etc.
• Four different stages are used for AES; three for substitution and one
for permutation.
• Byte Substitution (SubBytes)
o 16 input bytes are replaced by looking into a S-box table. The
result is in a matrix of four rows and four columns.
40
• Shiftrows Block cipher and the DES
41
Information and Network
Security
3.5 MULTIPLE ENCRYPTION AND TRIPLE DES
Potential weakness of DES was brute force attack. So there was a need to
design an algorithm which is completely new or make alterations in existing
algorithm. Hence, Multiple encryption and triple DES arose.
Multiple encryption
• An encryption algorithm is implemented many times.
• Plain text is converted to cipher text using any algorithm.
• Cipher text generate in above step is considered as input for the
second step.
• Repeating above processes multiple times.
Multiple DES
DES was prone to attacks due to advancement in computer hardware.
Since DES was a very capable algorithm it would be better to reuse
DES rather than writing a new cryptographic algorithm.
Because of the above problems, variations of DES were introduced
and are known as multiple DES.
Double DES
Double DES makes use of two keys, let us assume K1 and K2.
Firstly, it performs DES process on original plain text using key K1
and generate cipher text.
DES process is repeated on cipher text generated in previous step with
key K2.
The final result is encryption of encrypted text with original plain text
encrypted twice with two different keys shown in figure below.
Triple DES with two keys uses two keys, let us assume K1 and K2.
Key K1 used in first and third stage.
Key K2 used in second stage.
First plain text is encrypted using DES with key K1 and generate
cipher text. This cipher text is then decrypted with key K2 and finally
output of second step is encrypted again with key K1.
Thus having EK1(DK2(EK1(P)))EK1(DK2(EK1(P))) shown below.
This process is also called as ECE (Encrypt Decrypt Encrypt) mode.
This process proves protection from man in the middle attack.
43
Information and Network An algorithm mode is the permutation of series of the basic algorithm
Security
steps on block cipher and some feedback received from the previous
step.
There are 4 algorithm modes:
– Electronic Code Book (ECB)
– Cipher Block Chaining (CBC)
– Cipher Feedback (CFB)
– Output Feedback (OFB)
47
Information and Network
Security
48
3.7 STREAM CIPHERS Block cipher and the DES
49
Information and Network
Security
3.8 QUESTIONS
• Syngress.The.Basics.of.Hacking.and.Penetration.Testing.Aug.2011
50
4
PUBLIC KEY CRYPTOGRAPHY AND RSA
Unit Structure :
4.1 Principles of Public – key cryptosystems
4.2 The RSA Algorithm
4.3 Questions and References
51
Information and Network Components of Public Key Cryptosystem
Security
• Plain Text
o A normal readable message which is considered as input for the
process of encryption
• Encryption Algorithm
o Sequence of steps which are used to convert plain text into
cipher text
• Cipher Text
o The resultant text which is produced after implementing
encryption algorithm.
• Decryption Algorithm
o Sequence of steps which are used to convert cipher text back
into plain text with the help of matching key
Steps involved in Asymmetric key cryptography
• Then A and B should each have a private key and a public key.
o A should keep her private key secret.
o B should keep her private key secret.
o A should inform B about her public key.
o B should inform A about her public key.
53
Information and Network Applications
Security
• Encryption / Decryption – Encryption of the message by the sender
by receiver’s public key
• PT = CTD mod N
• Brute Force
o Trying all possible combinations to find keys
• Mathematical attack
o Factoring products of two primes
o If value of P and Q are known using N then its easy to find
private key.
• Timing attack
o Running time of decryption algorithm
4.3 QUESTIONS
• Syngress.The.Basics.of.Hacking.and.Penetration.Testing.Aug.2011
56
5
KEY MANAGEMENT
Unit Structure :
5.0 Objective
5.1 Introduction
5.2 Types of keys
5.3 Public-Key Cryptosystems
5.4 Types Public-Key Cryptosystems
5.4.1 RSA algorithm (Rivest-Shamir-Adleman)
5.4.1.1 Algorithms for generating RSA keys
5.4.1.2 Example
5.4.1.3 RSA Encryption
5.4.1.4 RSA Decryption
5.4.1.5 RSA Analysis
5.4.1.6 RSA security
5.4.2 ElGamal Cryptosystem
5.4.2.1 ElGamal Analysis
5.4.3 Elliptic Curve Cryptography (ECC)
5.4.3.1 RSA and ElGamal Schemes – A Comparison
5.5 Key Management
5.5.1 Why is Key Management Important
5.5.2 Types of Keys
5.5.3 How Key Management Works
5.6 Diffie-Hellman Key Exchange
5.6.1 PRACTICE PROBLEMS
5.6.2 Establishing a shared key between multiple parties
5.6.3 Why is the Diffie-Hellman key exchange secure?
5.6.4 Authentication & the Diffie-Hellman key exchange
5.6.5 Variations of the Diffie-Hellman key exchange
5.7 Summary
5.8 Questions
5.9 Reference for further reading
57
Information and Network
Security
5.0 OBJECTIVE
5.1 INTRODUCTION
There are three primary types of keys that need to be kept safe and secure:
1. Symmetric keys – typically used to encrypt bulk data with
symmetric algorithms like 3DES or AES; anyone with the secret key
can decrypt the data
2. Private keys – the secret half of public/private key pairs used in
public-key cryptography with asymmetric algorithms like RSA or
ECDSA; anyone with the private key can impersonate the owner of
the private key to decrypt private data, gain unauthorized access to
58
systems or generate a fraudulent digital signature that appears Key Management
authentic
3. Hash keys – used to safeguard the integrity and authenticity of data
and transactions with algorithms like HMAC-SHA256; anyone with
the secret key can impersonate the originator of the data/transactions
and thus modify the original data/transactions or create entirely false
data/transactions that any recipient will believe is authentic
59
Information and Network
Security
return None
u1, u2, u3 = 1, 0, a
v1, v2, v3 = 0, 1, m
while v3 != 0:
q = u3 // v3
v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q *
v3), v1, v2, v3
return u1 % m
2. RabinMiller Module
The source code of RabinMiller module which follows all the basic
implementation of RSA algorithm is as follows −
import random
def rabinMiller(num):
s = num - 1
t=0
while s % 2 == 0:
s = s // 2
t += 1
for trials in range(5):
a = random.randrange(2, num - 1)
v = pow(a, s, num)
if v != 1:
i=0
while v != (num - 1):
if i == t - 1:
return False
else:
i=i+1
v = (v ** 2) % num
return True
def isPrime(num):
if (num 7< 2):
return False
63
Information and Network lowPrimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
Security
53, 59, 61,
67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
139, 149, 151,
157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227,
229, 233, 239, 241,
251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,317,
331, 337, 347, 349,
353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431,
433, 439, 443, 449,
457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
547, 557, 563, 569,
571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
647, 653, 659, 661,
673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757,
761, 769, 773, 787,
797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
881, 883, 887, 907,
911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
if num in lowPrimes:
return True
for prime in lowPrimes:
if (num % prime == 0):
return False
return rabinMiller(num)
def generateLargePrime(keysize = 1024):
while True:
num = random.randrange(2**(keysize-1), 2**(keysize))
if isPrime(num):
return num
def main():
64 makeKeyFiles('RSA_demo', 1024)
def generateKey(keySize): Key Management
Output
The public key and private keys are generated and saved in the respective
files as shown in the following output.
66
5.4.1.2 Example Key Management
68
Bob: Key Generation Key Management
To generate his private key and his public key Bob does the following.
3. Bob computes
4. Bob publishes his public key ,p,g, B in the key directory.
Alice: Encryption
4. Alice computes .
69
Information and Network
Security
RSA ElGamal
For a particular security level, For the same level of security, very
lengthy keys are required in RSA. short keys are required.
72
Encryption using asymmetric keys is a little more complicated than Key Management
symmetric key encryption. Instead of using the same key for both
encryption and decryption, two separate keys called a public and private
key, are used for the encryption and decryption of data. These keys are
created as a pair, so that they relate to each other. The public key of a pair
of asymmetric keys is mainly used to encrypt data. This key can be shared
with anyone since it encrypts, not decrypts, data. The private key is used
for the decryption of data encrypted by its public key counterpart, so it
must stay secure.
Asymmetric keys focus on encrypting data-in-motion. Data-in-motion is
data sent across a network connection, whether it be a public or private
connection. When transporting sensitive data, most encryption processes
use both symmetric and asymmetric keys to encrypt data.
The symmetric key is now encrypted by the public key of the person
who the data is being sent to. That encrypted symmetric key and
the ciphertext are sent to the recipient of the data.
Once the ciphertext and key reach the recipient, the symmetric key
is decrypted by that user’s private key, and the ciphertext is
decrypted.
5.5.3 How Key Management Works
Key management follows a lifecycle of operations which are needed to
ensure the key is created, stored, used, and rotated securely. Most
cryptographic keys follow a lifecycle which involves key
Generation
Distribution
Use
Storage
Rotation
Backup/Recovery
Revocation
Destruction
The generation of a key is the first step in ensuring that key is secure. If
the key in question is generated with a weak encryption algorithm, then
any attacker could easily discover the value of the encryption key. Also, if
the key is generated in an insecure location, the key could be
compromised as soon as it is created, resulting in a key that cannot be
73
Information and Network safely used for encryption. Key generators, AES encryption algorithms, or
Security
random number generators tend to be used for secure key generation.
The next step of the key lifecycle is ensuring the safe distribution of the
keys. Keys should be distributed to the required user via a secure TLS or
SSL connection, to maintain the security of the keys being distributed. If
an insecure connection is used to distribute the cryptographic keys, then
the security of any data encrypted by these keys is in question, as an
attacker could execute a man-in-the-middle attack and steal the keys.
After distribution of the key, it is used for cryptographic operations. As
previously noted, the key should only be used by authorized users, to
make certain the key is not misused, copied, etc. When the key is used to
encrypt data, it must then be stored for later decryption. The most secure
method is via a Hardware Security Module (HSM) or CloudHSM. If an
HSM is not used, then the keys can either be securely stored on the
client’s side, or, if the keys are used on the Cloud, then the Cloud Service
Provider’s Key Management Service can be used.
Once a key’s cryptoperiod, or time period the key is usable, passes, the
key must be rotated. When the key of an encrypted set of data expires, the
key is retired and replaced with a new key. First the data is decrypted by
the old key or key pair and then encrypted by the new key or key pair.
Rotation is necessary because the longer a key is in rotation, the more
chance there is for someone to steal or find out the key. Rotation of keys
can happen before the cryptoperiod expires in cases where the key is
suspected to be compromised.
Two other ways of dealing with a compromised key are revoking or
destroying the key in question. Revoking a key means the key can no
longer be used to encrypt or decrypt data, even if its cryptoperiod is still
valid. Destroying a key, whether that is due to compromise or due to it no
longer being used, deletes the key permanently from any key manager
database or other storage method. This makes it impossible to recreate the
key, unless a backup image is used. NIST standards require that
deactivated keys be kept in an archive, to allow for reconstruction of the
keys if data encrypted in the past must now be decrypted by that key or
key pair.
74
The Diffie-Hellman key exchange was the first widely used method of Key Management
safely developing and exchanging keys over an insecure channel.
It may not seem so exciting or groundbreaking in the above terms, so let’s
give an example that explains why the Diffie-Hellman key exchange was
such an important milestone in the world of cryptography, and why it is
still so frequently used today.
Diffie Hellman Key Exchange Algorithm-
Let-
After this exchange, both the parties know the value of ‘a’ and ‘n’.
Step-02:
Both the parties calculate the value of their public key and exchange
with each other.
Ys = aXs mod n
Yr = aXr mod n
Step-03:
n = 17
a=5
5.7 SUMMARY
5.8 QUESTIONS
https://dis-blog.thalesgroup.com/security/2018/09/26/the-
importance-of-key-management-when-implementing-a-secure-
information-gateway/
https://www.cryptomathic.com/news-events/blog/cryptographic-
key-management-the-risks-and-mitigations
https://www.globalsign.com/en/ssl-information-center/what-is-
public-key-cryptography
https://searchsecurity.techtarget.com/definition/RSA
https://www.tutorialspoint.com/cryptography/public_key_encryption
.htm
https://mathstats.uncg.edu/sites/pauli/112/HTML/secelgamal.html
https://www.encryptionconsulting.com/education-center/what-is-
key-management/
https://www.comparitech.com/blog/information-security/diffie-
hellman-key-exchange/
80
6
MESSAGE AUTHENTICATION AND HASH
FUNCTIONS
Unit Structure :
6.0 Objective
6.1 Introduction
6.2 Authentication Requirements
6.3 Authentication Functions
6.3.1 Message Encryption
6.3.2 Message authentication code (MAC)
6.3.3 A Hash function
6.4 Security of Hash Functions and Macs
6.5 Secure Hash Algorithm
6.6 HMAC
6.7 Summary
6.8 Questions
6.9 Reference for further reading
6.0 OBJECTIVE
6.1 INTRODUCTION
83
Information and Network 1. Symmetric Key encryption
Security
The encryption process where same keys are used for encrypting
and decrypting the information is known as Symmetric Key
Encryption.
The study of symmetric cryptosystems is referred to as symmetric
cryptography. Symmetric cryptosystems are also sometimes
referred to as secret key cryptosystems.
A few well-known examples of symmetric key encryption methods
are − Digital Encryption Standard (DES), Triple-DES (3DES),
IDEA, and BLOWFISH.
Trust Issue − Since the sender and the receiver use the same
symmetric key, there is an implicit requirement that the sender and
the receiver ‘trust’ each other. For example, it may happen that the
receiver has lost the key to an attacker and the sender is not
informed.
These two challenges are highly restraining for modern day
communication. Today, people need to exchange information with non-
familiar and non-trusted parties. For example, a communication between
online seller and customer. These limitations of symmetric key encryption
gave rise to asymmetric key encryption schemes.
2. Public Key encryption / Asymmetric Key Encryption
The encryption process where different keys are used for
encrypting and decrypting the information is known as
Asymmetric Key Encryption. Though the keys are different, they are
mathematically related and hence, retrieving the plaintext by
decrypting ciphertext is feasible. The process is depicted in the
following illustration −
85
Information and Network Every user in this system needs to have a pair of dissimilar
Security
keys, private key and public key. These keys are mathematically
related − when one key is used for encryption, the other can decrypt
the ciphertext back to the original plaintext.
It requires to put the public key in public repository and the private
key as a well-guarded secret. Hence, this scheme of encryption is
also called Public Key Encryption.
When Host1 needs to send data to Host2, he obtains the public key
of Host2 from repository, encrypts the data, and transmits.
The sender uses some publicly known MAC algorithm, inputs the
message and the secret key K and produces a MAC value.
The sender forwards the message along with the MAC. Here, we
assume that the message is sent in the clear, as we are concerned of
providing message origin authentication, not confidentiality. If
confidentiality is required then the message needs encryption.
On receipt of the message and the MAC, the receiver feeds the
received message and the shared secret key K into the MAC
algorithm and re-computes the MAC value.
If the computed MAC does not match the MAC sent by the sender,
the receiver cannot determine whether it is the message that has been
87
Information and Network altered or it is the origin that has been falsified. As a bottom-line, a
Security
receiver safely assumes that the message is not the genuine.
Limitations of MAC
There are two major limitations of MAC, both due to its symmetric nature
of operation −
88
Key Management
89
Information and Network Hash Speed — Hash algorithms should operate at a reasonable
Security
speed. In many situations, hashing algorithms should compute hash
values quickly; this is considered an ideal property of a
cryptographic hash function. However, this property is a little more
subjective. You see, faster isn’t always better because the speed
should depend on how the hashing algorithm is going to be used.
Sometimes, you want a faster hashing algorithm, and other times it’s
better to use a slower one that takes more time to run through. The
former is better for website connections and the latter is better for
password hashing.
What Does a Hash Function Do?
One purpose of a hash function in cryptography is to take a plaintext input
and generate a hashed value output of a specific size in a way that can’t be
reversed. But they do more than that from a 10,000-foot perspective. You
see, hash functions tend to wear a few hats in the world of cryptography.
In a nutshell, strong hash functions:
90
Key Management
91
Information and Network It’s also important to note that hash functions aren’t one-size-fits-all
Security
tools. As we mentioned earlier, different hash functions serve
different purposes depending on their design and hash speeds. They
work at different operational speeds — some are faster while others
are much slower. These speeds can aid or impede the security of a
hashing algorithm depending on how you’re using it. So, some fall
under the umbrella of secure hashing algorithms while others do not.
How Does Hashing Work?
When you hash a message, you take a string of data of any size as
your input, run it through a mathematical algorithm that results in
the generation of an output of a fixed length.
In some methods of hashing, that original data input is broken up
into smaller blocks of equal size. If there isn’t enough data in any of
the blocks for it to be the same size, then padding (1s and 0s) can be
used to fill it out. Then those individual blocks of data are run
through a hashing algorithm and result in an output of a hash value.
The process looks something like this:
We can group attacks on the basis of hash functions and MACs: brute-
force attacks and cryptanalysis.
Brute-Force Attacks-The nature of brute-force attacks differs somewhat
for hash functions and MACs.
Hash Functions:-The strength of a hash function against brute-force
attacks depends on the length of the hash code produced by the algorithm.
There are three desirable properties:
If strong collision resistance is required, then the value 2n/2 determines the
strength of the hash code against brute-force attacks. Thus a 128-bit code
may be viewed as inadequate. The next step up, if a hash code is treated as
a sequence of 32 bits, is a 160-bit hash length. With a hash length of 160
bits, the same search machine would require over four thousand years to
find a collision. However, even 160 bits is now considered weak.
Message Authentication Codes:-A brute-force attack on a MAC is a more
difficult undertaking because it requires known message-MAC pairs. To
attack a hash code, we can proceed in the following way. Given a fixed
message x with n-bit hash code h = H(x), a brute-force method of finding
a collision is to pick a random bit string y and check if H(y) = H(x). The
attacker can do this repeatedly off line. Whether an off-line attack can be
used on a MAC algorithm depends on the relative size of the key and the
MAC.
To proceed, we need to state the desired security property of a MAC
algorithm, which can be expressed as follows: Computation resistance:
Given one or more text-MAC pairs [xi, C(K, xi)], it is computationally
infeasible to compute any text-MAC pair [x, C(K, x)] for any new input x
≠ xi.In other words, the attacker would like to come up with the valid
MAC code for a given message x. There are two lines of attack possible:
Attack the key space and attack the MAC value.
General Structure of Secure Hash Code
93
Information and Network Cryptanalysis-The way to measure the resistance of a hash or MAC
Security algorithm to cryptanalysis is to compare its strength to the effort required
for a brute-force attack. That is, an ideal hash or MAC algorithm will
require a cryptanalytic effort greater than or equal to the brute-force effort.
Hash Functions:-In past few years there has been considerable effort, and
some successes, in developing cryptanalytic attacks on hash functions. To
understand these, we need to look at the overall structure of a typical
secure hash function, This structure, referred to as an iterated hash
function and is the structure of most hash functions in use today, including
SHA and Whirlpool. The hash function takes an input message and
partitions it into L fixed-sized blocks of b bits each. If necessary, the final
block is padded to b bits. The final block also includes the value of the
total length of the input to the hash function. The inclusion of the length
makes the job of the opponent more difficult.
94
1. Append padding bits: The message is padded so that its length is Key Management
congruent to 448 modulo 512 (length ≡ 448 (mod 512)). That is, the
length of the padded message is 64 bits less than an integer multiple
of 512 bits. Padding is always added, even if the message is already
of the desired length. Thus, the number of padding bits is in the
range of 1 to 512 bits. The padding consists of a single 1-bit
followed by the necessary number of 0-bits.
2. Append length: A block of 64 bits is appended to the message. This
block is treated as an unsigned 64-bit integer (most significant byte
first) and contains the length of the original message (before
padding).
3. Initialize MD buffer: A 160 bit buffer is used to hold intermediate
values and final results of the Hash function represented as 5, 32 bit
registers (A, B, C, D, E) initialized as follows: A = 67452301 B =
EF CDAB89 C = 98BADCF E D = 10325476 E = C3D2E1F0
4. Process message in 512 bit (16 word) blocks: The heart of the
algorithm is a module which consists of four “rounds” of processing
of 20 steps each (see figure). Each round has similar structure but
uses a different primitive logical function (f1, f2, f3 and f4). Each
round takes as input the current 512-bit block being processed (Yq)
and the 160-bit buffer value ABCDE and updates the contents of the
buffer. Each round also makes use of an additive constant Kt where
0 ≤ t ≤ 79 indicates one of the 80 steps across four rounds. In fact,
only four distinct constants are used (one for 0 ≤ t ≤ 19, 20 ≤ t ≤ 39,
40 ≤ t ≤ 59 and 60 ≤ t ≤ 79). The output of the fourth round is added
(modulo 2 32) to the input to the first round (CVq) to produce
CVq+1.
95
Information and Network Fig. Message Digest Generation Using MD5 (equally applicable to SHA-1
Security
with 160 bits instead of 128 etc.).
5. Output after all L 512 bit blocks have been processed the output
from the Lth stage is the 160 bit digest.
6.6 HMAC
As the Hash Function, HMAC is also aimed to be one way, i.e, easy to
generate output from input but complex the other way round.
HMAC reuses the algorithms like MD5 and SHA-1 and checks to replace
the embedded hash functions with more secure hash functions, in case
found.
HMAC algorithm –
97
Information and Network Here, H stands for Hashing function,
Security
M is original message
Si and So are input and output signatures respectively,
Yi is the ith block in original message M, where i ranges from [1, L)
L = the count of blocks in M
K is the secret key used for hashing
IV is an initial vector (some constant)
The generation of input signature and output signature Si and So
respectively.
6.7 SUMMARY
The encryption process where same keys are used for encrypting
and decrypting the information is known as Symmetric Key
Encryption.
6.8 QUESTIONS
https://www.cc.gatech.edu/~aboldyre/teaching/Fall05cs6260/m-
mac.pdf
http://www.facweb.iitkgp.ac.in/~sourav/AuthenticationRequirement
s.pdf
https://www.slideshare.net/RajasekarVr/message-authentication-
75333084-
https://www.thesslstore.com/blog/what-is-a-hash-function-in-
cryptography-a-beginners-guide/
http://www.faadooengineers.com/online-
100
7
DIGITAL SIGNATURES AND
AUTHENTICATION AND
AUTHENTICATION APPLICATIONS
Unit Structure :
7.0 Objective
7.1 Introduction
7.2 Digital Signatures
7.3 Authentication Protocols
7.3.1 Authentication protocols developed for PPP Point-to-Point
Protocol
7.4 Digital Signature Standard
7.5 Authentication Applications
7.5.1 Kerberos
7.5.2 X.509 Authentication
7.5.3 Public-Key Infrastructure
7.6 Summary
7.7 Questions
7.8 Reference for further reading
7.0 OBJECTIVE
7.1 INTRODUCTION
101
Information and Network Authentication is normally achieved by the presentation of a User ID
Security
(usually the user’s email address) to identify the person, and a secret
password known only to that person to confirm the identity.
But there are huge problems with this process. Fundamentally, it does not
authenticate the person; if a criminal acquires and uses the person’s User
ID and password, the criminal is automatically authorized to gain access.
So, strictly speaking, a password does not authenticate the user, it simply
authorizes a device regardless of who is using it.
Mary may forge a different message and claim that it came from
John. Mary would simply have to create a message and append an
authentication code using the key that John and Mary share.
John can deny sending the message. Because it is possible for Mary
to forge a message, there is no way to prove that John did in fact
send the message.
Both scenarios are of legitimate concern. In situations where there is
not complete trust between sender and receiver, something more
than authentication is needed. The most attractive solution to this
problem is the digital signature. The digital signature is analogous to
the handwritten signature. It must have the following properties:
It must verify the author and the date and time of the signature.
103
Information and Network Non-Repudiation: Digital Signature also provides non-repudiation.
Security
If the sender denies sending the message, then her private key
corresponding to her public key is tested on the plaintext. If the
decrypted message is the same as the original message, then we
know that the sender has sent the message.
The hash function is used to create a digest of the message. The hash
function creates a fixed-size digest from the variable-length
message.
The two most common hash functions used: MD5 (Message Digest
5) and SHA-1 (Secure Hash Algorithm 1). The first one produces
120-bit digest while the second one produces a 160-bit digest.
First, the digest must be one way, i.e., the digest can only be created
from the message but not vice versa.
The receiver receives the original message and encrypted digest and
separates the two. The receiver implements the hash function on the
original message to create the second digest, and it also decrypts the
received digest by using the public key of the sender. If both the
digests are same, then all the aspects of security are preserved.
104
At the Sender site Digital Signatures and
Authentication and
Authentication Applications
106
Digital Signatures and
Authentication and
Authentication Applications
3. EAP - Extensible Authentication Protocol
Extensible Authentication Protocol (EAP) is an authentication
framework, not a specific authentication mechanism, frequently used
in wireless networks and point-to-point connections. It provides
some common functions and negotiation of authentication methods
called EAP methods.
The EAP protocol can support multiple authentication mechanisms
without having to pre-negotiate a particular one. There are currently
about 40 different methods defined.
EAP authentication is initiated by the server (authenticator), whereas
many other authentication protocols are initiated by the client (peer).
The EAP authentication exchange proceeds as follows:
1) The authenticator (the server) sends a Request to authenticate
the peer (the client).
2) The peer sends a Response packet in reply to a valid Request.
3) The authenticator sends an additional Request packet, and the
peer replies with a Response. The sequence of Requests and
Responses continues as long as needed. EAP is a ‘lock step’
protocol, so that other than the initial Request, a new Request
cannot be sent prior to receiving a valid Response.
4) The conversation continues until the authenticator cannot
authenticate the peer (unacceptable Responses to one or more
Requests), in which case the authenticator implementation
MUST transmit an EAP Failure (Code 4). Alternatively, the
authentication conversation can continue until the
authenticator determines that successful authentication has
occurred, in which case the authenticator MUST transmit an
EAP Success (Code 3).
107
Information and Network
Security
7.4 DIGITAL SIGNATURE STANDARD
108
At the receiving end, the hash code of the incoming message is generated. Digital Signatures and
Authentication and
This plus the signature is input to a verification function. The verification Authentication Applications
function also depends on the global public key as well as the sender’s
public key (PUa), which is paired with the sender’s private key. The
output of the verification function is a value that is equal to the signature
component r if the signature is valid. The signa- ture function is such that
only the sender, with knowledge of the private key, could have produced
the valid signature.
We turn now to the details of the algorithm.
The Digital Signature Algorithm
The DSA is based on the difficulty of computing discrete logarithms and
is based on schemes originally presented by ElGamal [ELGA85] and
Schnorr [SCHN91].
Figure summarizes the algorithm. There are three parameters that are pub-
lic and can be common to a group of users. A 160-bit prime number q is
chosen. Next, a prime number p is selected with a length between 512 and
1024 bits such that q divides (p - 1). Finally, g is chosen to be of the form
h(p - 1)/q mod p, where h is an integer between 1 and (p - 1) with the
restriction that g must be greater than 1.2 Thus, the global public-key
components of DSA have the same for as in the Schnorr signature scheme.
With these numbers in hand, each user selects a private key and generates
a public key. The private key x must be a number from 1 to (q - 1) and
should be cho- sen randomly or pseudorandomly. The public key is
calculated from the private key as y = gx mod p. The calculation of y
given x is relatively straightforward. However, given the public key y, it is
believed to be computationally infeasible to determine x, which is the
discrete logarithm of y to the base g, modp
109
Information and Network To create a signature, a user calculates two quantities, r and s, that are
Security
func- tions of the public key components (p, q, g), the user’s private key
(x), the hash code of the message H(M), and an additional integer k that
should be generated randomly or pseudorandomly and be unique for each
signing. At the receiving end, verification is performed using the formulas
shown in Figure.The receiver generates a quantity v that is a function of
the public key com- ponents, the sender’s public key, and the hash code of
the incoming message. If this quantity matches the r component of the
signature, then the signature is validated.
Figure depicts the functions of signing and verifying.
The structure of the algorithm, as revealed in Figure, is quite interesting.
Note that the test at the end is on the value r, which does not depend on the
message at all. Instead, r is a function of k and the three global public-key
components. The multiplicative inverse of k (mod q) is passed to a
function that also has as inputs the message hash code and the user’s
private key. The structure of this function is such that the receiver can
recover r using the incoming message and signature, the public key of the
user, and the global public key. It is certainly not obvious from Figure that
such a scheme would work. A proof is provided in Appendix K. Given the
difficulty of taking discrete logarithms, it is infeasible for an oppo-nent to
recover k from r or to recover x from s.
Another point worth noting is that the only computationally demanding
task in signature generation is the exponential calculation gk mod p.
Because this value does not depend on the message to be signed, it can be
computed ahead of time.
Server. The server hosts the service the user wants to access
111
Information and Network First, there are three crucial secret keys involved in the Kerberos flow.
Security
There are unique secret keys for the client/user, the TGS, and the server
shared with the AS.
7. TGS sends a valid session key for the service to the client
8. Client forwards the session key to the service to prove the user has
access, and the service grants access.
7.5.2 X.509 Authentication
X.509 is a standard format for public key certificates, digital documents
that securely associate cryptographic key pairs with identities such as
websites, individuals, or organizations.
First introduced in 1988 alongside the X.500 standards for electronic
directory services, X.509 has been adapted for internet use by the IETF’s
Public-Key Infrastructure (X.509) (PKIX) working group. RFC
5280 profiles the X.509 v3 certificate, the X.509 v2 certificate revocation
list (CRL), and describes an algorithm for X.509 certificate path
validation.
Common applications of X.509 certificates include:
Code signing
Document signing
Client authentication
Government-issued electronic ID
Key Pairs and Signatures
No matter its intended application(s), each X.509 certificate includes
a public key, digital signature, and information about both the identity
associated with the certificate and its issuing certificate authority (CA):
The public key is part of a key pair that also includes a private
key. The private key is kept secure, and the public key is included in
the certificate. This public/private key pair:
Allows third parties to send messages encrypted with the public key
that only the owner of the private key can decrypt.
115
Information and Network
Security
Certificate Chains
For both administrative and security-related reasons, X.509 certificates are
typically combined into chains for validation. As shown in the screenshot
from Google Chrome below, the SSL/TLS certificate for www.ssl.com is
signed by one of SSL.com’s intermediate certificates, SSL.com EV SSL
Intermediate CA RSA R3 . In turn, the intermediate certificate is signed
by SSL.com’s EV RSA root:
For publicly trusted websites, the web server will provide its own end-
entity certificate, plus any intermediates required for validation. The root
CA certificate with its public key will be included in the end user’s
operating system and/or browser application, resulting in a complete chain
of trust.
116
Revocation Digital Signatures and
Authentication and
Authentication Applications
X.509 certificates that must be invalidated before their Not Valid
After date may be revoked. As mentioned above, RFC 5280 profiles
certificate revocation lists (CRLs), time-stamped lists of revoked
certificates that can be queried by browsers and other client software.
7.5.3 Public-Key Infrastructure
The most distinct feature of Public Key Infrastructure (PKI) is that it uses
a pair of keys to achieve the underlying security service. The key pair
comprises of private key and public key.
Since the public keys are in open domain, they are likely to be abused. It
is, thus, necessary to establish and maintain some kind of trusted
infrastructure to manage these keys.
Key Management
It goes without saying that the security of any cryptosystem depends upon
how securely its keys are managed. Without secure procedures for the
handling of cryptographic keys, the benefits of the use of strong
cryptographic schemes are potentially lost.
It is observed that cryptographic schemes are rarely compromised through
weaknesses in their design. However, they are often compromised through
poor key management.
There are some important aspects of key management which are as
follows −
117
Information and Network There are two specific requirements of key management for public
Security
key cryptography.
Certification Authority.
Registration Authority.
Anyone who needs the assurance about the public key and
associated information of client, he carries out the signature
validation process using CA’s public key. Successful validation
assures that the public key given in the certificate belongs to the
person whose details are given in the certificate.
The process of obtaining Digital Certificate by a person/entity is
depicted in the following illustration.
119
Information and Network Issuing digital certificates − The CA could be thought of as the
Security
PKI equivalent of a passport agency − the CA issues a certificate
after client provides the credentials to confirm his identity. The CA
then signs the certificate to prevent modification of the details
contained in the certificate.
Hierarchy of CA
The root CA is at the top of the CA hierarchy and the root CA's
certificate is a self-signed certificate.
The CAs under the subordinate CAs in the hierarchy (For example,
CA5 and CA6) have their CA certificates signed by the higher-level
subordinate CAs.
121
Information and Network
Security
122
7.6 SUMMARY Digital Signatures and
Authentication and
Authentication Applications
The Digital Signature is a technique which is used to validate the
authenticity and integrity of the message.
Kerberos has made the internet and its denizens more secure, and
enables users to do more work on the Internet and in the office
without compromising safety.
Digital Certificates are not only issued to people but they can be
issued to computers, software packages or anything else that need to
prove the identity in the electronic world.
7.7 QUESTIONS
123
Information and Network 5. How does CHAP - Challenge-handshake authentication protocol
Security
works?
6. Write a short note on EAP - Extensible Authentication Protocol.
7. Elaborate Digital Signature Standard
8. Explain The Digital Signature Algorithm.
9. Write a short note on Kerberos
10. How X.509 Authentication works?
11. What is Public Key Infrastructure (PKI)?
12. Write a short note on Digital Certificate.
http://www.facweb.iitkgp.ac.in/~sourav/AuthenticationRequirement
s.pdf
https://doubleoctopus.com/security-wiki/protocol/extensible-
authentication-protocol/
https://www.brainkart.com/article/Digital-Signature-Standard_8465/
https://www.varonis.com/blog/kerberos-authentication-explained/
https://www.simplilearn.com/what-is-kerberos-article
https://www.ssl.com/faqs/what-is-an-x-509-certificate/
https://blog.avast.com/the-importance-of-authentication-avast
124
8
ELECTRONIC MAIL SECURITY AND IP
SECURITY
Unit Structure :
8.1 Objectives
8.2 Introduction
8.4 S/MIME
8.6 IP Security
8.6.1 Overview
8.10.1 Implementing SA
8.2 INTRODUCTION
Prior to the Pretty Good Privacy technique was introduced, the email
provider, Internet Provider, hackers, or even the government could view
and read your messages.
But later, PGP was developed in the 1990s by Phil Zimmermann, allowing
email and any other types of messages to be exchanged securely.
In today's time, PGP has already been standardized into OpenPGP, which
enables anyone to write Pretty Good Privacy (PGP) software which is
interoperable and compatible with other implementations.
126
8.3.1 What is PGP? Electronic Mail Security
and IP Security
PGP is a cryptographic technique that allows people to communicate
securely online. PGP is an open source and free of cost software package
for providing email security.
When you send any mail using PGP technique, the mail content is
converted into ciphertext which is in an unreadable format before it passes
over the Internet. Its only the recipient who has the key can convert the
unreadable text back into the readable format.
PGP also helps in authenticating the identity of the sender and verifies that
the message was not modified during the transmission of the message.
OpenPGP.js is one of the world’s most widely used OpenPGP libraries
and it has been closely audited by the security experts.
Hence, we can easily say that the digital signature technique uses one
secret key, one hash function, and two private-public key pairs.
127
Information and Network
Security
The following steps shows how PGP generates the original message using
a combination of three keys and hashing:
128
At the receiver’s end, the recipient receives the combination of Electronic Mail Security
and IP Security
message, digest and the encrypted secret key and message digest.
By using the receiver's private key, the encrypted secret key is
decrypted to get the one-time secret key.
The secret key is however then used to decrypt the combination of
the message and digest.
By using the sender's public key, the digest is decrypted
To create a digest, the original message is hashed by using a hashing
function.
Now, both the digests are compared. If both of the digests are equal
then it means that all the aspects of security are maintained.
Compatibility issues: Both the recipient and the sender must have
compatible versions of PGP. For example, if a sender encrypts an
email message by using PGP with one encryption technique, and the
receiver has a different version of PGP then the data cannot be read.
8.4 S/MIME
129
Information and Network 8.4.1 What is S/MIME?
Security
S/MIME, or Secure/Multipurpose Internet Mail Extensions, is a type of
“end-to-end” encryption technology that allows the sender to encrypt the
emails messages.
S/MIME implements asymmetric cryptography to protect our emails from
unwanted access by unauthorized persons.
It allows us to digitally sign our emails to verify the sender as an
authorised sender of the email message, making it effective against
attacks.
8.4.2 How does S/MIME work?
S/MIME uses a pair of mathematically associated keys (private key and a
public key) to operate.
It is operationally impossible to find out the private key based on the
public key.
Emails are basically encrypted using the recipient’s public key.
The email can only be decrypted with the recipient’s private key, which is
only known to the recipient.
You can be assured that only the intended recipient is able to access the
confidential data of your emails unless the private key is compromised.
An S/MIME certificate must be installed on both the email clients, the
recipient and the sender.
S/MIME also attaches a digital signature to an email message which
verifies that the sender is authorized to send emails.
People usually think, is S/MIME Certificate needed even If we Have an
Encrypted Email Server?
There’s a difference in the way email server certificates work and
S/MIME certificates work.
Rather than the email messages, Email server certificates basically encrypt
the email communication channel; meaning it encrypts emails during
transmission.
While S/MIME certificates encrypt the email messages.
Hence, hackers can get inside the server and have access to your emails
even if you have a digital certificate installed on your email server,
Here’s where S/MIME certificates come into picture.
130
How Does an S/MIME Certificate Work in Email Security? Electronic Mail Security
and IP Security
Non repudiation: At any point, the sender cannot deny the email and
its contents were sent by him/her as a digital signature as a proof that
the email message has been received from the signer’s email client.
132
8.6 IPSECURITY - OVERVIEW Electronic Mail Security
and IP Security
IPSec uses two protocols to secure the data or traffic. These protocols are
AH (Authentication Header) and ESP (Encapsulation Security Payload).
IPSec Architecture also includes algorithms, protocols, DOI(Domain of
Interpretation), and Key Management. All the above stated components
are essential to provide the three main services:
Confidentiality
Integrity
Authentication
136
Electronic Mail Security
and IP Security
138
● Security Parameter Index(SPI): This parameter is defined in the Electronic Mail Security
and IP Security
Security Association. It gives a unique number to the connection that
is established between a Client and a Server.
● Sequence Number: A Unique Sequence number is assigned to
every packet so that at the receiver end the packets are arranged
sequentially to maintain the order and read the message meaningful..
● Payload Data: Payload data is the actual message that is to be
encrypted using encryption algorithm to achieve confidentiality
during transmission of packet.
● Padding: These are the extra bits added to the original message in
order to maintain confidentiality.
● Next Header: Next header defines the type of header which is
attached after the Encapsulating Security Payload Header
● Authentication Data This field is optional in ESP packet format
which is used to verify the identity of the sender.
8.10.1 Implementing SA
The Security Association (SA) agrees upon a shared security protocol
between 2 network endpoints systems to communicate securely.
In the Security Association (SA), both the parties (the sender and the
receiver) need to communicate before the actual data exchange. Security
association informs what security parameter index, secret key and hashing
algorithm are to be used.
143
9
WEB SECURITY AND INTRUSION
Unit Structure :
9.1 Objectives
9.2 Web Security Considerations
9.2.1 Introduction
9.2.2 Web Security threats
9.2.3 Web traffic security approaches
9.3 Secure Socket Layer & Transport Layer Security
9.3.1 SSL - Introduction
9.3.2 SSL Protocol Stack
9.3.3 TLS - Introduction
9.3.4 How does TLS work?
9.4 Secure Electronic Transaction
9.5 Intruders
9.5.1 Introduction
9.5.2 Types of intruders
9.6 Intrusion Techniques
9.7 Intrusion Detection
9.7.1 What is an Intrusion Detection System?
9.7.2 Types of IDS
9.8 Unit End Questions
9.1 OBJECTIVE
9.2.1 Introduction:
Web security is a client/server programme that runs via the Internet and
intranets using TCP. Web security, sometimes referred to as "cyber
security," is safeguarding data by avoiding, detecting, and reacting to
assaults.
The World Wide Web is highly apparent. Many security vulnerabilities
are hidden in complex software. Web servers are simple to set up and
maintain.
9.2.2 Web Security Threats -
Passive and active assaults are two methods to categorize these risks.
SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are
two Internet standards (TLS). There are two options for
implementation at this level. SSL can also be included as part of a
specific bundle.
145
Information and Network Although Web browsers are simple to use, Web servers are simple to set
Security
up and administer, and Web content is becoming more complicated, the
underlying software is extremely complex.
Web-based services are frequently used by casual and unskilled users.
Such users are often unaware of the security risks they face and lack the
tools and knowledge necessary to take effective countermeasures.
Some of the countermeasures to be adopted are as follows:
Updated Software -
Keeping your software up to date is essential. It is crucial in
maintaining the security of your website.
SQL Injection -
It's a hacker's effort to alter your database. It's simple to include
malicious code in your query that may be used to modify your
database, such as changing tables, retrieving information, or deleting
data.
Error Messages -
You must be cautious in how much information you provide in error
messages. If a user is unable to log in, for example, the error
message should not indicate which field is incorrect: username or
password.
Validation of Data -
Validation should be done both on the server and on the client.
Passwords -
It's a good idea to impose password restrictions such as a minimum
of eight characters, including upper- and lower-case letters,
numbers, and special characters. In the long run, it will aid in the
protection of user information.
Upload files -
The user's file might contain a script that, when run on the server,
launches your website.
SSL -
When sending personal information between a website and a web
server or database, it is best to utilize the SSL protocol.
146
9.3 SECURE SOCKET LAYER AND TRANSPORT Web Security
and Intrusion
LAYER SECURITY
SSL encrypts the data before it is sent to the internet i.e., anyone
who tries to steal the data will see a ciphertext that is impossible to
decode.
147
Information and Network 9.3.2 SSL Protocol Stack
Security
148
Web Security
and Intrusion
There are 3 primary components to what the TLS protocol accomplishes:
Encryption, Authentication, and Integrity.
Encryption
hides the information being transferred from third events.
Authentication
guarantees that the events replacing information are who they
declare to be.
Integrity
verifies that the statistics have no longer been cast or tampered with.
9.3.4 How does transport Layer security work?
TLS implements customer server handshake mechanism to create an
encrypted, authenticated and secure connection
Here are the following steps:
149
Information and Network
Security
150
The consumer and server make touch and choose the cipher suite with a Web Security
and Intrusion
view to be used in the course of their message change. (Authentication &
Encryption mixture)
Authentication:
In TLS, a server proves its identification to the patron. The patron
may additionally want to prove its identification to the server. PKI,
the use of public/personal key pairs, is the premise of this
authentication. The correct method used for authentication depends
on the cipher suite negotiated.
Key change:
The client and server change random numbers and a special variety
referred to as the Pre-grasp secret. Those numbers are mixed with
additional facts allowing patrons and servers to create their shared
secret, called the grasp secret. The grasp keys used by consumer and
server to generate the write MAC mystery, that is the session key
used for hashing, and the write key, that's the consultation key used
for encryption.
The TLS Handshake Protocol entails the subsequent steps:
If the server has asked for a certificate from the customer, the
customer sends it.
151
Information and Network Service providers who used to accept credit card payments had to pay card
Security
charge, authorization fee, etc.
Also, there were security and confidentiality issues as merchants were able
to view card details of customers and customers sometimes filled wrong
card details.
1996 was not the 1st time when SET protocol was used. It was introduced
way back, but due to disadvantages like installing complex software for
SET and strong encryption technology that made the system complex to
process, it was not very popular.
All these modifications made SET protocol easy to use, safe and authentic.
SET is successful by providing features mentioned below:
Provides interoperability.
Entities in SET:
cardholder – customer
merchant – supplier
certificate authority – authority that issue certificates like X.509V3
issuer – institute that provider payment card
acquirer – provides relation with merchant
payment gateway – 3rd party
Functionalities of SET:
1. Authentication:
153
Information and Network Both of these authentications are done using standard
Security
X.509V3 certificates.
2. Integrity:
modification of messages with the help of signatures in SET is not
supported as a result instead digital signatures are used to protect
any unauthorized access.
3. Confidentiality:
SET ensures that messages of merchants and customers are not
made publically available. Hence, maintains confidentiality of both.
Messages are encrypted using traditional DES.
How does SET protocol work?
154
Later these credit card details are checked if they are valid or not. If the Web Security
and Intrusion
card is valid it will check if the card has enough to make a purchase or not.
The merchant will now fulfill the order and after shipping the order he
requests for payment. The payment gateway receives the request and
transfers the fund from cardholders issuing institute to the merchant's
account.
The merchant then sends the confirmation to the cardholder.
The process is completed by updating the amount in cardholders issuing
bank after depositing payment to merchants bank.
9.5 INTRUDERS
9.5.1 Introduction:
An intruder is someone who enters an area without a permit to enter. The
legal definition of intruder is, Intruders are the attackers who try to breach
the protection of a network. They attack the network so as to gain
unauthorized access to confidential data.
In the above example, Lily and John are communicating over a web
connection. Bob being the intruder is trying to gain access to their
communication and modifying the messages before they are sent to the
receiver. Thus, we can see there’s loss of confidentiality and integrity. We
conclude that the intruder can result in loss of three main security goals
(CIA triads) i.e., confidentiality, integrity and availability. Intrusions
usually involve stealing of confidential information or a network's
valuable resource, endangering the network and it’s data.
To detect and respond to network intrusions, organizations need to know
how intrusions work and study the response systems that are designed
with various attack techniques for destruction. Considering the current
scenario where moving on digital networks, it can be very difficult to
detect unauthorised activities.
155
Information and Network 9.5.2 Types of Intruders
Security
Based on the type of attack Intruders are classified into three types they
are:
1. Masquerader
An unauthorized person penetrates a system to gain access to a
legitimate account. it's an attack during which the attacker pretends
to be some other person. For e.g. The attacker could send the
updated sales figure to Bob and sign the email as Alice.
Malicious insider
Careless insider
A mole
156
Traditional security measures tend to target external threats and Web Security
and Intrusion
aren't always capable of finding an interior threat emanating from
inside the organization. So, misfeasors may be a dangerous attack.
3. Clandestine user
Clandestine user is a person who takes administrative control of the
system having confidential information and uses this control to
escape audit and gain access controls.
Clandestine can be either an outsider or insider of an organisation.
An intruder attack ranges from benign to dangerous. At the benign
end, there are many people who only explore the internet and see
what is out there.
At the other end, people who try to read confidential data, perform
unauthorized modifications to the data, or hamper the information.
One of the most common attacks in intrusion is password guessing
Examples of intrusions:
iv. Once the Trojans programs are executed, then it can allow any
hackers to steal your confidential data, and gain access to your
system.
5. Worms:
ii. Spreading of worms does not need any human intervention. - The
capacity of worms’ replication is more. It can transmit thousands of
copies of itself thus can result in destructive effects.
v. Worms are capable of deleting and altering files. They can also
infect a workstation or other device with far more malicious code.
159
Information and Network 6. Traffic Flooding:
Security
i. Traffic Flood is one of the types of DoS (Denial of Service)
attack which aim at web servers.
ii. It simply creates traffic loads that are too large for network
intrusion detection systems to fully examine.
iii. The attack takes advantage of a feature of the HTTP protocol
by simultaneously initiating many connections to attend to a
single demand.
iv. Attackers can sometimes carry out undetected attacks and even
induce an undetected "fail-open" state in the resultant
congested and chaotic network environment.
161
10
MALICIOUS SOFTWARE AND FIREWALL
Unit Structure :
10.1 Objectives
10.2 What is Malicious Software?
10.2.1 Types of malicious software
10.3 Virus and its threats
10.3.1 What is a virus?
10.3.2 Types of viruses
10.3.3 Life Cycle of virus
10.3.4 Virus countermeasures
10.4 DDOS
10.4.1 DOS
10.4.2 DDOS
10.5 Firewall Design Principles
10.5.4 Introduction
10.5.2 Characteristics of Firewall
10.6 Types of firewall
10.7 Unit End Questions
10.1 OBJECTIVE
What are malwares and in detail about virus and its countermeasures
Worms
Zombies
2. Need host program:
Trapdoors
Logic Bombs
Trojan horses
Viruses
Record infectors
These most often connect to program documents but can infect any
file with executable code, consisting of script files or software
configuration documents. When the program, script, or
configuration is carried out, the virus is executed nicely.
Multipartite viruses
Multipartite viruses infect boot information as well as files. With its
hybrid nature, a multipartite virus inherits the worst features of each
of its parents and consequently is way more contagious and adverse
than both.
Macro viruses
Macro viruses infect macro-enabled files, especially in the Microsoft
office suite of programs-extra particularly, Microsoft Word and
Excel. Whilst opened, an inflamed document executes a macro
robotically, or the consumer does so by accident. The macro inflicts
damage after which infects other files on the disk. A macro is hard
and fast of executable instructions designed to run in place of a
repetitive task. Although macros aren't particular to Microsoft
merchandise, it is through Microsoft merchandise that many macro
viruses unfold. Macro viruses are the most commonplace kind of
viruses, but they do pretty little damage.
Stealth viruses
Stealth viruses use many strategies to thwart detection. One
approach is to redirect the addresses inside an application that point
to different programs or gadget facts and have them a factor to the
virus file as a substitute. Whilst this system calls for that
supplementary software or system data, it truly runs the virus code.
This infects the record without absolutely injecting additional code,
which could show up as a symptom of virus scanning software
programs. Every other, not unusual stealth approach modifies a
record but displays its size as it turned into before contamination.
Therefore, it nullifies the ability to use the reporting period as an
indicator of contamination.
Encrypted viruses
Encrypted viruses enjoy the advantages of other encrypted fabrics.
Initially, encrypted viruses seem no longer as viruses, but as
nondescript without sense. However, whilst an inflamed program is
accomplished, a small piece of undeniable, unencrypted code
decrypts the relaxation of the virus, which then proceeds to do its
damage. When, and if, an encrypted virus is detected, it is very
tough to research because it is not difficult to reverse engineer just
like the unencrypted viruses. This makes it hard to decide the
structure of the virus and the perfect scope of its payload.
164
Encryption is most useful while coupled with a polymorphic Malicious Software
and Firewall
approach.
Polymorphic viruses
Polymorphic viruses try to avoid detection by altering their shape or
the encryption strategies. Each time contamination happens, a
polymorphic virus modifications its shape, puzzling virus (detection)
scanning software. Due to the fact virus scanners use specific
“signature” characteristics to pick out viruses, any virus that adjusts
its shape affords a formidable new assignment.
10.3.3 Life Cycle of Virus:
There are four stages in a life cycle of virus:
1. Dormant Phase
2. Propagation Phase
3. Triggering Phase
4. Execution Phase
1. Dormant Phase:
Examples:
165
Information and Network 4. Execution Phase:
Security
Virus executes its function which can be harmless like just a
message on the screen or damaging like deletion of
information or programs.
10.3.4 Virus countermeasures
1. Antivirus:
Rather than detecting and removing viruses, it is always better to
prevent it. It does not allow viruses to enter into the system and also
blocks it to make any modifications.
Tries to locate the virus by the type of its infection.
Once detected, it finds out that specific virus which has infected the
program.
Once identified, try to remove almost all virus traces from infected
areas so that it cannot spread anymore.
A good antivirus should be installed and a\updated regularly
Generation of antivirus
There are mainly four generations of antivirus as stated below:
A. 1st Generation
a. st generation antiviruses are also known as simple scanners.
b. Virus signature needed for identification of virus.
c. But these signature specific scanners can scan only known
viruses
d. Length of programs and alteration is observed to check for
virus attacks.
B. 2nd Generation
a. 2nd generation antivirus are also known as Heuristic scanners,
b. It does not depend on simple virus signatures.
c. Basic concept behind this is to search those blocks of codes
which are associated with viruses.
d. Example, such programs can find out the encryption key used
for a virus, then decrypt it and eliminate the virus and cleans
code.
e. It checks for integrity means if a virus affects the program
without altering checksum then integrity check traps that
alteration.
166
C. 3rd Generation Malicious Software
and Firewall
a. 3rd generation antiviruses are also known as activity traps.
b. They reside in memory.
c. Rather than viruses' structure, it searches for viruses based on
their action.
d. But maintaining a huge virus signatures database is not
needed.
e. But it is needed to find out a small set of actions which
identifies the attempted infection and then intervenes it.
D. 4th Generation
a. 4th generation antivirus is also known as full featured
protection.
b. It consists of many antivirus techniques combined with other
packages.
c. It includes components for activity and scanning traps.
d. It also controls access capability that means restricting virus
ability to enter into a system and restricting virus capabilities
to alter files in order to pass infection.
e. A wide range of defence strategy is implemented with this
generation of antivirus extending the scope of defence to
tackle more general purpose measures for computer security.
2. Generic Decryption (GD)
GD facilitates the antivirus program to speedily scan and easily
detect most complicated polymorphic viruses.
3. Digital Immune System
167
Information and Network 4. Behaviour Blocking Software
Security
Behaviour blocking software along with OS observes
behaviour of a program in real time for harmful actions.
168
10.4 DDOS Malicious Software
and Firewall
169
Information and Network The attacker gains access to number of machines and use these
Security
machines to attack the victim
10.5.1 Introduction
A firewall is basically a single point which keeps unauthorized users
blocked from the protected network, thus prohibiting potential vulnerable
services from leaving or entering the private network, and provides
protection from various kinds of cyber attacks, IP spoofing and routing
attacks.
A firewall monitors security related events. Audits and alarms are usually
implemented on the firewall system.
A firewall is a protection technology that controls outgoing and incoming
packets totally based on predefined security rules. A firewall is generally
like a barrier between a reliable and an untrusted community, which
includes the Internet, Intranet. The devices which provide firewalls for
people’s safety can be routers which are used for routing. A firewall
analyses the packets entering and leaving and filters them so that
suspicious and unsecured actions don’t cause harm to the system.
All traffic passing from outside to inside, and vice versa, has to pass
through the firewall. This is possible by blocking all access to the
private network except via the firewall.
There are various types of firewalls that are used which implement
different types of security policies.
171
Information and Network IP protocol field – It defines the transport protocol through which
Security
the packet is received.
The packet filter has a list of rules, based on the matches in the TCP or IP
header fields, appropriate action will be taken regarding the packets. If
there’s any match found to one of the predefined rules, then that rule is
invoked to decide whether to discard or forward the packet. If there’s no
match to any rule, then a predefined default action will be taken.
Two default policies are possible:
It is very easy to log and audit all the incoming traffic at the
application level
Disadvantages of Application level gateway
173
Information and Network
Security
For security reasons, only the services that are considered essential
are installed on the Bastion host by the network administrator.
Every proxy maintains audit information about all traffic logs, every
connection established and the duration of every connection.
174
4. Stateless Firewall Filter Malicious Software
and Firewall
It does not check the entire packet but only checks if the packet
satisfies the redefined set of security rules.
175
Information and Network 5. Stateful Firewall
Security
Unlike Stateless firewalls, Stateful firewalls monitor the entire state of
network connections. It tracks the state of network connections when the
data packets are being filtered.
As the Stateful firewalls keeps track of the state, it is aware of all the
communication paths and has the capability to implement many IP
security functions such as encryptions, authentication and so on.
This Firewall inspects the packets for a match with the rule in the firewall.
If a match is not found, it is simply discarded but if the match is found
then it is allowed into the network and can travel freely within the
network.
Common example is the Transport Control Protocol(TCP). It simply saves
the connection record by storing its port number, source and destination IP
address, etc.
Stateful firewall advantages-
REFERENCE
177