Sunteți pe pagina 1din 129

Unit-I

Topics:
Computer Security | Cryptography

1 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. Short note on need for Network Security
 Initial computer applications had no or at best, very little security. Computer data was consider to
be useful but not something to be protected.
 When computer applications were developed to handle financial and personal data, the real need
for security was felt like never before.
 Later People realized that data on computers is an extremely important aspect of modern life.
Therefore various areas began to gain prominence.
We need security:
 To protect our data, files and folders
 To protect our resources
 To protect e-commerce transaction information: user-id, password, pin, etc.
 To protect our site from getting blocked by any attack such as DOS
 To protect our IP Address:
 To protect our e-mails:
 To protect incoming packets so that no virus / worms comes in
 To protect outgoing packets so that secrets does not leak out.
Two typical examples of such security mechanisms were as follows:
 Provide a user id and password to every user and use that information to authenticate a user.
 Encode information stored in the database in some fashion so that it is not visible to users who do
not have the right permission.

 Organization employed their own mechanisms in order to provide for these kinds of basic security
mechanisms.
 As technology improved the communication infrastructure became extremely mature and newer
and newer application began to be developed for various user demands and needs.
 So people realized that the basic security measures were not quite enough.

Q2. Explain various security models.


An organization can take several approaches to implement its security model.
Following are types of security model.
2 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
No Security
 In this simplest case, the approach could be a decision to implement no security at all.
Security through Obscurity:
 In this model, a system is secure simply because nobody knows about its existence and contents
 This approach cannot work for too long, as there are many ways an attacker can come to know
about it
Host Security
 In this model, the security for each host is enforced individually.
 This is a very safe approach but the trouble is that it cannot scale well.
Network Security
 Host security is tough to achieve as organizations grow and become more diverse.
 In this technique the focus is to control network access to various hosts and their services rather
individual host security.
Q3. What are key principles of security? Brief them
Following are key principal of Security as follows.
 Confidentiality
 Authentication
 Availability
 Access Control
 Integrity
 Non-Reputation
Confidentiality
 It specifies that only the sender and intended recipient(s) should be able to access the content of
message.
 Confidentiality gets compromised if an unauthorized person is able to access the message.
 This type of attack is called as interception.
 Interception causes loss of message confidentiality.

Authentication
 Authentications mechanisms help establish proof of identities.
 The authentication process ensures that the origin of an electronic message or document is
correctly identified.
 This type of attack is called as Fabrication.

3 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Fabrication is possible in absence of proper authentication mechanisms.

Integrity:
 When the content of message is changed after sender sends it, but before it reaches the intended
recipient, we say that the integrity of message is lost.
 This type of attack is called as modification.
 Modification causes loss of message integrity.

Non Repudiation
 There are situations where a user sends a message and later on refuses that he/she has sent
that message.
 Non-repudiation does not allow the sender of a message to refuse the claim of not sending that
message.

Access control
 The principle of access control determines who should be able to access what.
 An access Control List (ACL) is a subset of an access control matrix.
 Access controls specifies and controls who can access what.

4 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Availability
 The principle of availability state that resources should be available to authorize parties at all
times.
 This type of attack is called as Interruption.
 Availability is defeated if a may not be able to contact a server computer such an attack is called
interruption.
 Interruption puts the availability of resources in danger.

Q4.What is the ethical and legal issues in computer security system?


 Most ethical and legal issues in computer system are in the area of individual’s right to privacy
versus the greater good of a larger entity i.e. a company or a society.
 For example, tracking how employees use computers, crowd surveillance, managing customer
profiles, tracking a person’s travel with passport and so on. A key concept in resolving this issue
is to find out, what is a person’s expectation of privacy.

Classically, the ethical issues in security system are classified into following 4 categories:

 Privacy: This deals with the right of an individual to control personal information. It is the
protection of personal or sensitive information. Privacy is subjective. Different people have
different ideas of what privacy is and how much privacy they will trade for safety or convenience.
 Accuracy: This talks about the responsibility for the authenticity, fidelity an accuracy of the
information.
 Property: This determines who the owner of the information is and who controls access.
 Accessibility: This deals with the issue of the type of information, an organization has the right
to collect. And in that situation, it also expects to know the measures which will safeguard against
any unforeseen eventualities.

When dealing with legal issues, we need to remember that there is hierarchy of regulatory bodies
that govern the legality of information security. The hierarchy can be roughly described as
follows:

5 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 International: Ex. International Cyber-crime Treaty
 Federal: Ex. FERPA, GLB, HIPAA
 State: Ex. UCITA, SB 1386 etc.
 Organization: e.g. Computer Use policy

Q5.List and explain types of criminal attacks.

 Criminal attacks are those attacks which occur through computer system. Following is list of few
attacks which belongs to criminal attack.

Q6. Explain Passive and Active attack and their types.


Passive Attack
 In passive attack, attacker monitors the data.
 The attacker aims to obtain information that is in transit.
 The terms passive indicates that the attacker does not attempt to perform any modifications to
the data.
 Therefore passive attacks are harder to detect.
 General approach to deal with passive attack is to think about prevention rather than detection
or corrective actions.
6 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Passive attack can be classified into two types:
Release of message contents
Traffic Analysis
Release of message content:
 It states that when we send a confidential email message to our friends we desire that only he
or she able to access It., otherwise the contents of message are released against our wishes to
someone else.
 If the content of message is released against our wish to someone else then it is called as
Release of message content.
Traffic analysis:
 During the passing of messages passive attacker could try to figure out the similarities between
them to come with some sort of pattern that provides her some clues regarding the
communication that is taking place
 Attempts of analyzing encoded message to come up with likely patterns are the work of the traffic
analysis attack.
Active Attacks
 Active attacks are based on the modification of the original message in some manner, or in the
creation of false message.
 These attacks cannot prevent easily.
 They can be detecting with some effort and attempts can be made to recover from them.
 These attacks can be in the form of interruption modification and fabrication.
Active attacks are classified as:

Masquerade

7 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


It is caused when an unauthorized entity pretends to be another entity. Interruption attacks are
also called as Masquerade attacks.
Modification
It can be classified into two types:-
Reply Attack:
In a reply attack, attacker captures a sequence of events, or some data units, and resends them.
Alterations:
In this original content of message is changed.
Denial of service
DOS attacks make an attempt to prevent legitimate users from accessing some services which
they are eligible for Fabrication causes Denial of Service (DOS) attacks.

Q7. Explain Packet Snipping and Packet Spoofing.


When the packet travels from source to destination over the internet, attacker targets this packet.
This attack takes two main forms:
Since the protocol used in this communication is called as Internet Protocol (IP), other names for
these two attacks are:
IP sniffing or Packet Sniffing
IP Spoofing or Packet Spoofing

Packet Sniffing:
Packet sniffing is a passive attack on an ongoing conversation. An attacker need not hijack a
conversation, but instead, can simply observe i.e. sniff packets as they pass by. Clearly, to prevent
an attacker from sniffing packets, the information that is passing needs to be protected in some
ways.
This can be done at two levels:
 The data that is traveling can be encoded in some ways.
 The transmission link itself can be encoded.

Packet Spoofing:

In this technique, an attacker sends packets with an incorrect source address. When this happens,
the receiver i.e. the party who receives the packets containing a false source address would
inadvertently send replies back to the forged address (called as spoofed address) and not to the
attacker.
This can lead to three possible cases:
 The attacker can intercept the reply- If the attacker is between the destination and the forged
source, the attacker can see the reply and use that information for hijacking attacks.
 The attacker need not see the reply-If the attacker's intention was a Denial of Service (DOS)
attack, the attacker need not bother about the reply.
 The attacker does not want the reply- The attacker could simply be angry with the host. So it may
put that host's address as the forged source address and send the packet to the destination. The

8 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


attacker does not want a reply from the destination, as it wants the host with the forged address to
receive it and get confused.

Q8. What is cryptography? Explain various terms related to it.


Cryptography is the arts and science of achieving security by encoding message to make them
non readable.
Following diagram shows the overview of cryptography:

The combination of cryptography and crypto analysis is called cryptology.


Cryptographers: People who indulge in cryptography are known as cryptographers.
Cryptanalysis: The art or science of decrypting a cypher text without knowing the authorized key
is known as cryptanalysis.
Cryptanalysts: People who indulge in cryptanalysis.
Cipher: The method of decryption and encryption is generally known as cipher.
Following are various terms related to cryptography:
Plain Text: It signifies the message that can be understood by sender, recipient and also by
anyone else. It is also called as clear text.
Cipher Text: When the plain text message is codified using any suitable scheme, the resulting
message is called as cipher text.
Encryption: The process of converting plaintext into cipher text using an appropriate key.
Decryption: The process of converting cipher text into plaintext using an appropriate key.
Key: It is the object used to encrypt the plaintext.

Q9. What are the two basic ways of transforming plain-text into cipher-text?
Following are two basic techniques used to convert plain text into cipher text.

9 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q10. What is substitution technique? List various technique based on it.
Substitution Technique
In the substitution technique characters of plain text message are replacing by other characters,
words or symbols.
Types of substitution technique:
 Caesar Cipher
 Modified version of Caesar cipher
 Mono alphabetic cipher
 Homophonic
 Polygram cipher
 Poly alphabetic
 Hill Cipher
Caesar Cipher:
This cryptographic scheme proposed by Julius Caesar is one special case of substitution cipher
where each alphabet in the message is replaced by an alphabet, three places down the line, in the
alphabetical order.
Thus “A” becomes “D” and “B” becomes “E”

Plain Text A B C D E F G H I J K L M N

Cipher Text D E F G H I J K L M N O P Q

Plain Text O P Q R S T U V W X Y Z

Cipher Text R S T U V W X Y Z A B C

Caesar Cipher is very simple. But this simplicity comes with a cost. Obviously it is a very weak
scheme.
Steps:
 Read each alphabet in the cipher text message, and search for it in the second row of the figure
above
 When a match is found, replace that alphabet in the cipher text message with the corresponding
alphabet in the same column but the first row of the table (e.g. if the alphabet in cipher text is J,
replace it with G).
 Repeat the process for all alphabets in the cipher text message.

The process shown above will reveal the original plain text. Thus, given a cipher text message L
ORYH BRX, it is easy to work backwards and obtain the plain text I LOVE YOU as shown below.

10 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Cipher Text L O R Y H B R X

Plain Text I L O V E Y O U

Modified Version of Caesar Cipher:


In this cipher text alphabets corresponding to the original plain text alphabets may not necessarily
be three places down the order, but instead, can be any places down the order. This can
complicate matters a bit.
Thus, we are now saying that D would not necessarily replace an alphabet A in plain text. It can
be replaced by any valid alphabet, i.e. by E or by F or by G, and so on.
Once the replacement scheme is decided, it would be constant and will be used for all other
alphabets in that message. As we know, the English language contains 26 alphabets. Thus, an
alphabet A can be replaced by any other alphabet in the English alphabet set, (i.e. B through Z).
Steps:
 Let k be a number equal to 1.
 Read the complete cipher text message.
 Replace each alphabet in the cipher text message with an alphabet that is k positions down the
order.
 Increment k by 1.
 If k is less than 26, then go to step 2. Otherwise, stop the process. 6. The original text message
corresponding to the cipher text message is one of the 25 possibilities produced by the above
steps.
Mono-alphabetic Cipher:
 The major weakness of the Caesar Cipher is its predictability. Once we decide to replace an
alphabet in a plain text message with an alphabet that is k positions up or down the order, we
replace all other alphabets in the plain text message with the same technique. Thus, the
cryptanalyst has to tryout a maximum of 25 possible attacks, and she is assured of a success.
 In this technique each A can be replaced by any other alphabet (B through Z), each B can also
be replaced by any other random alphabet (A or C through Z), and so on. The crucial difference
being, there is no relation between the replacement of B and replacement of A. That is, if we
have decided to replace each A with D, we need not necessarily replace each B with E-we can
replace each B with any other character.
Homophonic Substitution Cipher:
 The Homophonic Substitution Cipher is very similar to Mono Alphabetic Cipher. In a plain
substitution cipher technique, we replace one alphabet with another, but in this scheme, the
difference is that instead of having a fixed substitution, we can, choose the alphabet from a set.
So in this technique, A can be replaced by {D, H, P, R} B can be replaced by {E, I, Q, S}.
 Homophonic Substitution Cipher also involved substitution of one plain text character with a
Cipher Text character at a time. However the cipher text character can be any one of the chosen
sets.
Polygram Substitution Cipher:
In Polygram Substitution Cipher technique, rather than replacing one plain text alphabet with one
11 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
cipher text alphabet at a time, a block of alphabets is replaced with another block.
For instance, HELLO could be replaced with YUQQW, but a totally different cipher text block
TEUL could replace HELL.

Polyalphabetic Substitution Cipher:


Leon Battista invented this cipher in 1568. This cipher has been broken many times, yet it has
been used extensively. The Vigenere cipher and the Beaufort cipher are its example.
This cipher uses multiple one-character keys. Each of the keys encrypts one plain-text character.
After all keys are used they are recycled.
Hill Cipher:
The Hill Cipher works on multiple letters at the same time. Hence, it is a type of poly-graphic
substitution cipher. Lester Hill invented this in 1929. The hill cipher has its root in its matrix theory
of mathematics. More specifically, we need to know how to compute the inverse of a matrix.
Example:
1. Treat every letter in the plain-text messages as a number, so that A=0, B=1… Z=25.
2. The plain-text message is organized as a matrix of number, based on the above conversion.
For example, if our plain text is CAT. Based on the above step, we know that C=2, A=0,
T=19. Therefore, our plain-text matrix will be as follows:

2
0
1
9 a matrix of randomly chosen keys. The key matrix
3. Now, our plain-text matrix is multiplied by
consist of size n x n. where n is the number of rows in our plain-text matrix. For example we
take the following key matrix:

6 24 1
13 16 10
20 17 15

4. Now, multiply the two matrices, as shown below:

2 6 24 1 31
X =
0 13 16 216
1 10 325
9 20 17
15
12 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
5. Now, compute a mod 26 values of the above matrix. That is, take the remainder after dividing
the above matrix values by 26. That is

31 5
21 Mod 26 = 8
6 13
6. This is because: 31/26=1 with32a remainder of 5: which goes in the above matrix, and so on.
5
7. Now, translating the numbers to alphabets, 5=F, 8=I, and 13=N. therefore our cipher text is
FIN.
8. For decryption, take the cipher-text matrix and multiply it by the inverse of our original key
matrix. The inverse of our original matrix is

8 5 10
21 8 21
21 12 8

9. Now, multiply the two matrices, as shown below:

5 8 5 10
X =
8 21 8
1 21
3 21 12 8
10. Now, compute a mod 26 values of the above matrix. That is, take the remainder after dividing
the above matrix values by 26. That is

210 2
Mod 26 = 0
442
305 19
325
11. Now, translating the numbers to alphabets, 2=C, 0=A, and 19=T. therefore our plain text is
CAT.

Q11. What is transposition technique? List various technique based on it.


Transposition technique:
It is the modified version of substitution technique because this not only substitutes letters but also
makes some sort of permutation over the plain text in order to generate cipher text. Specific
examples include
 Rail fence technique.
 Simple columnar transposition.
 Simple columnar transposition with multiple rounds.
 Vernam cipher
Rail Fence Technique:
It uses a simple algorithm as:

13 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Write down the plain text message as a sequence of diagonals.
 Read the plain text written in step 1 as a sequence of rows.
Example:
Original Plain text message: “COME HOME TOMORROW”.
After we arrange the plain text diagonally, it would like as follows:

Now read the text row by row, write it sequentially.


C-M-H-M-T-M-R-O-O-E-O-E-O-O-R-W
Simple Columnar Transposition Technique:
Basic Technique:
 Write the plain text message row by row in a rectangle of a pre-defined size.
 Read the message column-by column, however, it need not be in the order of columns 1, 2, 3
etc. It can be any random order such as 2, 1, 3 etc.
 The message thus obtained is the cipher text message.
Original Plain Text Message: “COME HOME TOMORROW”.
Let us consider a rectangle with S columns. Therefore, when we write the message into the
rectangle row by row it would look as follows:

Column 1 Column 2 Column 3 Column 4 Column 5 Column 6

C O M E H O

M E T O M O

R R O W

Now read the text in the order of the columns. 4, 6, 1, 2, 5, 3


