Cryptography & Network Security
Cryptography & Network Security
of Information
Technology
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
linear function of S-boxes which ensures that if 64-bit data or 56-bit key are
complemented, then the output is not complement of the output obtained with uncomplemented data or key.
Q1 c) Show that DES decryption is the inverse of DES encryption.
Ans. During encryption phase, a 64-bit plaintext is divided into two equal parts of 32-bit
and denoted as Li and Ri. After XOR operation with key of that round followed by eight Sboxes and further followed by a P-box, we obtain Li+1 and Ri+1 as output of round i.
During decryption phase, inputs are Li+1 and Ri+1, and we are required to produce Li and
Ri with the same key Ki of that round. Operation is shown below:
Since the non-linear S-boxes and bit shuffling P-boxes remain the same along with the key of
that round, we require the same mangler (also known as non-linear or F) function for
decryption which was used while encrypting the message.
Thus DES decryption is inverse of DES encryption except that same key has to used in a
round.
c.
d.
64-bit Input
32-bit Ln
64-bit output
32-bit Rn
32-bit Ln
32-bit Rn
Kn
Kn
Mangler
Function
32-bit Ln+1
32-bit Rn+1
64-bit Output
Mangler
Function
32-bit Ln+1
32-bit Rn+1
64-bit Input
While decryption mangler function (F-function) used is the same as mangle function used
during encryption. Since it is not required to compute inverse of mangler function for
decryption, this is why decryption of DES is called as the same as that of encryption. The key
used for encryption during any round is the key to be used for decryption in that round.
Raju RanjanPage 2
Dept. of Information
Technology
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
Different symmetric key is used for every session between A and B. This symmetric key is
provided by KDC on request made by a node.
Let us assume that a node A wishes to communicate with node B. Node A will make a
request to KDC with following information: (i) identification of node A, (ii) the node B with
which it wants to communicate, (iii) along with a random number for verification of the
request.
KDC replies back to node A by using the secret (symmetric) key between KDC and A. This
encrypted data contains (i) session key to be used between A and B, (ii) request made by A,
(iii) random number sent by A to KDC, (iv) session key being issued by KDC along with the
identification of node A encrypted with secret key between B and KDC. Since all the four
elements of the data sent by KDC to node A are encrypted with the master key between KDC
and A, so only node A will be in a position to decipher it, and any other node posing as node
A will not be able to decipher this communication (unless the master key between KDC and
A has been broken or stolen). Since KDC provides the session key.
Q1. f) Encrypt HARERAMA by using Playfair ciper with key CIPHER.
Ans.
With key CIPHER, Playfair table becomes
C I P H E
R A B D F
G K L MN
O Q S T U
V WX YZ
Encryption of HARERAMA takes place by finding substitution for two alphabets at a time.
HA are replaced by ID respectively. (It is forming a rectangle, so move in the row of H till
we reach the column of A, and the alphabet in the row of H and column of A is I.
Similarly move in the row of A till the column of H is reached, and replace it by the
alphabet D). Next two alphabets RE are replaced by FC respectively. (It is forming a
rectangle, so move in the row of R till we reach the column of E). Next two alphabets
RA are in the same row. These are substituted by the next alphabet on their right side
respactively. Thus R of plaintext is substituted by A, and A of plaintext is substituted
by B. Next two alphabets of plaintext MA are substituted by KD as these two
alphabets form a rectangle.
Thus HARERAMA is encrypted as IDFCABKD in Playfair by using key CIPHER.
Q2. a) Why random numbers are required? Describe Lehmers Method.
Ans.
A random number generator must be having following properties:
1. Uniform Distribution: Frequency of occurrence of numbers in the sequence of random
numbers must be same for all numbers. In other words, all numbers appearing in random
numbers sequence must be repeated equal number of times.
2. Independence: No value in the sequence should be inferred from others.
Raju RanjanPage 4
Dept. of Information
Technology
Model
Paper 1
Dept. of Information
Technology
68 = 2 * 26 + 16
26 = 1 * 16 + 10
16 = 1 * 10 + 6
10 = 1 * 6 + 4
6=1* 4 + 2
4= 2* 2 + 0
Hence, gcd(1970, 1066) = 2
gcd(26,16)
gcd(16,10)
gcd(10,6)
gcd(6,4)
gcd(4,2)
gcd(2,0)
EXTENDED EUCLID(m, b)
Algorithm
1. (A1, A2, A3) (1, 0, m); (B1, B2, B3) (0, 1, b)
2. If B3 = 0
return A3 = gcd(m ,b); no inverse
3. If B3 = 1
return B3 = gcd(m, b); B2 = b-1 mod m
4. Q = int(A3/B3)
5. (T1, T2, T3) (A1 Q B1, A2 QB2, A3 QB3)
6. (A1, A2, A3) (B1, B2, B3)
7. (B1, B2, B3) (T1, T2, T3)
8. goto step 2
Q2. C) Find the multiplicative inverse of 16 mod 83.
Ans. Steps for finding multiplicative inverse of 16 mod 83 are
Q
5
5
A1
1
0
1
A2
0
1
-5
A3
83
16
3
B1
0
1
-5
B2
1
-5
26
B3
16
3
1
A1
1
0
1
-3
4
A2
0
1
-5
16
-21
A3
79
15
4
3
1
B1
0
1
-3
4
-15
B2
1
-5
16
-21
79
B3
15
4
3
1
0
The computations were continued at line number 4 where B3 was 1, but B2 was negative.
In the next step, since B3 is zero, so multiplicative inverse of 15 mod 79 does not exist.
Raju RanjanPage 6
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
(2) Change of sequence number of TCP segment, which amounts to reordering the message.
(A message may be fitted in more than one TCP segments. Changing the order of these
segments by changing the sequence numbers of more than one segment, may give a new
meaning to the message reaching the recipient.)
(3) Delay or replay of messages is also addressed to by message authentication. For
connectionless applications, an individual message (that is datagram) can be replayed or
delayed. For connection-oriented applications, a valid sequence of messages, or a part of
such messages, which were exchanged in an earlier session could be replayed.
(4) Modification of data field of the segment, which includes addition, deletion or replacing
existing contents with some other value. However, addition of some bytes or deletion of
some bytes from TCP data field would involve modifying the TCP header as well, as the
length of TCP segment (which depends upon the number of bytes in data field of a TCP
segment) is specified in a field of TCP header.
Approaches to message authentication can be classified in two ways:
First, by the pattern of generating a value used by receiver to authenticate a message. There
are three different of generating a value for authentication. (1) Message encryption, either (a)
by symmetric key encryption used between a pair of parties, or (b) by encrypting using
private key of the sender while using public key encryption (2) Hash function, that is
mapping a message of any length to a fixed length hash value, (3) message authentication
code.
Second, the type of relationship that exists between a sender and a receiver, in the form of
direct authentication or brokered authentication.
When both the client and server participate in a trust relationship that allows them to
exchange and validate credentials including passwords, direct authentication can be
performed.
Another form trust relationship can be through a mutual trusted third party, which will
authenticate both sender and receiver.
Raju RanjanPage 8
Dept. of Information
Technology
Model
Paper 1
EK(M)
K
K
Symmetric Encryption: Confidentiality & authentication
EKUb(M)
EKRa(M)
KRa
KUa
Public-Key Encryption: Authentication and Signature
EKRa(M)
EKUb[EKRa(M)]
EKRa(M)
A Message Authentication Code (MAC), also called keyed hashes, is a piece of information,
which is used to authenticate a message by the recipient of message. A MAC algorithm accepts
as input a message of arbitrary length and a secret key between the sender and the receiver, and
produces a MAC as output. A sender generates MAC for the message and transmittes MAC
along with the message. If an attacker does not have the secret key, and is able to modify the
message, he cannot produce the matching MAC. The recipient of message generates the MAC at
his end and compares the MAC sent by sender with its own generated MAC; if any difference is
Raju RanjanPage 9
Dept. of Information
Technology
Model
Paper 1
found between these two MACs, then it is assumed that message has been altered over the
network.
MAC value protects both a message's integrity as well as its authenticity (as secret keyis between
sender and receiver only, and hence person sending the message must be the one who has the
key).
MACs do not provide any secrecy, message can still be read by anyone unless encrypted with
another key (different from secret key for MAC). For providing secrecy of message, the message
must be encrypted.
Though MAC is encrypted with the help of a secret key, it does not require decryption (as
required by DES, IDEA, BLOWFISH and many other encryption/decryption algorithms).
MAC function is a many-to-one function. The domain of the function consists of messages of
any length, whereas range consists of all possible MACs (determined by the number of bits in
MAC code) and all possible keys (depends on the number of bits in key used for MAC). See the
example given below in requirements of MAC Function.
MACs differ from digital signatures, as MAC values are both generated and verified using the
same secret key. This implies that the sender and receiver of a message must agree on keys
before initiating communications, as is the case with symmetric encryption. For the same reason,
MACs do not provide the property of non-repudiation offered by signatures: any user who can
verify a MAC is also capable of generating MACs for other messages.
Q3 c) Differentiate between following:
(A) Hash code and Message authentication code (MAC).
(B) Weak collision resistance and strong collision resistance.
Ans.
(A) Difference between a Hash code and MAC.
Parameters
MAC Function
Key
MAC code is a function of
input message and the
secret key used between a
pair of sender and receiver.
Security aspects
A MAC function must resist
existential forgery under
chosen-plaintext attacks.
This means attacker will not
be able to find any two
messages M and M which
produce the same MAC
Raju RanjanPage 10
HASH Function
No secret key is required,
and hash code only depends
on the input message.
Dept. of Information
Technology
Similarity
Signatures
to
Raju RanjanPage 11
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
Q4 a) List the various services supported by PGP. Explain how PGP supports these services.
What is the purpose of owner trust field and key legitimacy field in Public Key Ring. How the
value of these fields decided?
Ans.
PGP is a free ware electronic mail security program, designed by Philip Zimmermann. It
performs encryption and integrity protection on files.
Services supported by PGP are:
1.Authentication
2.Confidentiality
3.Compression
4.E-mail compatibility
5.Segmentation.
A brief description of how these services are provided by PGP is given in the table below:
Function
Algorithm
Description
1. Authentication (Digital 1. DSS (Digital Signature Hash code encrypted with
Signature, if required)
Standard) & SHA (Secure private key of sender is
Hash Algorithm)
included in the message.
OR
2. RSA & SHA
2. Confidentiality (Message 1. CAST-128 OR IDEA OR Message is encrypted with
Encryption)
3-key Triple DES algorithm session key generated by
for symmetric encryption
sender and session key in
2. Diffie-Hellman OR RSA encrypted form (with public
for asymmetric encryption
key of receiver) is sent to
receiver.
3. Compression
ZIP algorithm
Zipped message is used for
transmission and storage.
4. E-mail compatibility
Radix 64 conversion
Radix 64 algorithm converts
input to Radix 64 format
even for ASCII data.
5. Segmentation
When data size is more than
the limitations imposed by
internet facilities, then it
automatically
forms
segments of the entire data
and
assembles
these
segments at receiving end
without letting the user
know about it.
Raju RanjanPage 12
Dept. of Information
Technology
Model
Paper 1
A PGP message has the three major parts as shown in figure 4.4.1. These parts are (i)Session Key
Component, (ii)Signature (authentication), and (iii) Message.
{
{
Session Key{
Component {
{
{
{
{
{
{
{
{
{
{
Signature {
{
{
{
{
{
{
{
{
{
{
{
Message {
{
{
^
||
||
||
||
||
||
||
ZIP
&
EncryPtion
||
||
||
||
||
||
||
||
||
V
^
||
||
||
||
||
||
||
||
||
||
||
R
A
D
I
X
6
4
||
||
||
||
||
||
||
||
||
||
V
Two parts, namely signature and message, of the information sent by PGP are compressed and
then encrypted. Both these parts after compression and encryption are combined with first part,
namely session key component, and converted to Radix 64 format for compatibility with other email messages.
Raju RanjanPage 13
Dept. of Information
Technology
Model
Paper 1
Message part contains three sub-parts: (i) Filename, (ii)Timestamp1, which is date and time
when the data was created, and (iii) Data.
Signature part has four fields: (i) Timestamp2, that is date and time when the signatures are
affixed on the document, (ii) Hash code for the data is encrypted with private key of the sender.
Since every sender may have more than one set of public key and private keys, so a number is
given to every public/private key pair. This number has been referred to as (public) Key ID. Hash
code is encrypted with a private key of the sender, which can be decrypted at the receiving end
by the matching public key of the sender (available with receiver); public key number by which
hash code has to be decrypted is mentioned in this field. Thus, this field contains the public key
number and not the actual public key (of the sender), which is to be used for decryption by
receiver. It is assumed that the various public keys used by a sender are known in advance. (iii)
First two bytes, that is, first 16 bits of the hash code (of the data) are placed without encryption
in this field. Hash is computed by the receiver as well at its end and this hash is compared with
the hash sent by the sender. Since the hash sent by sender is in encrypted form, so it has to
decrypted first by specified public key of sender, and then compared with the has generated by
receiver. In order to be sure that right public key (of the sender) has been used for decryption,
first 16 bits of hash code are not encrypted and are available in this field. (iv) This field contains
the encrypted hash code as sent by the sender. Encryption with private key of the sender ensures
that mail was sent by the sender only (for non-repudiation feature).
Q4 b) What is the structure of the public key ring and private key ring of PGP? Why is the value
of owner trust field of a public key not enough to permit PGP to use the public key?
Ans.
As mentioned above, every user may have more than one public/private key pairs. These keys
are maintained by PGP in the form of key rings described below:
Dept. of Information
Technology
Model
Paper 1
Owner trust
Key legitimacy:
Signature trust:
Signatures:
TRUST
Raju RanjanPage 15
Dept. of Information
Technology
Model
Paper 1
PGP allows every user to keep different values of trust for different people. There are three level
of trust: None
Partial
Complete
PGP computes trust that should be placed on certificates and public key in your ring based on the
info you asserted on the people.
Owner trust field: It is the degree to which this public key is trusted to sign other public key
certificates.
Signature trust field: Trust shown by the user to certification given by others.
Key legitimacy key: Computed by PGP.
Q4 c) What is Kerberos? Discuss Kerberos version 4 in detail.
Ans.
Kerberos is an authentication service developed as part of Project Athena at MIT, U.S.A. In a
distributed environment where many servers giving same or different services are physically
placed apart and may be working under different operating systems, any user may ask for some
service. In such a situation any of following undesirable events can take place:
1. A user may impersonate another user operating from a workstation.
2. A user may manipulate the address of the workstation.
3. A user may eavesdrop and try to gain entrance to a server or disrupt operations/services.
Requirements of Kerberos:
(1) Secure: An eavesdropper must not be able to get necessary information to impersonate a
user.
(2) Reliable: In a distributed architecture, services should be available inspite of a failure of
a particular server.
(3) Transparent: Working of entire authentication system should not be known to the user
except that the user has to type in his login and necessary password(s) for the same.
(4) Scalable: A system is said to be scalable if it is possible to add more users and/or servers
to the system without disturbing the existing structure of the system.
Scheme of operation: User keys in his/her login and password for logging on to the system (see
message 1 of figure 4.1.1 below), and the same are verified by the Authentication Server (AS).
Once login and password are found to be correct, AS issues a ticket (t1) to the user (message 2 in
figure 4.1.1) so that by producing this ticket the user can contact a Ticket Granting Server (TGS)
for grant of a valid ticket for the desired server. A ticket is an encrypted message with the secret
key between AS and TGS. More details of the ticket and messages exchanged between User and
Kerberos system are given below in figure 4.1.2. It must be noted that there is only one
Authentication Server (AS) in the system for one realm.
A TGS after getting the ticket from user along with a request specifying the server for which
services are required (message 3 in figure 4.1.1), verifies its contents, and if found correct, issues
Raju RanjanPage 16
Dept. of Information
Technology
Model
Paper 1
another ticket (t2) to user so that user can contact the desired server for its services (message 4 in
figure 4.1.1). It must be noted that there can be more than one ticket granting servers (TGS)
whereas there is only one AS.
Client after getting ticket2 from a ticket granting server sends it to the desired server for its
services. This ticket is encrypted with the secret key between ticket granting server and the
desired server. Every server which is providing some service is having a different secret key with
a ticket granting server. Thus the contents of ticket2 provided by ticket granting server to a client
can be seen and properly interpreted by the desired server only.
The ticket2 contains the ID and network address of the client. This ensures that the services are
available to the right client only.
(1) Request
User
(2) Ticket 1
(3) Request
(4) Ticket 2 + Session Keys
Authentication
Server (AS)
Ticket Granting
Server (TGS)
Server 1
Secret Keys
Server i
Server n
Raju RanjanPage 17
Databas
e
Dept. of Information
Technology
Model
Paper 1
Q5 a) What is SSL and SET? What is the difference between SSL connection and SSL session?
Discuss SSL protocol architecture. How does SET work? Describe dual signature for SET and its
purpose.
Ans.
SSL Connection:
These are peer-to-peer relationships that provide a suitable service.
SSL connections are transient.
Every connection is associated with one session.
SSL Session:
It defines a set of cryptographic security parameters, which may be shared among multiple
connections. These are created by SSL Handshake protocol.
SSL Architecture
Client Hello
Raju RanjanPage 18
Phase I
1. Protocol Version,
2. Security capabilities
3. Session ID
4. Compression method
5. Random numbers
6. Cipher
Dept. of Information
Technology
Parameter
Negotiation
Xa = g^a mod p
A
Ya = g^b mod p
Raju RanjanPage 19
DiffieHellman
Exchanges
Model
Paper 1
Dept. of Information
Technology
Model
Paper 1
Proof of IDA
Messages of Aggressive Mode
Q5 b) Justify whether following statement are true or false in context of DES cipher.
a. Is it possible that a plaintext P encrypted with key K1 can be decrypted with a
different key K2, (K2 K1)
b. If key K1 is complement of key K2 then ciphertext produced with K1 will be
complement of ciphertext produced with K2.
Ans.
a. If a plaintext is encrypted with key K1, then it can be decrypted with key K1 only.
Encryption is a mapping of given 64-bit plaintext to another 64-bit value by a key K1. If
this ciphertext is decrypted with same key K1, then the same plaintext is obtained.
However, decrypting ciphertext C, which was obtained by encrypting a plaintext with key
K1, with another key K2, will map to another value of plaintext, which will not be a
meaningful message.
b. If a plaintext P, encrypted with key K1 produces a ciphertext C1, then encrypting same
plaintext with K2 will not yield a ciphertext which is a complement of C1. This is so
because after performing XOR with key, the intermediate result is fed to S-boxes, which
are non-linear in nature. In other words, if inputs to S-Boxes are complemented, then the
output of any of eight S-boxes is not complement of the original output. It is the nonlinear function of S-boxes which ensures that if 64-bit data or 56-bit key are
complemented, then the output is not complement of the output obtained with uncomplemented data or key.
Raju RanjanPage 20
Dept. of Information
Technology
Model
Paper 1
Raju RanjanPage 21
Dept. of Information
Technology
Raju RanjanPage 22
Model
Paper 1