Unit 4
Unit 4
Unit 4
MAC(Message Authentication Code) was used to provide Message Integrity and Message
Authentication but it needs symmetric key established between sender and receiver. A
digital signature on other hand uses pair of asymmetric keys.
A valid digital signature helps the receiver to know the message comes from the authentic
sender and is not altered in between.
What is a Signature?
We sign a document to show that is approved by us or created by us. The signature is proof
to the recipient that this document is coming from the correct source. The signature on the
document simply means the document is authentic.
When A sends a message to B, B needs to check the authenticity of the message and
confirm it comes from A and not C. So B can ask A to sign the message electronically. The
electronic signature proves the identity of A is also called a digital signature.
• Digital Signature needs a public key system. The sender uses a private key to
sign a document and the verifier uses the public key to verify the document.
Message Integrity
It is preserved by using the hash function in signing and verifying algorithms.
Message Authentication
The message is verified using the public key of the sender. When A sends a message to B .
B uses the public key of A for verification and A public key cannot create the same
signature as C’s private key.
Message Nonrepudiation
To provide a message non-repudiation trusted third party is needed.
• A creates a signature from the message and sends a message to B and a signature
to the trusted center.
• The center validates A public key and verifies messages that come from A.
• The center saves a copy of the message with sender identity, receiver identity,
and timestamp.
• The center uses a private key to create a new signature.
• The center sends a message, a new signature, A’s identity, B’s identity to B.
• B verifies the message using the public key of the trusted center.
In the future, if A denies that no message is sent from its site, the center can show a copy
of the saved message.
❖ HASH FUNCTION
Hash functions are extremely useful and appear in almost all information security applications.
A hash function is a mathematical function that converts a numerical input value into another
compressed numerical value. The input to the hash function is of arbitrary length but output is
always of fixed length.
Values returned by a hash function are called message digest or simply hash values. The
following picture illustrated hash function −
In order to be an effective cryptographic tool, the hash function is desired to possess following
properties −
• Pre-Image Resistance
o This property means that it should be computationally hard to
reverse a hash function.
o In other words, if a hash function h produced a hash value z, then
it should be a difficult process to find any input value x that
hashes to z.
o This property protects against an attacker who only has a hash
value and is trying to find the input.
• Second Pre-Image Resistance
o This property means given an input and its hash, it should be hard
to find a different input with the same hash.
o In other words, if a hash function h for an input x produces hash
value h(x), then it should be difficult to find any other input value
y such that h(y) = h(x).
o This property of hash function protects against an attacker who
has an input value and its hash, and wants to substitute different
value as legitimate value in place of original input value.
• Collision Resistance
o This property means it should be hard to find two different inputs
of any length that result in the same hash. This property is also
referred to as collision free hash function.
o In other words, for a hash function h, it is hard to find any two
different inputs x and y such that h(x) = h(y).
o Since, hash function is compressing function with fixed hash
length, it is impossible for a hash function not to have collisions.
This property of collision free only confirms that these collisions
should be hard to find.
o This property makes it very difficult for an attacker to find two
input values with the same hash.
o Also, if a hash function is collision-resistant then it is second
pre-image resistant.
At the heart of a hashing is a mathematical function that operates on two fixed-size blocks of
data to create a hash code. This hash function forms the part of the hashing algorithm.
The size of each data block varies depending on the algorithm. Typically the block sizes are
from 128 bits to 512 bits. The following illustration demonstrates hash function −
Hashing algorithm involves rounds of above hash function like a block cipher. Each round
takes an input of a fixed size, typically a combination of the most recent message block and the
output of the last round.
This process is repeated for as many rounds as are required to hash the entire message.
Schematic of hashing algorithm is depicted in the following illustration −
Since, the hash value of first message block becomes an input to the second hash operation,
output of which alters the result of the third operation, and so on. This effect, known as
an avalanche effect of hashing.
Avalanche effect results in substantially different hash values for two messages that differ by
even a single bit of data.
Understand the difference between hash function and algorithm correctly. The hash function
generates a hash code by operating on two blocks of fixed-length binary data.
Hashing algorithm is a process for using the hash function, specifying how the message will
be broken up and how the results from previous message blocks are chained together.
There are two direct applications of hash function based on its cryptographic properties.
✓ Password Storage
Hash functions provide protection to password storage.
• Instead of storing password in clear, mostly all logon processes store the hash
values of passwords in the file.
• The Password file consists of a table of pairs which are in the form (user id,
h(P)).
• The process of logon is depicted in the following illustration −
• An intruder can only see the hashes of passwords, even if he accessed the
password. He can neither logon using hash nor can he derive the password from
hash value since hash function possesses the property of pre-image resistance.
The integrity check helps the user to detect any changes made to original file. It however, does
not provide any assurance about originality. The attacker, instead of modifying file data, can
change the entire file and compute all together new hash and send to the receiver. This integrity
check application is useful only if the user is sure about the originality of file.
❖ PUBLIC KEYS DISTRIBUTION
Several techniques have been proposed for the distribution of public keys. Virtually
all these proposals can be grouped into the following general schemes:
• Public announcement
• Publicly available directory
• Public-key authority
• Public-key certificates
➢ Public Announcement of Public Keys
On the face of it, the point of public
key encryption is that the public key is public. Thus, if there is some broadly accepted public
key algorithm, such as RSA, any participant can send his or her public key to any other particip
ant or broadcast the key to the community at large (Figure 14.9).
Although this approach is convenient, it has a major weakness. Anyone can forge such a public
announcement. That is, some user could pretend to be user A and send a public key to another
participant or broadcast such a public key. Until
such time as user A discovers the forgery and alerts other participants, the forger is
able to read all encrypted messages intended for A and can use the forged keys
for authentication.
➢ Publicly Available Directory
A greater degree of security can be achieved by maintaining a publicly available
dynamic directory of public keys. Maintenance and distribution of the public direc- tory would
have to be the responsibility of some trusted
entity or organization (Figure 14.10). Such a scheme would include the following elements:
➢ Public-Key Authority
Stronger security for public-key distribution can be achieved by providing tighter
control over the distribution of public keys from the directory. A typical scenario is
illustrated in Figure 14.11. As before, the scenario assumes that a central authority maintains a
dynamic directory of public
keys of all participants. In addition, each participant reliably knows a public key for the
authority, with only the authority knowing the corresponding
private key. The following steps (matched by number to Figure 14.11) occur.
1. A sends a timestamped message to the public-key authority containing a
request for the current public key of B.
2. The authority responds with a message that is encrypted using the authority’s private ke
y, PRauth.Thus,A is able to decrypt the message using the authority’s public key.Therefor
e,A is assured that the message originated with the authority.The message
includes the following:
The original request used to enable A to match this response with the
corresponding earlier request and to verify that the original request was not altered
before reception by the authority
➢ Public-Key Certificates
The scenario of Figure 14.11 is attractive, yet it has some drawbacks. The public-key
authority could be somewhat of a bottleneck in the system, for a user must appeal to the
authority for a public key for every other user that it wishes to contact. As before, the directory
of names and public keys maintained by the authority is vul- nerable to tampering.
An alternative approach, first suggested by Kohnfelder [KOHN78], is
to use certificates that can be used by participants to exchange keys without contacting a publ
ic-key authority, in a way that is as reliable as if the keys were obtained directly from a
public-key authority. In essence, a certificate consists of a public key, an identifier of the key
owner, and the whole block signed by a trusted third party. Typically, the third
party is a certificate authority, such as a government agency or a financial institution, that is
trusted by the user community. A user can present his or her public key to the authority in a
secure manner and obtain a certificate. The user can then publish the certificate. Anyone
needing this user’s public key can obtain the certificate and verify that it is valid by way of the
attached trusted signature. A participant can also convey its key information to another
by transmitting its certificate. Other participants can verify that the certificate was created by
the authority.
❖ Transport Layer Security (TLS) Handshake
TLS is a data privacy and security protocol implemented for secure communication
over internet. It usually encrypts communication between server and clients.
A Transport Layer Security (TLS) connection is established via handshake.
❖ IP security (IPSec)
The IP security (IPSec) is an Internet Engineering Task Force (IETF) standard suite of
protocols between 2 communication points across the IP network that provide data
authentication, integrity, and confidentiality. It also defines the encrypted, decrypted and
authenticated packets. The protocols needed for secure key exchange and key management
are defined in it.
➢ Uses of IP Security –
➢ Components of IP Security –
Internet Key Exchange is a special protocol that helps to enable two systems or
devices to establish a secure and strong communication channel over a nonreliable
network also. This protocol achieves this using a series of key exchanges to create
a secure and strong tunnel between a client and a server with the help of which
they can send encrypted traffic easily and securely. The security of the tunnel is
based on the Diffie-Hellman key exchange method, which is one of the widely
used techniques used for security.
Working of IP Security –
1. The host checks if the packet should be transmitted using IPsec or not. These
packet traffic triggers the security policy for themselves. This is done when the
system sending the packet apply an appropriate encryption. The incoming packets
are also checked by the host that they are encrypted properly or not.
2. Then the IKE Phase 1 starts in which the 2 hosts(using IPsec) authenticate
themselves to each other to start a secure channel. It has 2 modes. The Main
mode which provides the greater security and the Aggressive mode which
enables the host to establish an IPsec circuit more quickly.
3. The channel created in the last step is then used to securely negotiate the way the
IP circuit will encrypt data across the IP circuit.
4. Now, the IKE Phase 2 is conducted over the secure channel in which the two
hosts negotiate the type of cryptographic algorithms to use on the session and
agreeing on secret keying material to be used with those algorithms.
5. Then the data is exchanged across the newly created IPsec encrypted tunnel. These
packets are encrypted and decrypted by the hosts using IPsec SAs.
6. When the communication between the hosts is completed or the session times out
then the IPsec tunnel is terminated by discarding the keys by both the hosts.