The cipher text thus obtained is: E-O-W-O-O-C-M-R-O-E-R-H-M-M-T-O
Simple Columnar Transposition Technique with Multiple Rounds:
Here, the basic Simple columnar technique is repeated for multiple rounds. The more number of
rounds, the more complex the cipher becomes. Hence, it is more difficult to crack.
The Basic Algorithm:
 Write the plain text message row-by-row in a rectangle of a pre-determined size
 Read the message column by column in a random sequence

14 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 The message thus obtained as the cipher text message of round 1
 Use this output as a plain text for the next step
Q12. What is transposition technique? List various technique based on it.
Vernam Cipher: The Vernam Cipher, also called as One-Time Pad, is implemented using a
random set of non-repeating characters as the input cipher text. The most significant point her is
that once an input cipher text for transposition is used; it is never used again for any other
message (hence the name one-time pad). The length of the cipher text is equal to the length of the
original plain text.
Following steps are used in Vernam cipher

EXAMPLE:
Let us apply the Vernam cipher algorithm to a plain text message HOW ARE YOU using one
time pad NCBTZQARX to produce a cipher text message UQXTQUYFR.
Below example shows the working of Vernam cipher

Since, it is used as one-time pad and is discarded after a single use, this technique is highly
secure and suitable for small plain text message, but is impractical for large messages.
Q13. Diffie-Hellman Key Exchange Algorithm with example.
Whitefield Diffie and Martin Hellman, in 1976 have come out with a good solution to the problem
of key distribution as mentioned above. The steps of this algorithm are as given below diagram.

15 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Steps for Algorithm:
Assume two parties Alice and Bob want to communicate securely.
 Let Alice and Bob agree upon two large prime nos., say n and g.
 Alice chooses another large random no. say x to calculate another number A such that,
A = g^x mod n
 This no. A is then sent by Alice to Bob.
 Bob also chooses another large random no. say y to calculate another number B such that,
B = g^y mod n.
 This no. B is then sent by Bob to Alice.
 Now, independently, Alice calculates the key KI as: KI = B^xmod n
 Also, Bob independently calculates the key K2 as: K2 = A^y mod n
 As it should be required here in symmetric key cryptography, KI = K2.
Example:
Let us take an actual example, to illustrate above algorithm. Assuming values such as n= 11,
g=7, x=3 and y=6, we have following equations:
 Value of A=7^3mod 11 =343 mod 11 =2.
 Value of B = 7^6mod 11 = 117649 mod 11 = 4.
 Key KI = 4^3mod 11 = 64 mod 11 = 9.
 And, Key K2 = 2^6mod 11 = 64 mod 11 = 9.
 Thus, we find that KI = K2.
 Hence the algorithm is proved.
Q14. Explain the concept of key range and key size.
Key range and Key Size

16 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The concept of key range and key-size are related to each other. Key Range is total number of
keys from smallest to largest available key. An attacker usually is armed with the knowledge of
the cryptographic algorithm and the encrypted message, so only the actual key value remains the
challenge for the attacker.
If the key is found, the attacker can resolve the mystery by working backwards to the original
plaintext message.
In the brute force attack, every possible key in the key-range is tried, until we get the right key.
On an average, the right key is found after trying half of the possible keys in the key-range.
Therefore by expanding the key range to a large extent, longer it will take for an attacker to find
the key using brute-force attack.
The concept of key range leads to the principle of key size. The strength of a cryptographic key is
measured with the key size. Key size is measured in bits and is represented using binary number
system.
Thus if the key range from 0 to 8, then the key size is 3 bits or in other words we can say if the
key size is bits then the key range is 0 to 256. Key size may be varying, depending upon the
applications and the cryptographic algorithm being used, it can be 40 bits, 56 bits, 128 bits & so
on. In order to protect the cipher-text against the brute-force attack, the key-size should be such
that the attacker cannot crack it within a specified amount of time.
From a practical viewpoint, a 40-bit key takes about 3 hours to crack, however a 41-bit key would
take 6 hours and 42-bit key would take 12 hours & so on. This means every additional bit doubles
the amount of time required to crack the key.

QQ15. Explain the various ways of attack, such as known plain-text attack etc.?
Attack Things known to the attacker Things the attacker wants to
find out

17 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Cipher text only  Cipher text of several  Plain text messages
messages, all of which are corresponding to these cipher
encrypted with the same text messages
encryption key  Key used for encryption
 Algorithm used
Known plain  Cipher text of several messages,  Key used for encryption
text all of which are encrypted with  Algorithm to decrypt cipher
the same encryption key text with the same key
 Plain-text messages
corresponding to the above
cipher text messages
 Algorithm used
Chosen plain  Cipher text and associated plain-  Key used for encryption
text text messages  Algorithm to decrypt cipher
 Chooses the plain-text to be text with the same key
encrypted
Chosen cipher  Cipher text of several messages  Key used for encryption
text to be decrypted
 Corresponding plain-text
messages
Chosen text  Some of the above  Some of the above

Q16. What is virus? List the type of virus?


A virus is a computer program that attacks itself to another legitimate program, and causes
damage to the computer system or network.
Below diagram shows the concept of virus.

During its lifetime, a virus goes through four phases:


Dormant Phase: here, the virus is idle. It gets activated based on a certain action or event.
This is an optical phase.
Propagation Phase: in this phase, a virus copies itself, and each copy starts creating more
copies of it, thus propagating the virus.
Triggering Phase: a dormant virus moves into this phase when the action/event for which it
was waiting is initiated.
Execution Phase: this is the actual work of the virus, which could be harmless or
destructive.
Viruses can be classified into the following categories:

18 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Parasitic virus: this is the most common form of virus. Such a virus attaches itself to
executable files and keeps replicating. Whenever the infected file is executed, the virus looks
for another executable files to attach itself and spread.
 Memory-resident virus: this type of virus first attaches itself to an area of the main memory
and then infects every executable program that is executed.
 Boot sector virus: this type of virus infects the master boot record of the disk and spreads
on the disk when the operating system starts booting the computer.
 Stealth virus: this virus has intelligence build in, which prevents anti-virus software programs
from detecting it.
 Polymorphic virus: a virus that keeps changing its signature on every execution, making it
very difficult to detect.
 Metamorphic virus: in addition to changing its signature like a polymorphic virus, this type of
virus keeps rewriting itself every time, making its detection even harder.

Q17. What is worm and Trojan horse?


Similar in concept to a virus, a worm is actually different in implementation. A virus modifies a
program. A worm, however, does not modify a program. Instead, it replicates itself again and
again.
The replication grows so much that ultimately the computer or the network, on which the worm
resides, becomes very slow, coming to a halt. Thus, the basic purpose of a worm attack is different
from that of a virus. A worm attack attempts to make the computer or the network under attack
unusable by eating all its resources.
A worm does not perform any destructive action, and instead, only consumes system resources to
bring it down.

A Trojan horse is a hidden piece of code, like a virus. However, the purpose of a Trojan horse is
different. Whereas the main purpose of a virus is to make some sort of modification to the target
computer or network, a Trojan horse attempts to reveal confidential information to an attacker. In

19 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


a similar fashion, a Trojan horse could silently sit in a code for a login screen by attaching itself to
it.
When the user enters the user id and password, the Trojan horse could capture this detail, and
send this information to the attacker without the knowledge of the user who had entered the id
and password. The attacker can then merrily misuse the user id and password to gain access to
the system.
A Trojan horse allows an attacker to obtain some confidential information about a computer or a
network.

20 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Unit-II
Topics:
Symmetric Key Algorithms |AES

21 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. Explain Symmetric Key Cryptography with diagram.

Symmetric Key Cryptography

Symmetric Key Cryptography is referred by various terms such as secret key cryptography or
private key cryptography.
In this one key is used and same key is used for both encryption and decryption of messages.
Both the parties must agree upon the key before any transmission begins and nobody else should
know about it. Below diagram shows working of symmetric key cryptography.
At sender (A) end plain text converted into cipher text form. At receiver (B) end same key is used
to decrypt encrypted message.

Symmetric Key Cryptography has few problems as follows:


The first problem is key agreement or key distribution.
The second problem is more serious since same key is used for encryption as well as decryption.
Suppose A wants to securely commutate with B and also with C. Then there must be one key for
all communication between A and B and there must be another distinct key for all communications
between A and C. The same key as used by A and B cannot be used for communication between
A and C. Otherwise there is a chance that C can interpret messages going between A and B or B
can do the same for messages going between A and C.

Disadvantages of symmetric key:

A symmetric-key algorithm has two major disadvantages.

Each pair of users must have a unique symmetric key.


This means that if N people in the world want to use this method, there needs to be N (N - 1)/2
symmetric keys.
For example, for 1 thousand people to communicate, 1000 * 999 /2 = 4, 99, 500 (4 lakhs 99
thousand and five hundred) symmetric keys are needed. The distribution of the keys between
two parties can be difficult.
The sender needs to exchange the key to the receiver. It may be hijacked in between.

22 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q2.What is algorithm modes? Explain the working of Cipher feedback mode.
Algorithm Modes
An algorithm mode is a combination of series of basic algorithm steps on block cipher and some
kind of feedback from previous steps.
There are four important algorithm modes as follows:

 Electronic Code Book (ECB)


 Cipher Block Chaining (CBC)
 Cipher Feedback (CFB)
 Output Feedback (OFB)
Electronic Codebook Book (ECB)
It represents the general use of a block cipher where the plaintext is divided into 64-bit blocks P1,
P2...that are encrypted using the same key producing 64-bit cipher text blocks E (P1), E (P2)….In
this mode, each block is encrypted one at a time and each block’s encryption is totally independent
of each other.

Advantages:
 If such a data is transmitted over a network such as a phone line, then transmission errors will only
affect the block containing the error.
 ECB is the faster and easier to implement. Therefore, it has become the most commonly used
modes of DES in commercial applications.
Drawbacks:
 As the blocks are independent of each other, there are chances that they get rearranged, thus the
message gets scrambled and the original message can no more be detected.
 ECB is the weakest mode since no additional security measures are implemented besides the
basic DES algorithm.
Cipher Block Chaining (CBC) Mode
This process makes all the blocks dependent on all the previous blocks. Therefore, in order to know
the plaintext of a particular block, we need to first know the cipher text, the key, and also the cipher
text of the previous block.
But the first block i.e. to be encrypted has no previous cipher text, so the plaintext is XORed with a
64-bit number called the Initialization Vector (IV).

23 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Advantages:
 The CBC mode is more secure than ECB mode because if the data is transmitted over a network
such as a phone line and there is a transmission error (adding or deleting of a bit), then this error
will be carry forwarded to all subsequent blocks since each block is dependent upon the previous
one.
 The CBC mode of operation is more secure than ECB because the extra XOR step adds one
more encryption layer.

Drawbacks:
 If the data is transmitted over a network such as a phone line and there is a transmission error
(modifying of a bit), then this error will only affect the bits in the changed block and the
corresponding bits in the following block. But, the error doesn’t propagate any further.
 CBC mode is not good for interactive use where someone might give an input and then waits for
response because with this mode you have to wait until a full 64-bit block arrives before starting
to decrypt it.
Cipher Feedback (CFB):
CFB turns a symmetric cipher into a stream cipher; same for the following 2 mode.
Step 1: Use a shift register (64 bit for DES, 128 bit for AES, etc) that is initially set to an
initialization vector IV (that can be sent as plain text)
Step 2: Now the leftmost j bits of the cypher and XOR with the first j bits of the plaintext. The
result C is transmitted to the receiver

Step 3: Now the bits IV are shifted left by j positions and C is placed at the rightmost bits of the
register.

24 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 4: Now, steps 1 through 3 continue until all the plain-text are encrypted.

Advantages and limitations of CFB:


 Suitable for stream data arriving in bits/bytes
 Most common stream mode
 Errors propagate for several blocks after the error

Output Feedback (OFB):


The Output Feedback mode is extremely similar to the CFB. The only difference is that in the
case of CFB, the cipher text is fed into the next stage of encryption process. But in the case of
OFB, the output of the IV encryption process is fed into the next stage of encryption process.

Advantages:
 In this mode, if the error are in individual bits, they remain in individual bits and do not corrupt the
whole message

Drawbacks:
 The attacker can change both the cipher text and the checksum at the same time, hence there is
no way to detect this change.

Q3. Explain in detail the steps in each round of DES.


DES (Data Encryption Standard)

25 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


DES is the combination of substitution and transposition (permutation) techniques developed to
obtain a more secured encryption algorithm. DES is a block cipher. It encrypts data in blocks of size
64 bits each. That is, 64 bits of plain text goes as the input to DES which produces 64 bits of cipher
text.
The same algorithm and key are used for encryption and decryption, with minor differences. The
key length is 56 bits. The basic idea is shown below:

Actually, the initial key consists of 64 bits. However, before the DES process even starts every
eighth bit of the key is discarded to produce a 56 bit key. Thus the discarding of every eighth bit of
the key produces a 56 bit key from the original 64 bit key.

DES is based on the two fundamental attributes of cryptography: substitution (also called as
confusion) and transposition (also called as diffusion). DES consists of 16 steps, each of which is
called as a round. Each round performs the steps of substitution and transposition.
Steps in DES are:
 The 64 bit plain text block is handed over to an initial permutation (IP) function.
 The IP is performed on plain text.
 IP produces two halves of the permuted block: say Left Plain Text (LPT) and Right Plain Text
(RPT).
 Now each of LPT and RPT go through 16 rounds of encryption process.
 In the end, LPT and RPT are re-joined and a Final Permutation (FP) is performed on the
combined block.
 The result of this process produces 64 bit cipher text.

26 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Broad level steps in each round of DES are as follows:

Key Transformation: In this step, the 56-bit key is transformed into 48-bit key using compression
permutation. First the key is divided into 2 halves of 28 bits each, then they is left circular shifted by
certain no. of positions, depending on the number of round. After that total of 48 bits are selected
out of 56 bits, using a compression permutation table.

Expansion Permutation: In this step, the RPT (Right Plaintext) that was created in Initial
Permutation step is expanded from 32 bits to 48 bits. Besides increasing the size, the bits are
permuted as well.

S-Box Substitution: It is a process that accepts the 48-bit input from XOR operation involving the
compressed key and expanded RPT and produces a 32-bit output using the substitution technique.
The substitution is performed by 8 substitution boxes, called as S-box. Each of the S-box has 6 bit
input and 4 bit output. The 48 bit input is divided into 8 sub-blocks each of 6 bits and given to each
S-box, which in turn produces 8 outputs of 4-bits, which combined together gives 32-bit output.

P-Box Permutation: This is a simple permutation process applied to the output of previous step.
XOR and Swap: In this step the original LPT (Left Plain Text) is XORed with the output of the
previous step to produce the new RPT. The old original RPT becomes the new LPT, in a process of
swapping.

27 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q4. Explain Double and triple DES.
Double DES

It does twice what DES normally does only once. Double DES uses two keys say K1 and K2. It
first performs DES on the original plain text using key K1 to get encrypted text. It again performs
DES on the encrypted text, but this time with other key K2. The final output is encryption of
encrypted text.

DES decryption is quite simple to imagine that the decryption process would work in exactly the
reverse order. Below diagram shows decryption of double DES.
The double encrypted cipher text block is first decrypted using the key K2 to produce single
encrypted cipher text. This cipher text block is then decrypted using the key K1 to obtain the
original plain text block.

Triple DES

It comes in two flavors: one that uses three keys and other that uses two keys.

Triple DES using three keys

Below diagram shows the idea of Triple DES with three keys. The plain text P is first encrypted
with key K1 then encrypted with second key K2 and finally with third key K3. Where K3, K2 and
K1 are all different from each other.

Triple DES using two keys


Below diagram shows the idea of Triple DES with three keys. It consists of following steps as
follows.
28 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
 Encrypt the plain text with key K1.
 Decrypt the output of step1 with K2.
 Finally encrypt the output of step2 again with key K1.
This is also referred as Encrypt-Decrypt-Encrypt (EDE) mode.

Q5. Explain the principles/working of IDEA algorithm.


International Data Encryption Algorithm (IDEA):
The IDEA in perceived as one of the strongest cryptographic algorithms. It was launched in 1990
and underwent certain changes in names and capabilities as shown in table.
Year Name
1990 Proposed Encryption Standard (PES)
1991 Improved Proposed Encryption Standard (IPES)
1992 International Data Encryption Algorithm (IDEA)

