CNS (R16) B.Tech (CSE) IV Year I Sem
CNS (R16) B.Tech (CSE) IV Year I Sem
CNS (R16) B.Tech (CSE) IV Year I Sem
UNIT-IV
1. Message Integrity:
The cryptography systems that we have studied so far provide secrecy, or confidentiality, but not
integrity.
However, there are occasions where we may not even need secrecy but instead must have
integrity(Data will not changed).
Difference:
The two pairs (document / fingerprint) and (message / message digest) are similar, with some
differences.
The document and fingerprint are physically linked together. The messa ge and message
digest can be unlinked separately, and, most importantly, the message digest needs to be
100
CNS(R16) B.Tech(CSE) IV Year I Sem
Checking Integrity:
Second Preimage Resistance: In this criterion, an adversary is provided with the value of
101
CNS(R16) B.Tech(CSE) IV Year I Sem
Collision Resistance: Collision of a hash function is the event when two values x and
x1, such that x1 ≠ x hash to the same value, i.e., h(x) = h(x1).
102
CNS(R16) B.Tech(CSE) IV Year I Sem
2. Message Authentication:
A message digest guarantees the integrity of a message. It guarantees that the
message has not been changed.
A message digest does not authenticate the sender of the message.
When Alice sends a message to Bob, Bob needs to know if the messageis
coming from Alice.
To provide message authentication, Alice needs to provide proof that it is Alice
sending the message and not a fraud.
The digest created by a cryptographic hash function is normally called a
Modification Detection Code (MDC). This code can detect any
modifications in the message.
What we need for message authentication is a Message Authentication Code
(MAC).
103
CNS(R16) B.Tech(CSE) IV Year I Sem
MAC Security
How can Eve forge a message without having the key?
1. If size of the key allows exhaustive search, Eve may try all possible
keys to digest the message.
2. Use preimageattack.
3. Given some pairs of messages and their MACs, Eve can
manipulate them to come up with a new message and its digest
Note: The security of a MAC depends on the security of the underlying hash
algorithm.
Nested MAC:
To improve MAC security, nested MACs were designed in which hashing is performed
twice.
In 1st step, the key is concatenated with the message and is hashed tocreate
an intermediate digest.
In 2nd step, the key is concatenated with the intermediate digest to create the final digest.
104
CNS(R16) B.Tech(CSE) IV Year I Sem
An input signature is padded to the left of the message and the whole is given asinput
to a hash function which gives us a intermediate HMAC.
Intermediate HMAC again is appended to an output signature and the whole is applieda
hash function again, the result is our final HMAC of n bits
105
CNS(R16) B.Tech(CSE) IV Year I Sem
SHA-512
106
CNS(R16) B.Tech(CSE) IV Year I Sem
Whirlpool
Merkle-Damgard Scheme
107
CNS(R16) B.Tech(CSE) IV Year I Sem
Message is divided into t-blocks of n-bit size. If necessary some bits are padded
The blocks are M1,M2,…Mt and the digest created at each compression function are
H1,H2,…Ht
Before starting the iteration, the digest H0 is set to fixed Value called IV(initial valueor
initial vector)
The compression function operates on Hi-1 and Mi to create a new Hi. Hi=f(Hi-1,Mi) where f is acompression
function
SHA – 512
108
CNS(R16) B.Tech(CSE) IV Year I Sem
109
CNS(R16) B.Tech(CSE) IV Year I Sem
STEPS:
The message is padded with 1000000…. To make the message multiples of 1024.
2. Append length of the message:
A block of 128 bits is appended to the message. Contains the length of the original message.
Before addition of the length of message , we need to pad as specified in the first step.
The size of padding bits is
calculatedas: (|M|+|P|+128)=0
mod 1024
|P|=-|M|-128 mod 1024
Example: What is the number of padding bits if the length of the original message is 2590
Solution: |P|=-2590-128 mod 1024
=-2718 mod 1024 = -670 mod 1024
=(1024-670) mod 1024 = 354
The padding consists of one 1 followed by 353 0’s
Length Field and Padding:
Before the message digest can be created, SHA-512 requires the addition of a 128-bit length field (0-
(2128 -1)to the message that defines the length of the message in bits.
110
CNS(R16) B.Tech(CSE) IV Year I Sem
Compression Function
The heart of the algorithm is a module that consists of 80 rounds; this module is labeled as F in Block
Diagram.
Each round t takes as input the 512-bit buffer value, abcdefgh, and updates the contents of the
buffer.Each round t makes use of a 64-bit value Wt, derived from the current 1024-bit block
being processed (Mi).
Each round t also makes use of an additive constant Kt (64-bit)
The output of the 80th round is added to the input to the first round (Hi-1) to produce Hi.
111
CNS(R16) B.Tech(CSE) IV Year I Sem
Constants
…..
112
CNS(R16) B.Tech(CSE) IV Year I Sem
113
CNS(R16) B.Tech(CSE) IV Year I Sem
DIGITAL SIGNATURE
Inclusion
A conventional signature is included in the document; it is part of the document.
But when we sign a document digitally, we send the signature as a separate document.
Verification Method
For a conventional signature, when the recipient receives a document, he compares the signature on the
document with the signature on file.
For a digital signature, the recipient receives the message and the signature. The recipient needs to apply
averification technique to the combination of the message and the signature to verify the authenticity.
Relationship
For a conventional signature, there is normally a one-to-many relationship between a signature
anddocuments. For a digital signature, there is a one-to-one relationship between a signature
and a message.
114
CNS(R16) B.Tech(CSE) IV Year I Sem
Duplicity
In conventional signature, a copy of the signed document can be distinguished from the original one on
file. In digital signature, there is no such distinction unless there is a factor of time on the document.
Figure shows the digital signature process. The sender uses a signing algorithm to sign the message.
The message and the signature are sent to the receiver. The receiver receives the message and the
signature and applies the verifying algorithm to the combination. If the result is true, the message is
accepted; otherwise, it is rejected.
The drawback of Asymmetric key cryptosystems that is “inefficient for long messages” .t In a digital
signature system can be overcome by “signing the digest of the message”.
SERVICES
Message Authentication
• A secure digital signature scheme, like a secure conventional signature can
provide message authentication
• Example, Bob can verify that the message is sent by Alice because Alice’s public key is used in
verification.
Message Integrity
The integrity of the message is preserved even if we sign the whole message because we cannot get
thesame signature if the message is changed.
Nonrepudiation
Nonrepudiation can be provided using a trusted party.
Confidentiality
116
CNS(R16) B.Tech(CSE) IV Year I Sem
Attack Types
1. Key-Only Attack
In key-only attack, the public key of A is available to every one and C makes use of this fact and try to
recreate the signature of A and digitally sign the documents that A does not intend to do.
2. Known-Message Attack
In the known message attack, C has few previous messages and signatures of A. Now C tries to
forge the signature of A on to the documents that A does not intend to sign by using the brute force
method by analyzing the previous data to recreate the signature of A
3.Chosen-Message Attack
In this method C has the knowledge about A’s public key and obtains A’s signature on the messages and
replaces the original message with the message C wants A to sign with having A’s signature on them
unchanged.
Forgery Types
1. Existential Forgery
Adversary can create a pair (message, signature), such that the signature of the message is valid.
Adversary has no control on the messages whose signature is forged
2. Selective Forgery
Adversary is able to create valid signatures on a message
chosen by someone else, with a significant probability.
117
CNS(R16) B.Tech(CSE) IV Year I Sem
Several digital signature schemes have evolved during the last few decades. Some of them have been
implemented.
The sender uses his own private key tosign the documemnet, the receivr uses the senders public key to
verify it
118
CNS(R16) B.Tech(CSE) IV Year I Sem
Signing: Alice create a signature out of the message using her private exponent,
S=Md mod n and sends the signature to Bob
Verifying: Bob receives M and S. Bob applies A lice public exponent to the signature to create a copy
ofthe message M1 = Se mod n. Bob compares M and M1 . If both are congruent, accepts the message.
M1 M (mod n) Se M (mod n) Mdxe M (mod n)
As a trivial example, suppose that Alice chooses p = 823 and q = 953, and calculates n = 784319.
The value of f(n) is 782544. Now she chooses e = 313 and calculates d = 160009. At this point key
generation is complete. Now imagine that Alice wants to send a message with the value of M =
19070 toBob. She uses her private exponent, 160009, to sign the message:
Alice sends the message and the signature to Bob. Bob receives the message and the signature. He
calculates
119
CNS(R16) B.Tech(CSE) IV Year I Sem
121
CNS(R16) B.Tech(CSE) IV Year I Sem
123
CNS(R16) B.Tech(CSE) IV Year I Sem
DSS Overview
124
CNS(R16) B.Tech(CSE) IV Year I Sem
KEY MANAGEMENT
SYMMETRIC-KEY DISTRIBUTION
• Symmetric-key cryptography is more efficient than asymmetric-key
cryptography for enciphering large messages.
• Symmetric-key cryptography, however, needs a shared secret key between two parties.
• Example: If Alice needs to exchange confidential messages with N people, she need N
different keys and if N people need to exchange with each other, they need N(N-1) keys. If
1 million people need to communicate with each other , they need more than trillions of
keys.
• This proble normally referred as N2 problem, because the number of required
keys for N entitesis N2
• We also has a problem of the distribution of keys through the internet which is unsecure.
A practical solution for the above problem is the use of a trusted thord party, referred as Key-Distribution
Center( KDC )
1. Alice sends a request to the KDC stating that she needs a session secrete key between herand
Bob
2. KDC inform Bob about Alice request
If Bob agrees, a session key is created between the two.
125
CNS(R16) B.Tech(CSE) IV Year I Sem
When the number of people using a KDC increases, the system becomes
unmanageable.To solve the problem, we use multiple KDCs. We devide the world
into domains
In this, KDCs are arranged in hierarchical model, the international KDC are at root, then national next
and local KDCs at lower level.
Session Keys
A KDC creates a secret key for each member. This secret key can be used only between the member
andthe KDC, not between two members.
A session symmetric key between two parties is used only once.
126
CNS(R16) B.Tech(CSE) IV Year I Sem
127
CNS(R16) B.Tech(CSE) IV Year I Sem
Needham-Schroeder Protocol
KERBEROS
Kerberos is an authentication protocol, and at the same time a KDC, that has become very
popular. Several systems, including Windows 2000, use Kerberos.
Originally designed at MIT, it has gone through several versions.
KERBEROS Servers
128
CNS(R16) B.Tech(CSE) IV Year I Sem
129
CNS(R16) B.Tech(CSE) IV Year I Sem
SYMMETRIC-KEY AGREEMENT
Alice and Bob can create a session key between themselves without using a
KDC. This method of session-key creation is referred to as the symmetric-key
agreement. Example: Diffie-Hellman Key Agreement
Steps:
1. Alice chooses a large random integer number x and calculates R1=gx mod p
2. Bob chooses another large number y and calculates R2=gy mod p
3. Alice sends R1 to Bob and Bob sends R2 to Alice
4. Alice calculates key K=(R2)x mod p
5. Bob calculates key K=(R1)y
mod p Where K is the symmetric key
for the session
The symmetric key in the Diffie-Hellman method is K=gxy mod p
Let us give a trivial example to make the procedure clear. Our example uses small numbers, but note
thatin a real situation, the numbers are very large. Assume that g = 7 and p = 23. The steps are as
follows:
130
CNS(R16) B.Tech(CSE) IV Year I Sem
PUBLIC-KEY DISTRIBUTION
In asymmetric-key cryptography, people do not need to know a symmetric shared key; everyone shields
aprivate key and advertises a public key.
In public key key cryptography, everyone have access to every one’s public key: public keys are
available to the public.
So, public keys need to be distributed.
1. Public Announcement
2. Trusted Center
3. Controlled Trusted Center
4. Certification Authority
5. X.509
6. Public-Key Infrastructures (PKI)
Public Announcement
The normal method is to announce public keys publicly, but is not secure
131
CNS(R16) B.Tech(CSE) IV Year I Sem
132
CNS(R16) B.Tech(CSE) IV Year I Sem
133