One popular email privacy technology known as Pretty Good Privacy (PGP) is based on IDEA.
IDEA is a block cipher.
IDEA is reversible like DES, i.e. the same algorithm is used for encryption and decryption.
It uses both confusion and diffusion for encryption.
Working of IDEA
 In IDEA algorithm the input plain text of 64 bits divide into 4 portions each of size 16 bits (Say P1 to
P4).Then we perform the 8 rounds of algorithm.
 In each round 6 sub-keys are generated from the original key. Each of the sub-keys consists of 16-
bits. These six sub-keys are applied to the four input blocks P1 to P4.
 Thus for first round, we have 6 keys say K1 to K6; for second round, we have keys K7 to K12.
Finally for eighth round we have keys K43 to K48.Then multiply, add and XOR the plain text blocks
with sub keys.
 Perform an output transformation in sub-keys. Combine all the 4 blocks of output transformation to
get the cipher text of 64 bits.

29 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Overview of IDEA Algorithm

Details of first round in IDEA:


 The initial key consists of 128 bits from which 6 sub-keys k1 to k6 are generated for the first
round.
 Since k1 to k6 consists of 16 bits each, out of original 128 bits, the first 96 bits (6 sub keys  16
bits per sub-key) are used for the first round. Thus, at the end of the first round, bits 97-128 of the
original key are unused.
Details of one round in IDEA:
Below diagram shows the one round details of IDEA Algorithm.

30 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q6.What is the features of blowfish algorithm? Explain the steps in encryption process using
blowfish
Blowfish Algorithm

Blowfish was developed by Bruce Schneier and is a very strong symmetric key algorithm.
Its advantages are:
 Fast: Blowfish encryption rate on 32-bit microprocessors is 26 clock cycles/byte.
 Compact: Blowfish can execute in less than 5KB memory.
 Simple: It uses only primitive operations, such as addition, XOR and table lookup, making its
design and implementation simple.
 Secure: It has a variable key length up to a maximum of 448 bits long, making it both flexible and
secure.

31 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Blowfish encrypts 64-bit blocks with a variable length key. It contains 2 parts as follows:
Subkey Generation: This process converts the key up to 448 bits long to sub keys totaling 4168
bits.
Data Encryption: This process involves iteration of a simple function 16 times.

The actual algorithm is as follows: X is the plain text block.


1. Divide X into two blocks, XL and XR of equal size i.e. 32 bits each.
2. For i = 1 to 16
XL = XL XOR Pi, where Pi is 32-bit sub-key.
XR = F (XL) XOR XR, F is a function.
Swap XL, XR
Next i
3. Swap XL, XR.
4. XL = XL XOR P18.
5. Combine XL and XR back into X.

32 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q7. Explain RC4 algorithm in detail.

RC4 is a stream cipher designed in 1987 by Ron Rivest for RSA Security. It is a variable key-size
stream cipher with byte-oriented operations. The algorithm is based on the use of a random
permutation. RC4 was kept as a trade secret by RSA Security.

Working of RC4
It consist of 2 steps
Initialization of S:
Stream Generation
Initialization of S:
To begin, the entries of S are set equal to the values from 0 through 255 in ascending order; that is;
S[0] = 0, S[1] = 1, …, S[255] = 255.

A temporary arrayT is also created. If the length of the key K is 256 bytes, then K is transferred to T.
Otherwise, for a key of length keylen bytes, the first keylen elements of T are copied from K and
then K is repeated as many times as necessary to fill out T. These preliminary operations can be
summarized as follows:
For i = 0 to 255
S[i] = i;
T[i] = K [i mod keylen];
Next we use T to produce the initial permutation of S. This involves starting with S [0] and going
through to S [255], and, for each S[i], swapping S[i] with another byte in S according to a scheme
dictated by T[i]:
j = 0;
For i = 0 to 255
j = (j + S[i] + T[i]) mod 256;
Swap (S[i], S[j]);
Because the only operation on S is a swap, the only effect is a permutation. S still contains all the
numbers from 0 through 255.
Stream Generation
Once the S vector is initialized, the input key is no longer used. Stream generation involves starting
with S[0] and going through to S[255], and, for each S[i], swapping S[i] with another byte in S
according to a scheme dictated by the current configuration of S. After S [255] is reached, the
process continues, starting over again at S [0]:

/* Stream Generation */
i, j = 0
while (true)
i = (i + 1) mod 256;

33 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


j = (j + S[i]) mod 256; Swap (S[i], S[j]);
t = (S[i] + S[j]) mod 256; k = S[t];

Q8. Explain RC5 algorithm in detail.


 It is symmetric key block encryption algorithm developed by Ron Rivest.
 It allows for variable number of rounds and a variable bit size key to add the flexibility.
 There is one initial operation consisting of two steps, then a number of rounds.
 In each round there are following operations:
Bitwise XOR
Left circular shift
Addition with the next sub key.
Parameter Allowed Values
Word size in bits(RC5 encrypts 2 word at a time) 16, 32, 64
Number of rounds 0-255
Number of 8-bit bytes in the key 0-255
Fig.RC5 block, round and key details
Working of RC5:
One-time initial Operation
In this step original plain text message is divided into 2 parts equally says A and B. Then the first
sub-key s[0] is added to A and the second sub-key s[1] is added to B and produce C and D
respectively.

34 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Details of One Round
Step 1: XOR C and D Step 2: Circular-left shift E Step 3: Add E and Next Subkey
C D E Shifted E

S [2] +
XOR
Perform a
E circular left shift F
by D bits

Step 4: XOR D and F Step 5: Circular-left shift G Step 6: Add G and Next Subkey
D F G Shifted G

XOR
S [3] +
Perform a
G circular left shift
by F bits H

Subkey creation:
This is a two-step process:
 In the first step sub keys (denoted by S[0], S[1]…)are generated. The original key is called as L.
 In the second step the sub keys (S[0], S[1]…) are mixed with the sub portion of the original key
(L[0], L[1]….)

Q9.Explain processes in each round of AES.


Advance Encryption Standard (AES ) Algorithm

The Advanced Encryption Standard (AES), also known as Rijndael is a specification for the
encryption of electronic data established by the U.S. National Institute of Standards and
Technology (NIST) in 2001.
For AES, each with a block size of 128 bits, but three different key lengths: 128, 192 and 256 bits
with rounds 10, 20and 30 respectively.
The main features of AES are as follows:

35 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Symmetric and Parallel Structure: This gives the implementers of the algorithms a lot of
flexibility and it stands up well against cryptanalysis attacks.
 Adapted to modern processors: The algorithm works well with modern processors (Pentium,
RISC, parallel).
 Suited to Smart Cards: The algorithm works well with smart cards.
Working of AES algorithm:
Key Expansions: Round keys are derived from the cipher key using Rijndael's key schedule.
AES requires a separate 128-bit round key block for each round plus one more.
Initial Round
AddRoundKey: Each byte of the state is combined with a block of the round key using bitwise
XOR.
Details of Rounds

 Sub Bytes: A non-linear substitution step where each byte is replaced with another according to
a lookup table.

 Shift Rows: A transposition step where the last three rows of the state are shifted cyclically a
certain number of steps.

 Mix Columns: A mixing operation which operates on the columns of the state, combining the
four bytes in each column.

36 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Add Round Key: In the AddRoundKey step, each byte of the state is combined with a byte of the
round subkey using the XOR operation

37 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Unit-III
Topics:
Asymmetric Key Algorithms |Digital Signature |RSA

38 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. Explain Asymmetric Key Cryptography with diagram.
Asymmetric Key Cryptography
It is also called as public key cryptography, it consist of two different keys (which form a key pair)
are used.
One key is used for encryption and only the other corresponding key must be used for decryption.
No other key can decrypt the message not even the original first key used for encryption.
The beauty of this scheme is that every communication party needs just a key pair for
communicating with any number of other communicating parties.
One of the two keys is called the public key and other is the private key. The private key remains
with us a secret. We must not disclose our private key to anybody. However the public key is for
general purpose.
Below diagram show the working of asymmetric key cryptography.

Asymmetric key cryptography work as follows:


 When A wants to send a message to B, A encrypts the message using B’s public key. This is
possible because A knows B’s public key.
 A sends the message to B.
 B decrypt A’s message using B’s private key. Only B knows about her private key, the message
can be decrypted only by B’s private key and nothing else.

Q2. Difference between Symmetric and Asymmetric Key Cryptography.

Categories Symmetric Key Cryptography Asymmetric Key Cryptography


Key used for encryption/ Same key is used for One key used for encryption and
decryption encryption and decryption another, different key is used for
decryption
Key Process Ke = Kd KdKd

39 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Speed of encryption/ Very fast Slower
decryption
Size of resulting encrypted Usually same as or less than More than the original clear text
text the original clear text size size
Key agreement / exchange A big problem No problem at all
Number of keys required Equals about the square of the Same as the number of
as compared to the number of participants, so participants, so scales up quite
number of participants in scalability is an issue well
the message exchange
Usage Mainly for encryption and Can be used for encryption and
decryption (confidentiality), decryption (confidentiality) as
cannot be used for digital well as for digital signatures
signatures (integrity and non- (integrity and non-repudiation
repudiation checks) checks)
Efficiency in usage Symmetric key cryptography is Public key algorithm are more
often used for long messages efficient for short messages

Q3. Explain the working of RSA algorithm.


The RSA algorithm is most popular and proven asymmetric key cryptography algorithm. The RSA
algorithm based on mathematical fact that is easy to find and multiply large prime numbers
together but it is extremely difficult to factor their product.

The private and public keys in RSA are based on very large prime numbers. Below steps shows
the whole process of RSA algorithm.

Example of RSA algorithm

40 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q4. Explain working of symmetric and asymmetric key cryptography together.
Symmetric-key cryptography and asymmetric-key cryptography are combined to have a very
efficient security solution. The way it works is as follows, assuming that A is the sender of a
message and B is its receiver.
A's computer encrypts the original plain-text message with the help of a standard symmetric key
cryptography algorithm, such as DES, IDEA or RC5, etc) this produces a cipher-text message
shown in below fig, The key used in this operation (K1) is called one-time symmetric key, as it is
used once and then discarded

A now takes the one-time symmetric key of step1 (i.e. K1), and encrypts K1 with B's public key
(K2). This process is called key wrapping of the symmetric as shown in below figure. We have
shown that the symmetric key K1 goes inside a logical box, which is sealed by B's public key (i.e.
K2).

A puts the cipher text CT1 and the encrypted symmetric key together inside a digital envelope.
This is shown in below figure.

41 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The sender (A) now sends the digital envelope [which contains the cipher text (CT) and the
onetime symmetric key (K1) encrypted with B's public key, (K2)l to B using the underlying
transport mechanism (network).

B receives and-opens the digital envelope. After B opens the envelope, it receives two things:
cipher text (CT) and the one-time session key (K!) encrypted using B's private key (K2). This is
shown in below figure.

42 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


B now uses the same asymmetric-key algorithm as was used by A. and her private key (K3) to
decrypt (i.e. open up) the logical box that contains the symmetric key (K1), which was encrypted
with B's public key (K2).This is shown in figure. Thus the output of the process is the onetime
symmetric key K1.

Finally, B applies the same symmetric-key algorithm as was used by A, and the symmetric key
K1 to decrypt the cipher text (CT). This process yields the original plain text (PT), as shown in
figure.

Q5. Explain the security solution based on the concept of Digital Envelope.
The security solution based on Digital Envelope, uses both symmetric key cryptography as well as
asymmetric key cryptography, and hence combines best features of both. The mechanism works
as follows:
When A wants to send the message to B, A performs following steps:

43 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 A encrypts the message using one-time symmetric key K1 and produces cipher text CT from plain
text PT.
 A then encrypts the symmetric key K1, using B’s public key K2. This process is called key wrapping.
 A now puts the cipher text CT and the encrypted symmetric key together inside a digital envelope.
 A now sends this digital envelope to B over the network. B receives this digital envelope.
 B now uses her private key K3 to decrypt the symmetric key, which was encrypted using B’s public
key. The output of this decryption is the one time symmetric key K1.
 B now uses K1 to decrypt the cipher text CT to convert it back to plain text PT.

Digital envelope is efficient because plain text is encrypted using symmetric key algorithm, which is
fast and produces cipher text of same size. The one-time symmetric key is encrypted using B’s
public key, since the size of K1 is small, asymmetric key encryption would not take longer and the
resulting encrypted key also would not consume a lot of space. And it also solves the problem of
key distribution/exchange.

Q6. What is digital signature? Explain with example.

 In asymmetric key cryptography, if A is the sender of the message and B is the receiver, A
encrypts the message with B’s public key and sends the encrypted message to B.
 Where as in Digital signature, If A is the sender of the message and B is the receiver, A encrypts
the message with A’s private key and sends the encrypted message to B.

If A is the sender and B is the receiver, then when A sends the message to B, A encrypts the
message using her private key and sends it. When B receives it, it uses A’s public key to decrypt
the message.

In this process, the confidentiality of the message in not maintained, because A’s public key is
available to anyone, and hence anyone can decrypt the message sent by A. However, in this
scheme, the intention of A was not to hide the message, but to prove the identity of the Sender,
i.e. A. When B is able to decrypt the message, using A’s public key, it proves that the message
was encrypted using A’s private key, and since A’s private key must be known only to A, the
44 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
message indeed was sent by A. Moreover, in case of dispute, B can take the encrypted message
and decrypt it with A’s public key, to prove that the message indeed came from A. This achieves
the non-repudiation, i.e. A cannot refuse that she had sent the message.
Q7. Explain the concept of message digest. What are the requirements of the message Digest?
A message digest is a finger-print or the summary of a message. It is similar to the concept of
LRC (Longitudinal Redundancy Check) or CRC (Cyclic Redundancy Check) that is, it is used to
verify the integrity of the data, i.e. to ensure that a message has not been tampered with after it
leaves the sender but before it reaches the receiver.
The fingerprint of the message does not tell anything about the original message and it is much
smaller in size than the original message. Thus we perform a hashing operation or a message
digest algorithm, over a block of data to produce its hash or message digest.
The requirements of the message digest are as follows:
 Given a message, it should be very easy to find its message digest. Also for a given message,
the message digest must always be the same.
 Given a message digest, it should be very difficult to find the original message for which the
digest was created.
 Given any 2 messages, if we calculate their message digests, the 2 message digests must be
different.
Example:

Q8. Explain the concept of birthday attack?


45 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Birthday Attack:
 If the two messages produce same Massage-digest it is called collision. The birthday attack is an
attack that can discover collisions in message-digest algorithms.

 It is based on the Birthday Paradox, which states that if there are 23 people in a room, the odds
are slightly greater than 50% that two will share the same birthday. The odds might appear
counterintuitive. The key to understanding the attack is remembering that it is the odds of any two
people (out of the 23) sharing a birthday and it is not the odds of sharing a birthday with a specific
person. Alice is in a room with 23 people and has 22 chances to share a birthday with anyone
else (there are 22 pairs of people). If she fails to match, she leaves, and Bob has 21 chances to
share a birthday with anyone else. If he fails to match, Carol has 20 chances, and so on. Twenty-
two pairs, plus 21 pairs, plus 20… plus one pair equals 253 pairs. Each pair has a 1/365 chance
of having a matching birthday, and the odds of a match cross 50% at 253 pairs.

 The birthday attack is most often used to attempt to discover collisions in hash functions, such as
MD5 or SHA1.
Q9. Explain the working of MD5 algorithm.

MD5 is a message-digest algorithm developed by Ron Rivest. MD5 is quite fast, and produces
128-bit message digests.
Working of MD5:
Step 1: Padding- The aim of this step is to make the length of the original message equal to a
value which is 64 bits less than exact multiple of 512.

Step 2: Append Length- The length of the original message is calculated, excluding the padding
bits then appended to the end of message block. Length of the message is now exact multiple of
512 bits as shown in the following diagram:

46 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 3: divide the input into 512-bit block-we divide the input message into blocks and the
size of each block is 512 bits.

Step 4: Initialise the chaining variables-We use four chaining variables A, B, C, D of size
32bits each. It consists of hexadecimal value as shown in diagram:

Step 5: Process Blocks- Here the real algorithm begins. There is a loop that runs for as many
512 bits blocks as are there in the message.
Step 1- copy the four chaining variables into four corresponding variables. As shown in the
following diagram:

Step 2- Divide the current 512 bits block into 16 sub-blocks of 32 bits each, as shown below:

Step 3- Now we have four rounds. In each round we process all 16 sub blocks. The working of 1
round is shown below:

47 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


One Round MD5 Operation

Q10. Explain the working of SHA algorithm.


Secure Hash Algorithm (SHA):
SHA works with any input message that is less than 2^64 bits in length. The output of SHA is a
message digest, which is 160 bits in length.
The word Secure in SHA was decided based on two features. SHA is designed to be
computationally infeasible to
1. Obtain the original message, given its message digest, and
2. Find two messages producing the same message digest.
Working of SHA:
Step 1: Padding: such a way that the length of the message is 64 bits short of a multiple of 512.
Step 2: Append Length: appended to the end of the padding as a 64-bit block.
Step 3: Divide the input into 512 bit block: each of length 512 bits.
Step 4: Initialise chaining variables: 5 chaining variables A to E are initialized.
Step 5: Process block: Actual algorithm begins
Step 5.1: copy the chaining variables A-E into a-e.
Step 5.2: now, divide the current 512-bit block into 16 sub-blocks, each of 32 bits
Step 5.3: SHA has four rounds, each round consisting of 20 steps. Each round takes the current
512 bit block, the register abcde and a constant K[t] (where t=0to 79) as the three inputs.

48 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 5.4: SHA consists of four rounds, each round containing four iterations. This makes it a total of
80 iterations.
The logical operation of a single SHA iteration looks as follows:

Q11. Explain the concept of MAC.


The concept of Message Authentication Code (MAC) is quite similar to MD. However there is one
difference. As we have seen, a message digest is simply a fingerprint of a message.In contrast, a
MAC the sender and receiver should know a shared secret key.
Suppose sender A wants to send message M to receiver B. The MAC processing works is shown
in the diagram:

Step 1: A and B share a symmetric key K, which is not known to anyone else. A calculates the
MAC by applying key K to the message M.
Step 2: A then sends the original message M and the MAC H1 to B.
Step 3: When B receives the message, B also uses K to calculate its own MAC H2 over M.
Step 4: B now compares H1 with H2. If the two matches, B concludes that message M has not
been changed during transit.

49 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q12. How Hash-based Message authentication works?

HMAC stands for Hash-based Message Authentication Code. It’s used in SSL (Secure Socket
Layer) for security purpose on the internet.
Working of HMAC:
It involves following variables:
MD-Message Digest
K -Shared symmetric key
M -Input message
iPad- string 00110110
opad-string 01011010
L -no. of blocks in M
b -no. of bits in a block

Step 1: Make the length of K equal to b.

Step 2: XOR K with ipad to produce S1.

Step 3: Append M to S1.

Step 4: Message Digest Algorithm:


Selected MD algorithm such as MD5 or SHA etc, is applied to the output of step 3, call it H.

Step 5: XOR K with opad to produce S2

50 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 6: Append H to S2

Step 7: message digest algorithm


Selected message digest algorithm is applied to the output of step 6

Q13. Why HMAC cannot be trusted to be used in digital signatures?


In HMAC algorithm, first the message digest is calculated over the original message and then the
digest is encrypted using symmetric key, which is known only to the sender and receiver. The
sender sends the original message and encrypted message digest to the receiver. The receiver
decrypts the encrypted message digest, using the symmetric key, also computes its own
message digest over the received message and compares the two digests. If they are same, then
message integrity and authentication is proved. However HMAC has following disadvantages:
 Since it uses symmetric key for encryption of message digest, the problem of key-distribution is
there.
 Also it can be used only between one sender and one receiver. If the no. of receivers is more,
more symmetric keys are required to be shared between the sender and each receiver.
 To resolve this problem, if the sender decides to share the same key with all the receivers, then
another problem arises. In this scenario, when the receiver receives the message, e/she cannot
be sure if the message was sent by the sender or any other co-receiver, because they all share
the same symmetric key.
 The last problem is that of lack authentication. Let A be the account holder in Bank B. One day,
bank B closes A’s account and transfers all the money in C’s account. A is shocked and files a
complaint in the court of Law. However, B argues that A had sent the message instructing bank
B, to close the account and transfer the money in C’s account and produces that message as
evidence. A claim that A never sent that message. B’s message also contains the MAC, which
was produced over the original message. However, the mere existence of MAC does not prove
51 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
who had created it, because MAC was created using a symmetric key, shared between A and B.
So either of them could have created it. This problem of lack of authentication is serious and has
no solution, hence HMAC cannot be trusted to be used in digital signatures, because the purpose
of digital signature is to prove the identity of the sender, and HMAC fails to do the same.

Q14. Explain digital signature standard.


Due to problems associated with MAC, the Digital Signature Standard (DSS) was developed for
performing digital signatures. DSS makes use of the SHA-1 algorithm for calculating the
message digest over an original message and uses message digest to perform the digital
signature.
For this DSS makes use of an algorithm called as Digital Signature Algorithm (DSA). Note that
DSS is the standard and DSA is the algorithm.
Encryption, message authentication and digital signatures are all tools of modern cryptography.
A signature is a technique for non-repudiation based on the public key cryptography. The creator
of a message can attach a code, the signature, which guarantees the source and integrity of the
message

Digital Signature Algorithm works as follows:

Step 1: Message Digest calculation

Step 2: Digital signature creation.

Step 3: Transmission of M and DS

52 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 4: receiver calculates its own MD:

Step 5: Receiver receives sender’s MD:

Step 6: Digital signature verification:


• Here B compares both the message digest.
• If MD1==MD2, then B accepts the message send by A.
• Else, B rejects the message send by A.

53 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q15. Explain Knapsack Algorithm.

Knapsack Algorithm.
This algorithm was developed by Ralph Merkle and Martin Hellman for public key encryption.
Knapsack algorithm is public key cryptography algorithm based on knapsack problem. Knapsack
means bag which consist of different weights. If input data is 1 then we accept the weight if data is 0
then we reject it.

For example:
If the knapsack is 1, 7, 8, 12, 14, 20 then the plain text and the resulting cipher text is as shown
below:

Q16. Explain the problem with public key exchange.


When Alice sends her public key to bob, and request for bob’s public key, in turn man-in-the-
middle attack can be launched by tom-the attacker.
1. When Alice wants to send a message securely to Bob, she sends Bob her public key and
asks Bob for Bob’s public key.
2. Tom-the-attacker-intercepts Alice’ message. He changes the public key value in Alice’s
original message from 20 to his own and forwards this message to Bob.
3. Bob sends back his public key in response to Alice’s message.
4. Tom intercepts Bob’s message, changes the public key value to 17, and forwards it to
Alice.
5. Alice thinks that bob’s public key is 17. Therefore, she encrypts the confidential message
to be sent to bob with 17 and sends to bob.
6. Tom intercepts this message, uses his private key to decrypt the message, processes it,
re-encrypts the message with bob’s public key and forward it to bob.
7. Bob decrypts the message coming from tom with his private key, and depending upon a
message, forms a reply. He encrypts the reply with what he believes to be Alice’s public
key. He then sends the reply back to Alice.
8. Tom intercepts bob’s reply, uses his private key to decrypt the message, and performs
whatever actions he wants to on the message, re-encrypts it with the real public key of
Alice, and sends it to Alice. Alice can decrypt it with her private key.
This process can go on and on, without either Alice or Bob realizing that an attacker is playing
havoc! This is especially truer if Tom can perform the encryption and decryption operation really
fast!

54 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


This also means that although the asymmetric key cryptography technique resolves the problem
of key exchange, and therefore, the security issues in all communication thereafter. It does not
resolve the problem of making available the public key of the correspondents to each other.

55 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Unit-IV
Topics:
Digital Certificates |Public Key Infrastructure

56 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. Describe Contents of Digital Certificate.
A standard called X.509 defines the structure of a digital certificate. Below figure shows the
structure of X.509V3 digital certificate.

Description of the various fields in a X.509 digital certificate

Field Description
Version Identifies a particular version of the X.509 protocol, which is used for this
digital Certificate. Currently, this field can contain 1, 2 or 3.
Certificate Serial Contains a unique integer number, which is generated by the CA.
Number
Signature Identifies the algorithm used by the CA to sign this certificate.
Algorithm
Identifier
Issuer Name Identifies the Distinguished Name (DN) of the CA that created and signed
this certificate.
Validity Contains two date-time values (Not Before and Not After), which specify
the time frame within which the certificate should be considered valid.
These values generally specify the date and time up to seconds or
milliseconds.
Subject name Identifies the Distinguished Name (DN) of the end entity (i.e. the user or
the organization) to whom this certificate refers. This field must contain an
entry unless an alternative name is defined in Version 3 extensions.
Subject Public Contains the subject's public key and algorithms related to that key. This
Key field can never be blank.
Information

Q2. What is digital certificate? How is it created?


A digital certificate is a small computer file, which contains information about its owner’s public key.
The file contains basic information like name of the owner of the certificate, its serial number, the
certificate’s validity period and the owner’s public key.
The digital certificate is used, whenever a user wants to provide his/her public key to others, in
asymmetric key cryptography. The user just needs to present the digital certificate to others, to
prove the authenticity of his/her public key. And every other user trusts the digital certificate
because it is created by a trusted third party called as a Certificate Authority (CA).

57 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The process of creation of digital certificate is as follows:

Key generation: The subject (user/organization) can create the public key/private key itself, using
some software. Another approach is that Registration Authority (RA) can create the key pair on
behalf of the subject and give it to the subject.
Registration: Each step is required if the user has generated its own key pair. If the RA has
generated the key pair, then this step is completed in step 1 itself. In this, the user provides the
public key and associated registration information and evidence about itself to the Registration
Authority (RA).
Verification: After the registration is complete, the RA has to verify the user’s credentials. First the
RA verifies that the evidences provided are correct and acceptable. And the second check is to
verify that the user actually possesses the corresponding private key, for the given public key. This
is called as checking the Proof of Possession (POP). This can be done by RA, in many possible
ways.
Certificate Creation: After all the previous steps are successful, the RA passes all the information
to CA. CA does its own verification, if required and creates a digital certificate for the user. CA
sends the certificate to the user and retains a copy of the same for its own records, in a certificate
directory.

Q3. Explain how CA signs a certificate.


The last field in a digital certificate is always the digital signature of the CA. that is, every digital
signature not only contains the user information but also the CA’s digital signature. Therefore, a
digital signature is always signed or certified. The way CA signs the certificate is shown below.

As shown in figure below, before issuing a digital certificate to a user, the CA first calculates a
message digest over all the fields of the certificate and then encrypts the message digest with its
private key to form the CA’s digital signature. The CA then inserts its digital signature thus
58 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
calculated, as the last field in the digital signature of the user. All of this process happens
automatically, using computer-based cryptography programs.

Q4. Explain the verification of CA signature on a certificate.


If we receive a digital certificate of a user which we want to verify. We need to verify the digital
signature of the CA. Steps is involved in this process as shown below.
The verification of a digital certificate consists of the following steps.
(a) The user passes all fields except the last one of the received digital certificate to a message-
digest algorithm. This algorithm should be the same as the one used by the CA while signing the
certificate. The CA mentions the algorithm used for signing along with the signature in the
certificate, so the user here knows which algorithm is to be used.
(b) The message-digest algorithm calculates a message digest (hash) of all fields of the certificate,
except for the last one. Call this message digest as MD1.
(c) The user now extracts the digital signature of the CA from the certificate (remember, it is the
last field in a certificate.)
(d) The user de-signs the CA’s signature (i.e. the user decrypts the signature with the CA’s public
key.)
(e) This produces another message digest, which we shall call MD2. Note that MD2 is the same
message digest as would have been calculated by the CA during the signing of the certificate (i.e.
before it encrypted the message digest with its private key to create its digital signature the
certificate.)

59 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


(f) Now, the user compares the message digest it calculated (MD1) with the one, which is the
result of de-signing the CA’s signature (MD2). If the two match, i.e. if MD1 = MD2, the user is
convinced that the digital certificate was indeed signed by the CA with its private key. If this
comparison fails, the user will not trust the certificate, and reject it.

Q5. Write a short note on Certificate Hierarchy.


The Certification Authority (CA) hierarchy begins with the root CA. The root CA has one or more
second level CAs below. Each of these second-level CAs can have one or more third level CAs,
which in turn can have lower level CAs, and so on. If Alice has obtained her certificate from a third-
level CA and Bob has obtained his certificate from a different third-level CA, how can Alice verify
Bob’s certificate?

60 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Now, suppose that Alice’s CA is B1, whereas Bob’s CA is B11. Clearly, Alice cannot straightaway
know the public key of B11. Therefore, in addition to his own certificate, Bob must send the
certificate of his CA (i.e. B11) to Alice. This would tell Alice the public key of B11. Now, using the
public key of B11, Alice can de-sign and verify Bob’s certificate.

Q6. Write a brief note on cross certification in digital certificates.


The digital certificate is used, whenever a user wants to provide his/her public key to others, in
asymmetric key cryptography. The user just needs to present the digital certificate to others, to
prove the authenticity of his/her public key. And every other user trusts the digital certificate
because it is created by a trusted third party called as a Certificate Authority (CA).
The root CA cannot issue digital certificates to all the users, so he appoints many second levels
CAs, to do the same work. The second level CAs in turn have many third level CAs below each
one of them, to do the same work. Thus a Certificate Authority Hierarchy is created. Whenever
Alice wants to verify the digital certificate presented to her b Bob, he also presents the issuer
CA’s digital certificate so that the Alice can verify and trust Bob’s digital certificate, by de-signing
it using the issuer CA’s public key. This process of verifying and trusting the digital certificates
has to continue, all the way up the Certificate Authority Hierarchy, till the root CA. At each level,
the Alice requires the digital certificate of the CA which has issued the lower level certificate.
Finally, root CA’s certificate is in-built into the software. This completes the chain of trust.

61 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Now, sometimes it may be so possible that the Alice and Bob’s root CA are different. In this case,
even with certificate authority hierarchy, the Alice cannot verify the Bob’s digital certificate. The
solution to this problem is called, cross-certification. Cross-certification certificates are issued by
the CAs to create a non-hierarchical trust path. Here the root CAs of Alice and Bob may be
different, but they have cross-certified each other, which means Alice’s root CA has obtained a
certificate for itself from Bob’s root CA and vice-versa. So now even if Alice’s software trusts only
her root CA, it is not a problem, since Bob’s root CA is certified by Alice’s root CA, Alice can and
does trust the root CA of Bob. This also means that Alice can verify Bob’s certificate.

Q7. Short note on Certificate revocation.


A digital certificate can be revoked due to following reasons:
 The holder of a digital certificate reports that the private key corresponding to the public key
specified in the digital certificate is compromised.
 The CA realizes that it had made some mistake while issuing a certificate.
 The certificate holder leaves a job, and the certificate was issued specifically while the person
was employed in that job.
There are following 2 status mechanisms to check digital certificate revocation

Q8. What are CRLs (Certificate Revocation Lists)? How are they used?
OR
Write a short note on CRL Offline Revocation Status Check.
CRL Certificate Revocation List is the primary means of checking the status of the digital certificate
offline. In its simplest form, a CRL is a list of certificates published regularly by each CA, identifying
all the certificates that have been revoked through the life of the CA. However this list does not
include the certificates whose validity period is over. A CRL lists only those certificates whose
validity period is still within the acceptable range, but they are revoked for some other reason like
compromised private key or a change of job of the certificate holder or due to some mistake in the
certificate etc.

Each CA issues its own CRL. The respective CA signs each CRL. Therefore, a CRL can be easily
verified. A CRL is a sequential file that grows over time to include all the certificates that have not
expired but have been revoked. Thus, it is a superset of all previous CRLs issued by that CA. Each
CRL entry lists the certificate serial number, the date and time on which the certificate was revoked

62 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


and the reason behind the revocation. At the top level, the CRL also includes the information such
as the date and the time this CRL was published and when the next CRL will be published. Thus
when Alice receives Bob’s certificates and wants to see if she should trust it, she does the following
checks: Certificate Expiry check, Signature Check & Certificate Revocation check. In certificate
revocation check, she consults the latest CRL issued by Bob’s CA to ensure that Bob’s certificate is
not listed there as a revoked certificate. Only after Alice is assured of all these three aspects, that
she can trust Bob’s certificate.
Format of a CRL

Description of the fields of CRL

Q9. Write a short note on online certificate revocation status checks.


Two new protocols were developed for checking the status of a certificate online, namely
 Online certificate status protocol (OCSP)
 Simple certificate validation protocol (SCVP)

63 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Online certificate status protocol (OCSP): It can be used to check if a given digital certificate is
valid at a particular moment. Thus, it is an online check.
 The CA provides a server, called an OCSP responder. This server contains the latest certificate
revocation information. The requestor has to send a query about a particular certificate to check if it
is revoked or not.

 The OCSP responder consults the server’s X.500 directory to see if the particular certificate is
valid or not.

 Based on the result of the status check from the X.500 directory lookup, the OSCP responder
sends back a digitally signed OSCP response for each of the certificates in the original request to
the client. This response can take one of the three forms, namely, Good, Revoked, or Unknown.

Simple certificate validation protocol (SCVP): It is in the draft stage as of the current writing.
SVCP is an online certificate status reporting protocol, designed to deal with the drawbacks of
OCSP. Since SCVP is conceptually similar to OCSP.

64 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q10. Difference between OCSP and SCVP.

Q11. What are the types of certificates?


Generally, the certificate types can be classified as follows:
 Email Certificates: It includes the user’s email id.
 Server-side SSL Certificates: These certificates are useful for merchants who want to allow
buyers to purchase goods or services from their online web site.
 Client-side SSL Certificates: These certificates allow a merchant to verify a client.
 Code-signing Certificates: Many people do not like to download client-side code such as java
applets or ActiveX controls. In order to alleviate these concerns, the code can be sign by the
signer.

Q12. Short note on private key management.


Protecting private key
In many situations, the private key of the user can be required to be transported from one
location to another. To handle this situation, there is a cryptographic standard by the name
PKCS#12.
Multiple key pairs
The PKI approach recommends that in serious business application user should possess multiple
digital signatures, which means multiple key pairs. This ensure that the loss of one the private
key does not affect the complete oppression of the user
Key update

65 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Good security practices demand that the key pairs should be updated periodically. This is
because overtime, keys become susceptible to cryptanalysis attacks. Causing a digital certificate
expire after a certain data ensures it. His requires an update to the key pair.
Key archival
The CA must plan for and maintain the history of the certificates and the keys of its user. If the
CA has not archived the certificates, he cannot provide the requested information about DC. This
can cause serious legal problem. Therefore key archival is a very significant aspect of any PKI
solution.

Q13. short note on PKIX services.


The PKIX include following services:
 Registration: It is the process where an end –entity makes itself known to a CA.
 Initialization: This deals with the basic problems, such as the methodology of verifying that the
end-entity is taking to the right CA.
 Certification: In this step the CA creates a DC for the end-entity and returns it to the end-entity,
maintaining a copy for its own records.
 Key-pair recovery: Key archival and recovery services can be provided by a CA or by an
independent key recovery system.
 Key generation: PKIX specifies that the end-entity should be able to generate private and public
key pairs.
 Key update: This allows a smooth transition from one expiring key pair to a fresh one.
 Cross-certification: Helps in establishing trust models.
 Revocation: There are two modes: online or offline
Q14. Describe the five architectural areas of PKIX model.
This area includes the following:
 X.509 V3 certificate and V2 certificate revocation list profiles: as we know the X.509
standard allows the use of various options while describing the extensions of a DC. PKIX has
grouped all the options that are deemed fit for internet users. It calls this group of option as profile
of the internet user.
 Operational protocols: these define the underline protocol that provides the transport
mechanism for delivering the certificates, CRLs and other management and status information to
a PKI user.
 Management protocols: these protocols enable exchange of information between the various
PKI entities e.g. Certificate management protocol (CMP) for requesting a certificate.
 Policy outlines: PKIX defines the outlines for certificate policy (CP) and certificate practise
statement (CPS) in RFC2527.
 Timestamp and data certification services: timestamping service is provided by a trusted third
party timestamp authority. The purpose of this service is to sign a message to guarantee that it
existed prior to a specific date and time. The data certification services (DCS) is a trusted third
party service which verifies the correctness of the data that it receives.

Q15. Write a brief note on PKCS#5 Password Based Encryption (PBE) standard.
Password Based Encryption (PBE) is a solution for keeping symmetric session keys safe. This
technique ensures that the symmetric keys are protected from an unauthorized access. The PBE
method uses password based technique for encrypting a session key as shown below.

66 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


We first encrypt the plaintext message with the symmetric key and then encrypt the symmetric
key with a Key Encryption Key (KEK). This protects the symmetric key from an unauthorized
access. This is conceptually very similar to the concept of digital envelopes. Anyone wishing to
access the symmetric key must have an access to KEK.

We must have the capability of generating the KEK as and when required. For this very purpose,
a password is used. The password is the input to a key generation process (usually a message
digest algorithm), the output of which is the KEK.

Q16. Short note on XML encryption.

The most interesting part about XML encryption is that we can encrypt an entire document, or its
selected portions. This is very difficult to achieve in the non-XML world. We can encrypt one or all
of the following portions of an XML document:
 The entire XML document
 An element and its sub-element
 The content portion of an XML document
 A reference to a resource outside of an XML document

67 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The steps involved in XML encryption are quite simple, and are as follows:
1. Select the XML to be encrypted
2. Convert the data to be encrypted in a canonical form.
3. Encrypt the result using public key encryption.
4. Send the encrypted XML document to the intended recipient.

Q17. Short note on XML digital signature.

As we can see, a digital signature is calculated over the complete message. For instance, in a
purchase request, the purchase manager may want to authorize only the quantity portion,
whereas the accounting manager may want to sign only the rate portion. In such cases, XML
digital signature can be used.
The steps in performing XML digital signature are as follows:
 Create a signed info element with signature method, canonicalization method and references.
 Canonicalize the XML document.
 Calculate the signature value, depending on the algorithms specified in the signed info
element.
 Create the digital signature, which also includes the signed info, key info, and the signature
value element.

Q18. Short note on XML key management specification (XKMS).


The XML key management specification (XKMS) is an initiative of the World Wide Web
consortium, which aims to delegate the trust-related decisions in an XML encryption/signature
process to one or more specified trust processor.
XKMS specifies protocols for disturbing and registering public keys, and works very well with
XML encryption and XML signatures. XKMS consists of two parts as shown below

 The XML key information service specification (X-KISS) specifies a protocol for a trust service,
which resolves the public key information contained in document that conform to the XML
signature standard. This protocol allows a client of such a service to delegate some or all of the
tasks needed to process an XML signature element.
 The XML key registration service specification (X-KRSS) defines a protocol for a Web service
that accepts the registration of public key information. This protocol can also be used to later
retrieve the private key. The protocol has provisions for authentication of the applicant and proof
of possession of the private key.

68 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Unit-V
Topics:
Network Security |Firewall |Virtual Private
Network

69 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. Explain IPv4 packet format with help of neat diagram.

Packets in the network (internet) layer are called datagrams. A datagram is a variable-length
packet consisting of two parts: header and data.
The header is 20 to 60bytes in length and contains information essential to routing and delivery.

Version (VER): This 4-bit field defines the version of the IP protocol. Currently the version is 4.
However, version 6 (or IPv6) may totally replace version 4 in the future.
Header Length (HLEN): This 4-bit field defines the total length of the datagram header in 4-byte
words. When there are no options, the header length is 20 bytes, and the value of this field is 5
(5x4=20). When the option field is at its
Service Type: In the original design of IP header, this field was referred to as type of service
(TOS), which defined how the datagram should be handled. Part of the field was used to define
the precedence of the datagram; the rest defined the type of service (low delay, high throughput,
and so on). IETF has changed the interpretation of this 8-bit field. This field now defines a set of
differentiated services.
The first 6 bits make up the codepoint subfield and the last 2 bits are not used. The codepoint
subfield can be used in two different ways.
When the 3 right-most bits are 0s, the 3 left-most bits are interpreted the same as the
precedence bits in the service type interpretation.
The precedence defines the eight-level priority of the datagram (0 to 7) in issues such as
congestion.
Total Length: This is a 16-bit field that defines the total length (header plus data) of the IP
datagram in bytes.
Total length=Length of data + Header Length

Identification: This field is used in fragmentation.


70 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Flags: This field is used in fragmentation
Fragmentation Offset: This field is used in fragmentation
Time to Live (TTL): A datagram has a limited lifetime in its travel through an internet. This field
was originally designed to hold a timestamp, which was decremented by each visited router. The
datagram was discarded when the value became zero.
Protocol: This 8-bit field defines the higher-level protocol that uses the services of the IP layer.
An IP datagram can encapsulate data from several higher level protocols such as TCP, UDP,
ICMP, and IGMP.
Checksum: This 16-bit field defines header checksum.
Source Address: This 32-bit field defines the IP address of the source.
Destination Address: This 32-bit field defines the IP address of the destination.

Q2. Explain TCP segment format with diagram.


A packet in TCP is called a segment. The format of a segment is shown in below figure. The
segment consists of a header of 20 to 60 bytes, followed by data from the application program.
The header is 20 bytes if there are no options and up to 60 bytes if it contains options .

Source Port Address (SPA):This is a 16-bit field that defines the port number of the application
program in the host that is sending the segment.
Destination Port Address (DPA): This is a 16-bit field that defines the port number of the
application program in the host that is receiving the segment.
Sequence Number: This 32-bit field defines the number assigned to the first byte of data
contained in segment.
During connection establishment (discussed later) each party uses a random number generator
to create an initial sequence number (ISN), which is usually different in each direction.
Acknowledgment Number: This 32-bit field defines the byte number that the receiver of the
segment is expecting to receive from the other party. If the receiver of the segment has
successfully received byte number x from the other party, it returns x+1 as the acknowledgment
number.

71 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Header Length: This 4-bit field indicates the number of 4-byte words in the TCP header. The
length of the header can be between 20 and 60 bytes.
Reserved: This is a 6-bit field reserved for future use.
Control Fields: This field defines 6 different control bits or flags as shown in figure.

Window Size: This field defines the window size of the sending TCP in bytes. Note that the
length of this field is 16 bits, which means that the maximum size of the window is 65,535 bytes.
This value is normally referred to as the receiving window (rwnd) and is determined by the
receiver.
Checksum: This 16-bit field contains the checksum.
Urgent Pointer: This 16-bit field, which is valid only if the urgent flag is set, is used when the
segment contains urgent data.
Options: There can be up to 40 bytes of optional information in the TCP header.

Q3. What is firewall? Explain advantages and limitations of firewall.


 A firewall acts like a guard, which can guard a corporate network by standing between the
network and the outside world.
 A firewall is a network security system designed to prevent unauthorized access to a private
network from any other network. It works closely with a router program to determine if a packet
should be forwarded to its destination. It also provides a proxy service that makes network
requests on behalf of the users on a network.
 All traffic between the network and the Internet in either direction must pass through the firewall.
The firewall decides if the traffic can be allowed to flow, or whether it must be stopped from
proceeding further.
 Technically, therefore, a firewall is specialized version of a router. Apart from the basic routing
functions and rules, a router can be configured to perform the firewall functionality with the help
of additional software resources.
Below diagram shows the concept of firewall.

72 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


At a broad level, there are two kinds of attacks:
Most corporations have large amounts of valuable and confidential data in their networks.
Leaking of this critical information to competitors can be a great setback.
Apart from the danger of the insider information leaking out, there is a great danger of the
outside elements (such as viruses and Worms) entering a corporate network to create havoc.
Advantages of the Firewall
A firewall prevents unauthorized Internet users from accessing a private network connected to
the Internet.
It enforces a security policy by allowing a single point for implementing and controlling all
security decisions to be made.
It filters, monitors, and logs the sessions between any two networks. As a result, your exposure
to the Internet is also limited.
Limitation of the Firewall
Insider's intrusion: A firewall system is designed to thwart outside attacks. Therefore, if an
inside user attacks the internal network in some way; the firewall cannot prevent such an attack.
Direct Internet traffic: A firewall must be configured very carefully. It is effective only if it is the
only-entry point of an organization's network. If, instead, the firewall is one of the entry-exit
points, a user can bypass the firewall and exchange information with the Internet via the other
entry exit points. This can open up the possibilities of attacks on the internal network through
those points. The firewall cannot, obviously be expected to take care of such situations.
Virus attacks: A firewall cannot protect the internal network from virus threats. This is because
a firewall cannot be expected to scan every incoming file or packet for possible virus contents.
Therefore, a separate virus detection and removal mechanism is required for preventing virus
attacks. Alternatively, some vendors bundle their firewall products with anti-virus software, to
enable both the features out of the box.
It needs specialized skills to configure, and many attacks occur because of badly configured
policies on a firewall.

Q4. List the types of firewall explain any one in detail.


They have two basic types:
 Packet Filtering and
 Application Level

Q5. What is packet filter? Explain in detail with neat diagram.


Packet Filters:
 It is also called as screening router or screening filter.
 This is the basic level of the firewalls. Packet firewall checks for each and every IP packet
individually, either coming in or going out of private network.
73 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
 A network level firewall uses the protocols on the two networks to filter the data. Filtering
systems are often built into routers or can be added optionally. The router being a point of
interconnection between two networks, it becomes a natural location for filtering.
Below diagram shows the concept of firewall.

According to the selected policies (called Rule-sets or Access Control Lists or ACLs) it
determines whether to accept a packet or reject it. This is the first line of defense against the
intruders, and is not totally foolproof. It has to be combined with other techniques as well, to
strengthen the security.

Advantages
 Simple and straightforward mechanism.
 It is cost effective.
 It is fairly effective and adequate in most cases.
 Operation is totally transparent to the users.
 Faster in operation.
 It has a built-in operating system optimized for security and performance.

Disadvantages

74 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 It does not support user authentication as the filtering is based purely on the IP address of the
hardware system.
 Rule-sets to be defined for a packet filter may be very complex and rigid.
 In order to allow certain access, some exceptions to the rules need to be added. This may add
further to the complexity.
 Some packet filters do not filter on the source TCP/UDP ports at all, which may increase the
flaws in the filtering system.
 It does not allow us to record the logs of individual sessions. These do not possess any auditing
capabilities and auditing is considered to be of major importance in security.
 All the applications on Internet may not be fully supported by packet filtering firewalls.
 It does not conceal the internal architecture of the network and hence it gets exposed.
 Using packet filters may be complex as graphical interface is not available in most of the cases.
Q6. What is application gateway filter? Explain in detail with neat diagram.
An application gateway is also called as a proxy server. This is because it acts like a proxy i.e.
deputy or substitute, and decides about the flow of application level traffic.

An application gateway typically works as follows:


 An internal user contacts the application gateway using a TCP/IP application, such as HTTP or
TELNET.
 The application gateway asks the user about the remote host with which the user wants to set up
a connection for actual communication the application gateway also asks for the user id and the
password required to access the services of the application gateway.
 The user provides the information to the application gateway.
 The application gateway now accesses the remote host on behalf of the user, and passes the
packets of the user to the remote host.

Advantages
 Checks traffic in greater details than the packet filters.
 No need to check each and every packet, but checks application as a whole.
 Provides more security than the packet filters.
 These are available as software with Graphical interface, hence specifying, changing the Rule-
sets is easier in this case.
 Ability to hide the structure, topology and other sensitive information of the private network from
the external parties.
 Has capability of complete auditing/logging of events, which is an important aspect of security.

75 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Easier to install, setup and operate from the point of users (also called as personal firewalls
sometimes)
Disadvantages
 Operation may be slower since it has to check the traffic in more detail.
 The software products used may be costly to procure.
 In some cases, setup may be difficult and require administrative help.
 They are not transparent to the end users, and may have to be set up specifically on the client
nodes.
 It does not support new services easily.

Q7. List the firewall configuration and explain in detail.


Firewall is usually a combination of packet filters and application gateways. Based on this there
are three possible configurations of firewalls as shown in below figure.

Screened host firewall Single –Homed Bastion


This configuration set consist of two parts a packet filtering router and an application gateway.
Their purposes are as follows.
 The packet filter ensures that the incoming traffic is allowed only if it is destined for the
application gateway by examining the destination address field of every incoming IP packet.
Similarly it also ensures that the outgoing traffic is allowed only if it is originating from the
application gateway by examining the source address field of every outgoing IP packet.
 The application gateway performs authentication and proxy function.

Screened host firewall Dual –Homed Bastion

76 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 To overcome the drawback of Screened host firewall Single –Homed Bastion configuration
another type of configuration called Screened host firewall Dual–Homed Bastion exists. This
configuration is an improvement over the earlier scheme.
 Direct connections between the internal hosts and packet filter are avoided. The packet filter
connects only to the application gateway which in turn has separate connection with the internet
hosts. Therefore even if the packet filter is successfully attacked only the application gateway is
visible to the attacker. The internal hosts are protected.

Screened Subnet Firewall


The screened subnet firewall offers the highest security among the possible firewall configuration. It
is an improvement over the previous scheme of Screened host firewall Dual–Homed Bastion. Two
packet filters are used one between the internet and the application gateway.
Below diagram shows the concept of Screened Subnet Firewall

Q8. Short note on DMZ


 The concept of a Demilitarized Zone (DMZ) networks is quite popular in firewall architecture.
Firewalls can be arranged to form a DMZ. DMZ is required only if an organization has servers
that it needs to make available to the outside world.
 For this a firewall has at least three network interfaces. One interface connects to the internal
private network; the second connects to the external public network and the third connects to
the public server (which forms the DMZ network)
Below diagram shows the concept of Demilitarized Zone (DMZ)

77 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The chief advantage of such a scheme is that the access to any service on the DMZ can be
restricted.
Q9. Short note on Virtual Private Network (VPN)
The virtual private network (VPN) technology included in Windows Server 2003 helps enable
cost-effective, secure remote access to private networks. VPN allows administrators to take
advantage of the Internet to help provide the functionality and security of private WAN
connections at a lower cost. VPN is part of a comprehensive network access solution that
includes support for authentication and authorization services, and advanced network security
technologies.
Working
Suppose an organization has two networks, Network1 and Network2, which are physically apart
from each other and we want to connect them using the VPN approach.
In such a case, we set up two firewalls, Firewall1 and Firewall2. The encryption and decryption
are performed by the firewalls. The architectural overview is shown below figure
We have shown two networks, Network1 and Network2. Network1 connects to the Internet via a
firewall named Firewall1. Similarly, Network2 connects to the Internet with its own firewall,
Firewall2.
The key point here is that two firewall are virtually connected to each other via the Internet. We
have shown this with the help of a VPN tunnel between the two firewalls.
Let us assume that host X on Network1 wants to send a data packet to host Yon Network2. This
transmission would work as follows.

78 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 Host X creates the packet, inserts its own IP address as the source address and the IP address
of host Y as the destination address. This is shown in fig. It sends the packet using the
appropriate mechanism.

 The packet reaches Firewall1. It adds new headers to the packet. In these new headers it change
the source IP address of the packet from that host to X to its own address say F1. It also changes
the destination IP address of packet from that host Y to the IP address of firewall2 say F2.

 The packet reaches to Firewall2 over network the Internet via one or more routers. Firewall2
discards the outer header and perform the appropriate decryption and other cryptography
function as necessary. This yields the original packet as was created by host Y. It then takes look
at the plain text contents of packet and realizes that the packet is meant for host Y. Therefore it
delivers the packet to host Y.
79 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Q10.What is IPSec? Explain the benefits of IPSec.
IPsec provides security mechanisms that include secure datagram authentication and encryption
mechanisms within IP. When we invoke IPsec, IPsec applies the security mechanisms to IP
datagrams that we have enabled in the IPsec global policy file. Applications can invoke IPsec to
apply security mechanisms to IP datagrams on a per-socket level.
Applications of IPSec
Secure Remote Internet Access: We can make a local call to our Internet Service Provider
(ISP) so as to connect to our organization network in secure fashion from our home or hotel.
From there we can access the corporate network facilities or access remote desktop/server.

Secure Branch Office Connectivity: Rather than subscribing to an expensive leased line for
connectivity its branches across cities/countries, an organization can set an IPSec enabled
network to securely connect all its branches over the internet.
Set up communication with other organization: IPSec allows connectivity between various
branches of an organization; it can also be used to connect the networks of different
organizations together in secure and inexpensive fashion.

Positon of IPSec in TCP/IP

80 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Advantages of IPSec:
 IPSec is transparent to the end users. There is no need for an user training, key insurance or
revocation.
 When IPSec is configured to work with a firewall, it becomes the only entry-exit point for all traffic;
making it extra secure.
 IPSec works at network layer. Hence no changes are needed to upper layers.
 When IPSec is implemented in firewall or router all the outgoing and incoming traffic gets
protected.
 IPSec can allow traveling staff to have secure access to the corporate network.
 IPSec allows interconnectivity between branches /offices in very inexpensive manner.

Q11. Explain IPSec Protocols.


IP Packet consist of two portions IP Header and actual Data. IPSec are implemented in form of
additional IP headers (called extension headers) to the standard default IP headers.
IPSec actually consist of two main protocols as shown below diagram.

Authentication Header
The authentication header provides data authentication, strong integrity, and replay protection to
IP datagrams. AH protects the greater part of the IP datagram. AH cannot protect fields that
change non-deterministically between sender and receiver. For example, the IP TTL field is not a
predictable field and, consequently, not protected by AH. AH is inserted between the IP header
and the transport header.

Encapsulating Security Payload


The encapsulating security payload (ESP) header provides confidentiality over what the ESP
encapsulates, as well as the services that AH provides. However, ESP only provides its
protections over the part of the datagram that ESP encapsulates. ESP's authentication services
are optional. These services enable us to use ESP and AH together on the same datagram
without redundancy.
Both AH and ESP can be used in one of the two modes.

81 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Tunnel Mode
In this encrypted tunnel is established between two hosts. Suppose X and Y are two hosts
wanting to communicate with each other using the IPSec tunnel mode. They identify their
respective proxies say P1 and P2 and logical encrypted tunnel is established between P1 and
P2. X sends its transmission to P1. The tunnel carries the transmission to P2. P2 forwards to Y.

The internal IP header contains the source and destination addresses as X and Y whereas the
external IP header contains the source and destination addresses as P 1 and P2. That way X
and Y are protected from potential attackers.

In tunnel mode IPSec protects the entire IP datagram. It takes an IP datagram add the IPSec
header and trailer and encrypts the whole thing. It then adds new IP header to this encrypted
datagram.

Transport Mode
82 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
The transport mode does not hide the actual data source and destination addresses. They are
visible in plain text while in transit. In the transport mode IPSec takes the transport-layer payload
adds IPSec header and trailer, encrypts the whole thing and then adds the IP header. Thus the
IP header is not encrypted.

Q12. Draw and explain Authentication Header format.

Authentication Header
The authentication header provides data authentication, strong integrity, and replay protection
to IP datagrams. Below diagram shows the header format of Authentication Header.

83 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Authentication Header consist of various field as follows
Next Header: Size of this field is 8 bit. It identifies the type of header that immediately follows the
AH.
Payload Length: Size of this field is 8 bit. This field is used to determine length of AH.
Reserved: Size of this field is 32 bit. It is reserved for future use.
Security Parameter Index (SPI): Size of this field is 32 bit. It is used in combination with source
and destination address as well as IPSec protocol used to uniquely identify the Security
Association (SA).
Sequence Number: Size of this field is 32 bit. It is used to prevent from reply attacks.
Authentication Data: This is variable –length field. It contains the authentication data called as
Integrity Check Value for datagram.

Q13. Explain modes of operation of Authentication Header.


AH can work in two modes: the transport mode and the tunnel mode.
AH Transport Mode
In this mode the position of the Authentication Header (AH) is between the original IP header
and the original TCP header of the IP packet. This is shown in fig.

AH Tunnel Mode
In the tunnel mode, the entire original IP packet is authenticated and the AH is inserted between
the original IP header and a new outer IP header. The inner IP header contains the ultimate
source and destination IP addresses, whereas the outer IP header possibly contains different IP
addresses.

Q14. Draw and explain ESP Header format.


84 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Encapsulating Security Payload
The Encapsulating Security Payload (ESP) header provides confidentiality over what the ESP
encapsulates, as well as the services that AH provides.
Below diagram shows the header format of Encapsulating Security Payload (ESP).

Encapsulating Security Payload (ESP).consist of various field as follows

Security Parameter Index (SPI): Size of this field is 32 bit. It is used in combination with source
and destination address as well as IPSec protocol used to uniquely identify the Security
Association (SA).
Sequence Number: Size of this field is 32 bit. It is used to prevent from reply attacks.
Payload Data: This is variable-length field contains the transport layer segment or IP packet
which is protected by encryption.
Padding: This field contains the padding bits.
Payload Length: Size of this field is 8 bit. This field is used to determine length of ESP.
Next Header: Size of this field is 8 bit. It identifies the type of header that immediately follows the
ESP.
Authentication Data: This is variable –length field. It contains the authentication data called as
Integrity Check Value for datagram.

Q15. Explain modes of operation of Encapsulating Security Payload.


ESP can work in two modes: the transport mode and the tunnel mode.
ESP Transport Mode
Transport mode ESP is used to encrypt and optionally authenticate the data carried by IP. Here
the ESP is inserted into the IP packet immediately before transport layer header and ESP trailer
is added after the IP packet. Below diagram shows the concept of ESP transport mode.

85 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


ESP Tunnel Mode
The tunnel mode ESP encrypts an entire IP packet. Here the ESP header is pre-fixed to the
packet and then the packet along with the ESP trailer is encrypted. Below diagram shows the
concept of ESP transport mode.

Q16. Write short note on VPN?


VPN stand for Virtual Private Network. A VPN can connect distant networks of an organization
using private network over the public network. VPN combines the advantages of public network
i.e. cheap and easily available and private network i.e. secure and reliable. A VPN tunnel is
created between two firewalls of different network.

Transmission of VPN works as follows:


Step 1: host X creates the packet, inserts its own IP address as the source address and the IP of
86 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
host Y as the destination address

Step 2: the packet reaches firewall 1. It adds new header to packet. It changes the source IP
address of packet from host X to its own address. It also changes the destination IP address from
host Y to IP address of firewall 2.

Step 3: the packet reaches firewall 2 over the internet. Firewall 2 discards the outer header and
performs the appropriate decryption and other cryptographic functions as necessary. This yields
the original packet.

Q17. What are intruders? Its types


No matter how much secure a system is made there would be attackers who would constantly
try to find their way. We call then intruders because they try to intrude into the privacy of network.
Intruders are said to be of three types.

Masquerader: A user who does not have the authority to use a computer but penetrates into a
system to access a legitimate user’s account is called as masquerader. It is generally external
user.
Misfeasor: There are two possible cases for internal user to be called a misfeasor.
 A legitimate user who does not have access to some applications data or resources accesses
them.
 A legitimate user who has access to some application data or resources misuses these
privileges.

87 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Clandestine User: An internal or external user who tries to work using the privileges of a
supervisor user who has access to some applications data or resources accesses is called as
clandestine user.

Q18. Short note on Audit Records


One of most important tools in intrusion detection is usage of audit records also called audit logs.
Audit records are used to record information about the actions of users. Traces of illegitimate
user actions can be found in these records so as to detect intrusions so as to take appropriate
actions.
Audit records can be classified into two categories:

Native Audit Records: All multi –user operating systems have accounting software built-in. This
software records information about all user actions.
Detection specific Audit Records: This type of audit records facility collects information specific
only to intrusion detection. This is more focused but may duplicate information.
Regardless of type of audit records each such record contains information as shown in table.

Q19. Short note on IDS

88 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Intrusion prevention is almost impossible to achieve at all times. Hence, more focus is on
intrusion detection.
Following factors motivate efforts on intrusion detection:
 The sooner we are able to detect an intrusion the quicker we can act; the hope of recovering
from attacks and losses is directly proportional to how quickly we are able to detect an
intrusion.
 Intrusion detection can help collect more information about intrusions, strengthening the
intrusion prevention methods.
 Intrusion detection systems can act as good deterrents to intruders.

Intrusion detection mechanisms, also known as intrusion Detection Systems (IDS) are
classified into two categories: Statistical anomaly detection and Rule-based detection.

Statistical Anomaly Detection: in this type, behavior of users over time is captured as statistical
data and Processed. Rules are applied to test whether the user behavior was legitimate or not.
This can be done in two ways.
 Threshold Detection: In this type threshold are defined for all the users as group and frequency
of various events is measured against these thresholds.
 Profile based detection: In this type profiles for individual users are created and they are
matched against the collected statistics to see if any irregular pattern emerges.
Rule Based Detection: A set of rules is applied to see if a given behavior is suspicious enough
to be classified as an attempt to intrude. This is also classified into two sub-types:
 Anomaly Detection: Usage patterns are collected to analyze deviation from these usage
patterns with the help of certain rules.
 Penetration Identification: This is an expert system that looks for illegitimate behavior.

Q20. Different types of web pages.


Static web pages: The main player in any internet based communication or transaction are the
web browser and the web server. The Hyper Text Transfer Protocol (HTTP) is used for
communication between the browser and server. This is of a request-response form. These types
of web pages are called static web pages.
Dynamic web pages: A dynamic web page is, as dynamic as its name suggest! The content of
a dynamic web page can vary all day depending on a number of parameters for instance, they
could change to reflect the latest stock prices, or depending on whether user A or B has asked
for certain information, the contents could be filtered out and only those allowed for A or B could
be shown. It is obvious that dynamic web pages are more complex than static web pages.
Active web pages: with the arrival of popular programming language Java, active web pages
became quite popular. The idea behind active web pages is actually quite simple. When a client
sends an HTTP request for an active web page, the web server sends back an HTTP response
that contains an HTTP page as usual.
Q20. Write a short note on SSL.
Secure Socket Layer (SSL):

89 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The Secure Socket Layer (SSL) protocol is an Internet protocol for the security exchange
information between a Web browser and a Web Server. Logically, it provides a secure pipe
between the Web Browser and Web server. SSL allows sensitive information such as credit card
numbers, social security numbers, and login credentials to be transmitted securely.

It can be conceptually considered as an additional layer in TCP/IP protocol suite. The SSL layer
is located between application layer and the transport layer.

Application Layer
SSL Layer
Transport Layer
Internet Layer
Data Link Layer
Physical Layer
Position of SSL in TCP/IP
It provides two basic security services: AUTHENTICATION and CONFIDENTIALITY.

Secure Socket
Layer Sevices

Authentication Confidentiality

SSL Services
SSL was developed by Netscape Corporation in 1994.
Working of SSL
SSL has three sub- protocols:
1. Handshake Protocol
2. Record Protocol
3. Alert Protocol

SSl sub-
protocols

Handshake Record Alert


Protocol Protocol Protocol

90 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


HANDSHAKE PROTOCOL
The handshake protocol of SSL is the first sub-protocol used by the client and the server to
communicate using a SSL-enabled connection.

Handshake message has three fields:

Type Length Content


1 byte 3 byte 1 or more bytes

Format of handshake protocol


 Type (1 byte): This field indicates the length of the message in byte.
 Length (3 bytes): This field contains the length of the message in bytes.
 Content (1 or more byte): This field contains the parameters associated with this message
depending upon the message type.

Message Type Parameters


Hello request None
Client Hello Version, Random Number, Session Id, Cipher suite, Compression
method
Server Hello Version, Random Number, Session Id, Cipher suite, Compression
method
Certificate Chain of X.509V3 certificates
Server-key Parameter, signatures
Exchange
Certificate request Type, authorities
Server hello Done None
Certificate verify Signature
Client-key Parameters, signatures
exchange
Finished Hash value
The handshake protocol is made up of following four phases
Phase 1: Establish Security Capabilities

The first phase of the SSL handshake is used to initiate a logical connection and establish the
security capabilities associated with that connection. This consists of two messages: the client
hello and the server hello.

91 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Web Step 1: Client Hello Web Server
Browser Step 2: Sever Hello

(Fig)Phase 1: Establish Security capabilities


The client hello message consists of the following parameters.
 Version: This field identifies the highest version of SSL that the client can support.
 Random: It contains two sub fields:
 A 32-bit date-time field that identifies the current system date and time on the client
computer.
 A 28-byte random number generated by the random-number generator software built
inside the client computer.
 Session ID: This is a variable length identifier. If this contains a non-zero value, it means that
there is already a connection between the client and the server, and the client wishes to
upgrade the parameters of that connection.
 Cipher suite: This list contains a list of the compression algorithms supported by the client.

The server hello message consists of the following phase:


 Version: This field identifies the lower of the versions suggested by the client and the highest
supported by the server.
 Random: This field has the same structure as the random field of the client. The random value
generated by the server is completely independent of the client’s Random value.
 Session id: If the session id value sent by the client was non-zero, the server uses the same
value. Otherwise, the server creates a new session id and puts it in this field.
 Cipher suite: Contains a single cipher suite, which the server selects from the list sent earlier
by the client.
 Compression method: Contains a compression algorithm, which the server selects from the
list sent earlier by the client.
Phase 2: Server Authentication and Key Exchange.
The server initiates the second phase of the SSL handshake, and is the sole sender of all
messages in this phase. The client is the sole recipient of all these messages.

Step 1: Certificate

Step 2: Server Key Exchange


Web Browser Web Server
Step 3: Certificate request

Step 4: Server hello done


Four steps of phase 2:

92 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


First step: Certificate: The server sends its digital certificate and the entire chain leading up to
root CA to the client. This will help the client to authenticate the server using the server’s public
key from the server’s certificate.
Second Step: Server Key Exchange (optional): It is used only if the server does not send its
digital certificate to the client in step 1.
Third Step: Certificate Request: The server can request for the client’s digital certificate.
Fourth Step: Server Hello Done: Message indicates to the client that its partition of the hello
message is complete.

Phase 3: Client Authentication and Key Exchange


The client initiates this third phase of the SSL handshake, and is the sole sender of the all
message in this phase. The server is the sole recipient of all these messages. This phase
contains three steps:
1. Certificate
2. Client Key Exchange
3. Certificate Verify.

Step 1: Certificate

Web Browser Step 2: Client Key Exchange


Web Server

Step 3: Certificate Verify

(Fig) Client Authentication and key exchange


First Step: Certificate (optional): This step is performed only if the server had requested for the
client’s digital certificate.
Second Step: Client Key Exchange: Allows the client to send information to the server, but in
opposite direction. This information is related to the symmetric key that both the parties will use in
this session.
Third Step: (Certificate Verify): It is necessary only if the server had demanded client
authentication.
Phase 4: Finish
The client initiates the fourth phase of SSL handshake, which the server ends. This phase
contains four steps:

1. Change cipher specs

2. Finished
Web Browser Web Server
(Fig)Phase 4: Finished Step 3: Change cipher specs

Step 4: Finished

93 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


RECORD PROTOCOL

 The Record protocol in SSL comes into picture after a successful hanshake is completed
between the client and the server.
 Adter the client and the server have optionally authenticated each other and have decided
what algorithms to use for secure information exchanged.
 The services of this steps are as follows:

Services of
Record
Protocol

Confidentiality Integrity

)Services of Record Protocol


Confidentiality: This is achieved by using the secret key that is defined by the handshake
protocol.
Integrity: The SSL record protocol takes an application message as input,it fragments it into
smaller blocks,optionally compress each block.
Steps of Record protocol:

Addition of Append
Fragmentation Compression Encryption
MAC HEader

(fig)Process of Record Protocol

1. Fragmentation: The original application is broken into blocks, so that the size of the block is
less than or equal to 214 bytes(16,384 bits).
2. Compression:The fragmented blocks are optionally compressed.
3. Addition of MAC: Usinng the shared key established previously in the handshake protocol, the
Message Authentication Code(MAC) for each block is calculated.
4. Encryption: Using the symmetric key, the output of the previous step in encrypted.
5. Append Header: Finally, a header is added to the encrypted block.

Field Length(in Decription


bits)
Conetnt Type 8 bits Specifies the protocol used for processing the record
Major Version 8 bits Specifies the major version of the SSL protocol in
used
Minor Version 8 bits Specifies the minor version of the SSL protocol in
used
Compressed 16 bits Specifies the length in bits of the original plain text
length
(Fig) Contents of the header

94 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


The final SSL message looks as follows:

Content Type Major Version Minor Version Compressed Length


Plain Text(optionally compressed)

MAC(0,16 or 20 bytes)

ALERT PROTOCOL
 When either the client or the server detects an error, the detecting party sends an alert
message to the other party.
 If the error is fatal, both the parties immediately close the SSL connection.
 Both the parties also destroy the session identifiers,secrets and keys associated with this
connection before it is terminated.
 Other errors,which are not so severe,do not result in the termination of the
connection.Instead,the parties handle the error and continue.

Severity Cause
Byte 1 Byte 2

(Fig).Alert protocol message format.


Each alert message consists of two bytes.The first byte signifies the type of error.If it is a
warning, this byte contains 1.If the error is fatal, this byte contains 2.The second byte specifies
the actual error.

Alert Descriptive
Unexpected An inappropriate message was received
message
Bad record MAC A message is received without a correct MAC
Decompression The decomposition function received an improper input.
failure
Handshake failure Sender was unable to negotiate an acceptable set of
security paeameters from the available options.
Illegal parameters A field in the handshake message was out of range or was
inconsistent with the other fields.
(Fig) Fatal alerts

Alert Description
No certificate Sent in response to certificate request if an appropriate
certificate is not available.
Bad certificate A certificate was corrupt
Unsupported The type of the received certificate is not supported
certificate
95 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Certificate revoked The signer of a certificate has revoked it
Certificate expired A received certificate has expired
Certificate unknown An unspecified error occurred while processing the certificate
Close notify Notifies that the sender will not send any more messages in this
connection. Each party must send this message before closing
its side of the connection.
(Fig) Non-fatal alerts
Closing SSL Connection
 Before ending the SSL connection, the client and the server must inform each other that their
Side of the connection is ending.
 Each party sends a Close notify alert to the other party. This ensures a graceful closure of the
connection.
 When a party receives this alert, it must immediately stop whatever it is doing, send its own
Close notify alert and end the connection from its side as well.
 If an SSL connection ends without a Close notify from either party, it cannot be resumed.

Q21. What is Transport Layer Security (TLS)?


The Transport Layer Security (TLS) protocol, Secure Sockets Layer (SSL) protocol, versions 2.0
and 3.0, and the Private Communications Transport (PCT) protocol are based on public key
cryptography. The Security Channel (Schannel) authentication protocol suite provides these
protocols. All Schannel protocols use a client/server model.
In the authentication process, a TLS/SSL client sends a message to a TLS/SSL server, and the
server responds with the information that the server needs to authenticate itself. The client and
server perform an additional exchange of session keys, and the authentication dialog ends.
When authentication is completed, SSL-secured communication can begin between the server
and the client using the symmetric encryption keys that are established during the authentication
process.

For servers to authenticate to clients, TLS/SSL does not require server keys to be stored on
domain controllers or in a database, such as the Microsoft Active Directory service. Clients
confirm the validity of a server’s credentials with a trusted root certification authority’s (CA’s)
certificates, which are loaded when you install Microsoft Windows Server 2003. Therefore, unless
user authentication is required by the server, users do not need to establish accounts before they
create a secure connection with a server.

Q22. Difference between TLS and SSL

96 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q23. What is SET?
The Secure Electronic Transaction (SET) is an open encryption and security specification that is
designed for protecting credit-card transaction on the internet. The pioneering work in this area
was done in 1996 by MasterCard and Visa jointly. Later they were joined by IBM, Microsoft,
Netscape, etc.
SET is not a payment system. Instead, it is a set of security protocols and formats that enables
the user to employ the existing credit-card payment infrastructure on the internet in the secure
manner.
Overview of SET Protocol
Secure payment systems are critical to the success of E-commerce. There are four essential
security requirements for safe electronic payments (Authentication, Encryption, Integrity and Non
-repudiation). Encryption is the key security schemes adopted for electronic payment systems,
which is used in protocols like SSL and SET.
Purpose
The purpose of the SET protocol is to establish payment transactions that
 provide confidentiality of information;
 ensure the integrity of payment instructions for goods and services order data;
 Authenticate both the cardholder and the merchant
SET participants
 Cardholder (customer): authorize holder of credit card who makes online purchases.
 Merchant (web server): the one who wants to sell goods.
 Issuer: it is a financial institute that provide the card and makes payment on behalf of
cardholder
 Acquirer: merchants accepts card of more than 1 brand, thus merchant have a good
relationship with acquirer.
 Payment Gateway: it processes the payment messages on behalf of merchant. it act as an
interface between SET and the existing card-payment networks.
 CA: trusted party who provide public key certificates to cardholders, merchants and
payment gateways.

Q24. Explain the concept of Dual signature in SET (Secure Electronic Transaction).
Dual Signatures
A new application of digital signatures is introduced in SET, namely the concept of dual
signatures. Dual signatures is needed when two messages are need to be linked securely but
only one party is allowed to read each. The following picture shows the process of generating
dual signatures.

97 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


In SET, dual signatures are used to link an order message sent to the merchant with the payment
instructions containing account information sent to the acquirer (merchant bank). When the
merchant sends an authorization request to the acquirer, it includes the payment instructions sent
to it by the cardholder and the message digest of the order information. The acquirer uses the
message digest from the merchant and computes the message digest of the payment
instructions to check the dual signatures.

Q25. What are the processes of SET?


The SET protocol utilizes cryptography to provide confidentiality of information, ensure payment
integrity, and enable identity authentication. For authentication purposes, cardholders,
merchants, and acquirers will be issued digital certificates by their sponsoring organizations. It
also use dual signature, which hides the customer’s credit card information from merchants, and
also hides the order information to banks, to protect privacy.

Process Steps
1) The customer opens an account
2) Customer receives a certificate
3) Merchant receives a certificate
4) Customer places an order
5) Merchant is verified
6) Order and payment details are sends
7) Merchant requests payment authorization
9) The payment gateway authorizes the payment
10) The merchant provides goods or services
11) The merchant request payment

98 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q26. What are the objectives of SET, how are they achieved?
The main concern with online payment mechanisms is that they demand that the customer send
his/her credit card detail to the merchant. There are 2 aspect of this. One is that the credit card
number travels in clear text, which provides an intruder with an opportunity to know that number
and use it with malicious intention. The second issue is that the credit card number is available to
the merchant, who can misuse it.
The first concern is generally dealt with SSL. However, SSL does not achieve its second
objective. In this context, SET is very important.
SET achieve its objective of hiding the payment detail from the merchant using the concept of
digital envelop
1. The SET software prepares the payment information on the card holder’s computer.
2. However, what is specific to SET is that the card holder computer now creates a 1 time
session key.
3. Using this 1 time session key, the card holder computer now encrypts the payment
information.
4. The card holder’s computer now wraps the 1 time session key with the public key of the
payment gateway to form a digital envelop.
5. It then sends the encrypted payment information and the digital envelop together to the
merchant.

Q27. Explain SET internals


Purchase Request:
Initiate request: CH will send unique id and his name. In return he will request for DC from
merchant and gateway.
Initiate response: merchant will send transaction id and DC as requested.
Purchase request: CH will send order and payment information encrypted with k. this K is
enveloped with public key. He also sends his DC that contains public key.
Purchase response: merchant verifies the CH details and acknowledge the CH.
Payment Authorization
Authorization Request: merchant will send the payment information, encrypted transaction and
Dc of himself and CH to gateway.
Authorization Response: gateway validates the details. And sends its DC to merchant
Payment Capture
Capture Request: merchant asks for the payment to the payment gateway. Sends the transaction
id, amount and DC
Capture response: gateway authorizes his details and encloses its DC.
Q28. Difference between SSL and SET

99 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q29. What is 3-D secure protocol?
In spite of its advantages, SET has 1 limitation: it does not prevent the user from providing
someone else’s credit card number. The credit card number is protected from the merchant. A
new protocol developed by Visa has emerged, called 3-D secure.
The main difference between SET and 3-D secure is that any CH who wishes to participate in a
payment transaction involving the usage of the 3-D secure protocol has to enroll on the issuer
bank’s enrollment server.
In actual 3-D secure transaction, when the merchant receive a payment instruction from the CH,
it forwards this request to the bank through Visa network. The bank requires the CH to provide
the user id and password given to him. The bank verifies this information against its 3-d secure
enrolled user’s database. After the authentication only, does the issuer bank inform merchant that
it can accept card payment instruction.

3-D protocol works as follows:


Step 1: the user shops the shopping cart on the merchant site, and decides to pay the amount.
The user enters the credit-card details for this purpose, and clicks on the OK button as shown;

100 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 2: When the user clicks on OK, the user will be redirected to the issuer bank’s site. Here
user will have to enter the password provided by the issuer bank. The bank authenticates the
user by the mechanism selected by the user earlier.

Q30. What is PEM? Explain how PEM works?


The privacy Enhanced Mail (PEM) is an email security standard adopted by the Internet
Architecture Board (IAB) to provide secures electronic mail communication over the internet.
PEM supports the following main cryptographic functions.

Working of PEM:
The broad level steps in PEM are;

PEM allows 3 security options when sending an email message.


 Signature only (step 1 & 2)
 Signature and base-64 encoding (steps 1, 2 & 4)
 Signature, encryption and base-64 encoding (steps 1 to 4)
Step 1: Canonical Conversion: Used when the sender and receiver use computers of different
architecture and OS.
101 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271
Step 2: Digital Signature: it is a typical process of digital signature where encryption is done
with sender’s private key

Step 3: Encryption: Encryption is done with DES or 3-DES algorithm in CBC mode.

Step 4: Base-64 Encoding: this process transform arbitrary binary input into printable characters
output. It takes 6-bit inputs and convert into 8-bit

Base-64 concept Base-64 example

102 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q31. What is PGP? Explain how PGP works.
PGP Pretty Good Privacy is protocol used for privacy and security of email messages. It supports
basic requirements of cryptography and is quite simple to use and is completely free. There are 5
steps in PGP as follows:

Digital Signature: PGP creates a message digest of the email message using SHA-1 algorithm.
The digest is then encrypted with the sender’s private key, which forms the sender’s digital
signature.
Compression: In this step the input message as well as the digital signature is compressed
together to reduce the size of the final message that will be transmitted. For this the L-Z algorithm
is used.

Encryption: In this step, the compressed output of step 2 is encrypted with a symmetric key. For
this generally IDEA algorithm is used CFB mode.
Digital Enveloping: In this step the symmetric key used in previous step is encrypted using
receiver’s public key. The output of step 3 and 4 together forms a digital envelope.

Base-64 encoding: The output of step 4 is now Base-64 encoded.

103 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


This is the final message that is transmitted across the network. The receiver has to perform the
last four steps in the reverse order in order to get the original plaintext email message back.

Q32. Explain the header format of MIME messages.


The MIME specification includes the following elements:
1. Five new message header fields are defined, which may be included in an RFC 822 header.
These fields provide information about the body of the message.
2. A number of content formats are defined, thus standardizing representations that support
multimedia electronic mail.
3. Transfer encodings are defined that enable the conversion of any content format into a form
that is protected from alteration by the mail system.

The five header fields defined in MIME are as follows:


MIME-Version: Must have the parameter value 1.0. This field indicates that the message
conforms to RFCs 2045 and 2046.
Content-Type: Describes the data contained in the body with sufficient detail that the receiving
user agent can pick an appropriate agent or mechanism to represent the data to the user or
otherwise deal with the data in an appropriate manner.
Content-Transfer-Encoding: Indicates the type of transformation that has been used to
represent the body of the message in a way that is acceptable for mail transport.
Content-ID: Used to identify MIME entities uniquely in multiple contexts.
Content-Description: A text description of the object with the body; this is useful when the
object is not readable (e.g., audio data).
Any or all of these fields may appear in a normal RFC 822 header. A compliant implementation
must support the MIME-Version, Content-Type, and Content-Transfer-Encoding fields; the
Content-ID and Content-Description fields are optional and may be ignored by the recipient
implementation.

Q33. What is WAP?


The Wireless Application Protocol (WAP) is a communication protocol that enables wireless
mobile devices to have an access to the internet. The WAP architecture was developed keeping
in mind the basic internet architecture, and yet realizing that WAP had to deal with the limitations
of the mobile device. Thus, the idea was to model WAP on internet architecture and at the same
time, make sure that the difference between the wired and wireless world would be taken care of.
Thus, the basic principle was to give the end user a look and feel that is similar to what the
internet gives.

104 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


In case of the WAP architecture, we have an additional level between the client and the server:
the WAP gateway the WAP gateway is to translate client request to the server from WAP to
HTTP, and on the way back from the server to the client, from HTTP to WAP as shown below

The WAP requests first originate from the mobile device, which travel to the network carrier’s
base station (shown as tower), and from there, they are relayed on the WAP gateway where the
conversion from WAP to HTTP takes place. WAP gateway then interacts with the web server
(also called origin server) as if it is a web browser, i.e. it uses HTTP protocol for interacting with
the Web server. On return, the web server sends an HTTP response to the WAP gateway, where
it is converted into a WAP response, which first goes on the base station, and from there on, to
the mobile device.
The WAP stack

As the figure shows the WAP stack consist of five protocol layers, of which we are interested in
only one: Security layer
The security layer in WAP stack is also called wireless Transport Layer Security (WTLS) protocol.
It is an optional layer, that when present, provides features such as authentication, privacy and
secure connections-as required by many modern e-commerce and m-commerce applications.

Q34. Explain the security in GSM.


In earlier days of mobile telephony, analog technologies such as amps were used but there was
little or no security in such technologies. D-amps were an improvement to amps. Another similar
technology called gsm is used. An alternative to WAP standard have emerged i.e. gprs which
offers an analog modems service wherever gsm wireless service is available.
There are three key aspects to gsm security:
 Subscriber identity authentication.
 Signaling data confidentiality.
 User data confidentiality.

105 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


How security is achieved in gsm:
Authentication:
1. The gsm network authenticates subscriber by a challenge-response mechanism.
2. The network sends 128 bit random number to subscriber.
3. 32-bit signed response using A3 and Ki is prepared by the handset and send to network.
4. The network retrieves its value of Ki from database
5. Performs the same operation using A3 algorithm.
6. If the result matches with the one received from handset.
7. Then the user authentication is successful.
Signaling and data confidentiality:
1. A8 algorithm is used to create a 64 bit ciphering key
2. The value of Kc is obtained by applying the same random number as above.
3. Kc is later used for secure communication between the subscriber and the mobile
telephony base station.
Voice and data security:
1. A5 algorithm is used to encrypt the voice and data traffic between handset and network.
2. For this, the handset sends a ciphering mode request to the network.
3. In response, the network starts encryption and decryption using A5 and Kc.

106 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Unit-VI
Topics:
User Authentication |Kerberos

107 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q1. What is Authentication?
The whole concept of authentication is based on determining who an individual user is,
before allowing the user to go ahead and perform actual business transactions using the
system. Authentication can be defined as determining an identity to the required level of
assurance.

Authentication is the first step in any cryptographic solution. We say this because unless we
know who is communicating, there is no point in encryption what is being communicated. As
we know, the whole purpose of encryption is to secure communication between two or more
parties.

Unless we are absolutely sure that the parties really are what they claim to be, there is no
point in encrypting the information flowing between them. Otherwise, there is a chance that
an unauthorized user can access the information. In cryptographic terms, we can put this in
other words: there is no use of encryption without authentication.

Q2. Write a short note on passwords.


Passwords are the most common form of authentication. A password is a string of alphabets,
numbers and special character, which is supposed to be known only to the entity that is being
authenticated.
Clear-text passwords:
Working
This is the simplest password-based authentication mechanism. Usually, every user in the
system is assigned a user id and an initial password.

Step 1: Prompt for user id and password.

Step 2: User enters user id and password.

108 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 3: User id and password validation.

Step 4: Authentication result.

Step 5: Inform user accordingly.

Something derived from the passwords:


The variation from the basic password-based authentication is not to use the password itself,
but to use something that is derived from the password.
That is, that is instead of storing the password as it is, or in an encrypted format, we can run
some algorithm on the password and store the output of this algorithm as the password in the
database.

Message digests of passwords:


Step 1: Storing message digest as derived passwords in the user database.

109 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 2: user authentication.

Step 3: server-side validation.

Adding randomness:
To improve the security of the solution, we need to add a bit of unpredictability or
randomness to the earlier scheme.
Step 1: storing message digests or derived password in the user database.
Step 2: user sends a login request.

110 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 3: server creates a random challenge
.

Step 4: user signs the random challenge with the message digest of the password.

111 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 5: server verifies the encrypted random challenge received from the user.

Step 6: server returns an appropriate message back to the user.

Q3. Explain Password Encryption in detail.


To resolve our problem of transmission of clear-text passwords, we can first encrypt the
password on the user’s computer, and then send it to the server for authentication. This

112 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


means that we must provide for some sort of cryptographic functionality on the user’s
computer. This is not a problem in case of client-server applications. However in case of
internal application where client is web browser, this can be a problem. Consequently, we
must resort to technologies such as secure socket layer. That is, a secure SSL connection
must be established between the client and the server. Wherein, the client verifies the
server’s authenticity based on the server’s digest certificate. After this the communication
between them will be encrypted using SSL, so the password need not have any application-
level protection mechanisms now. SSL would perform the required encryption operations. As
shown below

Q4. What are the problems with passwords?


A major misconception is that passwords are the simplest and the cheapest form of
authentication mechanisms. End user might actually be right in having this perspective.
However, from an application or system administration point of view, this is quite incorrect
Typically, an organization has a number of applications, networks, shared resources and
intranets. These applications have a varying need of security. Therefore, each source
demands its own user id and password. To overcome the troubles associated with this, most
users either keep the same password for all the resources, or record their password at some
place.
Organizations specify password policies, which mandate the structure of passwords. This
can include following points.
 The password length must be 8 characters

113 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


 It must not contain any blanks
 There must be one lower-case, one upper-case, one number and one special
character in password
 The password must begin with an alphabet

As we can see, this can be a significant deterrent to dictionary attacks, whereby attackers
simply take normal words and try them as passwords. However this creates a problem of
remembering cryptic passwords for the end users. Therefore, users resort to writing their
passwords somewhere, which can defeat the whole purpose of a password policy.

Q5. Write a short note on Authentication Tokens?


Authentication can be defined as determining an identity to the required level of assurance.
Authentication token is an alternative of password. Authentication token is a small device that
generates a new random value every time it is used. Each authentication token is pre-
programmed with a unique number called a random seed.
Working:
Step 1- Creation of a token:
 Whenever an authentication token is created, the corresponding random seed is generated
for the token by the authentication server.
 This seed is pre-programmed inside the token, as well as its entry is made in the user
database.

Step 2- Use of token:


 Authentication token automatically generates pseudorandom numbers, called one time
password/ passcodes.
 They are generated randomly by an authentication token based on the seed value that they
are pre-programmed with.
 Authentication server can use this program to determine if a particular seed value relates to a
particular one time password or not.
 As shown in below diagram

Step 3- Server returns appropriate result back to user:


 Server returns appropriate result back to user depending on previous operation yielded
success or failure.

114 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Use of token
Q6. Explain types of authentication token.
There are two types of authentication tokens. As shown below

Challenge Response Token:


It involves following steps:
Step 1- User sends a login request: the user sends the login request only with his/her
id.

115 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 2- server creates a random challenge: when server receive user login request
containing user id alone, it first checks to see if user id is valid. If it is not, it sends an
appropriate error message. If it is valid, the server creates a random challenge and sends it
back to user.

Step 3- User signs the random challenge with the message digest of the password:
The whole process is shown below

116 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 4-Server verifies the encrypted random challenge received from the user.

117 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 5- Server returns an appropriate result back to the user:

Time based token:


It involves following steps:
Step 1- Password generation and login request:
 The token automatically generates and display a password every60 seconds. The password
is based on the system and the system time.
 User sends a login request to the server.

Step 2- Server side verification:


The server’s user authentication program obtains the seed value for the user from the user
database.
 The server performs the same cryptographic function as was done by the authentication
token using the user’s seed and the system time.
 The server compares the two passwords:

118 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 3- Server returns appropriate message back to the user.

Q7. Explain certificate based authentication.


 It is based on the digital certificate of the user.
 Working of CBA involves following steps:
Step 1- Creation, storage and distribution of Digital Certificates

119 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 2- Login request:
 Login request only contains user id.

Step 3- Server creates a random challenge:


 The server’s user authentication program checks only user id against the database
 The server creates a random challenge
 The server sends the random challenge back to the user

120 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 4- User signs the random challenge:
 The user has to now sign the random challenge with her private key.
 The user must enter the secret password for opening up the private key file.
 The application uses this private key to encrypt the random challenge to create the user’s
digital signature.
 Server then verifies the user’s signature

121 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Step 5- Server returns appropriate message back to the user

Q8. Short note on use of smart card.


The use of smart cards can actually be related to certificate-based authentication. This is
because smart cards allow the generation of private-public key pairs within the card. They also
support the storage of digital certificate within the card.
The private key always remains inside the card in a secure, tamper free fashion. The public
key and the certificate can be exported outside. Also, smart cards are capable of performing
cryptographic functions such as encryption, decryption, message digest creation and signing
within the card.
Thus, during certificate-based authentication, the signing of random challenge sent by the
server can be performed, within the card. Since smart cards are portable, one can virtually
walk one’s private key and digital certificate. Traditionally, smart cards have problems
associated with them. The issues and their emerging solutions

Q9. Write short note on Biometric authentication.


 Biometric authentication involves human characteristics such as finger print, voice, or pattern
of lines in the iris of eye.
 Process involves creation of the user’s sample and its storage in the user database.
 The user is required to provide sample of same nature.
 If the two sample match, the user is authenticated successfully.
Biometric Techniques:
Biometric techniques are classified into two categories:
1) Physiological techniques

122 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


2) Behavioural techniques
Physiological techniques: These are based on the physical characteristics of human beings.
Several such techniques are:
a) Face
b) Voice
c) Finger print
d) Iris
e) Retina
Behavioural techniques: Behavioural technique is to observe a person to ensure that
she/he is not trying to claim to be someone else.
Two main techniques are:
a) Keystroke
b) Signature
Q10. Write a brief note on Kerberos.
Kerberos is an authentication protocol to be used in multi-user environment, to allow the
users to use network resources in a secure manner. The name Kerberos signifies a multi-
headed dog in the Greek Mythology, to keep outsiders away. There are four parties involved
in Kerberos protocol:
 Alice: It is the client workstation, which wants services
 Authentication Server (AS): It verifies all the users during login only once per session
 Ticket Granting Server (TGS): issues tickets to certify proof of identity
 Bob: the server offering services such as network printing, file sharing or an application
program etc.

Step 1: Login:

Step 2: Obtaining a service Granting Ticket (SGT):

123 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Alice sends a request for an SGT to the TGS

TGS sends response back to Alice


Step 3- User contacts bob for accessing the server

Whenever Alice needs services from Bob, she first contacts AS. AS after validating Alice’s
identity, issues her a Ticket Granting Ticket (TGT). With that TGT, Alice now contacts Ticket
Granting Server (TGS), requesting TGS to allow her to use the services of Bob. TGS after

124 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


being satisfied with the credential of Alice, issues her the Service Granting Ticket (SGT) for
Bob. Once Alice receives SGT for BOB, she now contacts Bob with SGT and request Bob, to
provide her the necessary services. Bob provides her the required services.
In this entire protocol, the advantage is each user needs to get authenticated only once per
session by AS. TGS and service providing servers do not need to authenticate each user.
Also each time, Alice needs services from different server, all she has to do is, contact TGS
with the TGT given to her by AS and ask for a separate, new Service Granting Ticket for a
server, whose services, she requires.
Kerberos Version 5:
 Developed in mid-1990.
 Specified as Internet standard RFC 1510
 Provides improvements over Kerberos v4.
o Addresses environmental shortcomings
Encryption algorithm, network protocol, byte order, ticket lifetime,
authentication forwarding
o And technical deficiencies
Double encryption, non-standard mode of use, session keys, password attacks

Q11. What is Security Handshake Pitfalls? Its types


 Security Handshake Pitfalls occurs at stage of the handshake i.e. when the communicating
parties are trying to authenticate each other.
 There are two broad level schemes for carrying out the handshake namely one –way
authentication and mutual authentication.

Q12. Explain different approaches of one-way authentication.


The idea behind one-way authentication is simple. If there are two users A and B, B
authenticates A, but A does not authenticate B. hence called one-way authentication. There
are various ways in which this type of authentication scheme can be implemented. Some of
them are as follows
Login only
In this very simple scheme
1. User A sends her user name and password in the plain text form to the other user, B.
2. B verifies the user name and password. If the user name and password are correct,
communication starts happening between A and B. No further encryption or integrity checks
are performed.

125 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Shared secret
1. A sends her user name and password.
2. B creates a random challenge R, and sends it to A.
3. A encrypts the random challenge with the shared symmetric key between A and B and sends
the encrypted R to B. B also encrypts the original random challenge with the same shared
symmetric key. If this encrypted challenge matches with the one sent by A, B considers A to
be authentic.
One way public key
Here, the idea is simple.
1. A sends her user name to B.
2. B sends the random challenge to A.
3. A encrypts the random challenge with her private key and sends it to B. B uses the public key
of A to decrypt the encrypted random challenge, and matches it with original random
challenge.
As before, this can be slightly modified to have the following flow of message:
1. A sends her user name to B.
2. B encrypted the random challenge and encrypts it with the public key of A. B sends this
encrypted random challenge to A.
3. A decrypts the encrypted random challenge with her private key and sends it to B. B matches
it with the original random challenge.

Q13. Explain different approaches of mutual authentication.


 In mutual authentication, A and B both authenticate each other. Hence it is referred to as
mutual authentication.
 This approach can also be implemented in various ways namely shared secret, public keys
and time stamp based.

Shared Secret:
This protocol assumes that A and B shares symmetric key KAB.
 A sends her user name to B. B sends a random challenge R1 to A.
 A encrypts R1 with KAB and sends it to B.
 A sends a different random challenge R2 to B.
 B encrypts R2 with KAB and sends it to A.
 Now B authenticates A and A authenticates B.

126 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Public Keys:
Mutual authentication can also be accomplished by using the public key technology.
If A and B know each other’s public key, then the mutual authentication can be completed in
three steps.
 A sends her user name and random challenge R2 encrypted with B’s public key.
 B decrypts the random challenge R2 with his private key.
 B creates a new random challenge R1 and encrypts it with A’s public key.
 B sends these two things (decrypted R2 and encrypted R1) to A.
 A verifies R2 and decrypts the random challenge R1 with her private key and sends it to B.
 B verifies R1.

Time Stamps:
Mutual authentication can also be accomplished by using the time stamps technology.
The mutual authentication is reduced to just two steps by using timestamps, instead of
random numbers as challenges.
 A sends her user name and the current timestamp encrypted with a shared symmetric key
(KAB) to B.
 B retrieves the timestamp by decrypting it using KAB and adds one to the timestamp.
 B encrypts the result with KAB and sends it to A, along with his user name. A verifies the
same.

127 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q14. Write a brief note on Key Distribution Center (KDC).
 KDC is central authority dealing with keys for individuals computers in computer networks. It
is similar to the concept of Authentication Server (AS) and Ticket Granting Server (TGS).
 The basic idea is that every node shares a unique secret key with the KDC.
Suppose user A wants to communicate securely with user B, following happens.
1. A shared secret key KA with KDC and similarly B is assumed to share a secret key KB
with KDC.
2. A sends request to KDC encrypted with KA which includes:
 Identities of A and B
 A random number R called nonce.
3. KDC responds with a message encrypted with KS containing
 One-time symmetric key KS
 Original request that was sent by A for verification
 Plus KS encrypted with KB and ID of A encrypted with KB.
4. A and B now communicate by using KS for encryption.

Key Distribution Center (KDC)

128 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271


Q15. Write a note on Single sign on approaches.
SSO:

Single Sign on (SSO) (also known as Enterprise Single Sign On or "ESSO") is the ability for a
user to enter the same id and password to logon to multiple applications within an enterprise.
SSO Benefits
 Ability to enforce uniform enterprise authentication and/or authorization policies across the
enterprise
 End to end user audit sessions to improve security reporting and auditing
 Removes application developers from having to understand and implement identity security
in their applications
 Usually results in significant password help desk cost savings
Different approaches of SSO
There are two broad –level approaches to achieving SSO as shown below diagram.

Scripting-based Approach:
 In this technique, the SSO software mimics user actions. It does this by intercepting a
program or script, which simulates the user depressing keyword keys and reacting to
individuals end-system sign-on prompts.
 It then extracts this information from its database and inserts it in the data stream simulated
to be from the user, at the appropriate places in scripts.
 In this approach batch files and scripts containing authentication information (usually
username and password) for each application are created.
 When user requests an access, scripts runs in background and performs the same
command/tasks that the user would have to perform. These scripts can contain macros to
replay user keystrokes/commands within shell.

Agent-based Approach:
In this technique, every web server running an application must have a piece of software
called as agent. There is single SSO server which interacts with the user database to validate
user credentials. Agent interacts with the SSO server to achieve SSO.
When user wants to access an application, agent sitting on the particular Web server
intercepts the user’s HTTP request and checks for presence of a cookie.
There are 2 possibilities:
1. If cookie is not found then agent sends the login page to user where user must enter the SSO
user id and password.
2. If cookie is present the agent opens it validates its contents and if they are found ok allows
further processing of user’s request.

129 | Salvi College Prof: Sonu Raj |sonuraj681@gmail.com |8080837038|8976249271

S-ar putea să vă placă și