Module 4: Hash and MAC Algorithms
Que: Authentication Requirement in Network security:-
Data is prone to various attacks. One of these attacks includes message authentication. This
threat arises when the user does not have any information about the originator of the message.
Message authentication can be achieved using cryptographic methods which further make use
of keys.
Authentication Requirements:
Revelation: It means releasing the content of the message to someone who does not
have an appropriate cryptographic key.
Analysis of Traffic: Determination of the pattern of traffic through the duration of
connection and frequency of connections between different parties.
Deception: Adding out of context messages from a fraudulent source into a
communication network. This will lead to mistrust between the parties communicating and
may also cause loss of critical data.
Modification in the Content: Changing the content of a message. This includes
inserting new information or deleting/changing the existing one.
Modification in the sequence: Changing the order of messages between parties. This
includes insertion, deletion, and reordering of messages.
Modification in the Timings: This includes replay and delay of messages sent between
different parties. This way session tracking is also disrupted.
Source Refusal: When the source denies being the originator of a message.
Destination refusal: When the receiver of the message denies the reception.
Message Authentication Functions:
All message authentication and digital signature mechanisms are based on two functionality
levels:
Lower level: At this level, there is a need for a function that produces an authenticator,
which is the value that will further help in the authentication of a message.
Higher-level: The lower level function is used here in order to help receivers verify the
authenticity of messages.
These message authentication functions are divided into three classes:
Message encryption: While sending data over the internet, there is always a risk of a
Man in the middle(MITM) attack. A possible solution for this is to use message encryption.
In message encryption, the data is first converted to a ciphertext and then sent any further.
Message encryption can be done in two ways:
Symmetric Encryption: Say we have to send the message M from a source P to
destination Q. This message M can be encrypted using a secret key K that both P and Q
share. Without this key K, no other person can get the plain text from the ciphertext. This
maintains confidentiality. Further, Q can be sure that P has sent the message. This is
because other than Q, P is the only party who possesses the key K and thus the ciphertext
can be decrypted only by Q and no one else. This maintains authenticity. At a very basic
level, symmetric encryption looks like this:
Read more about symmetric encryption here.
Public key Encryption: Public key encryption is not as advanced as symmetric
encryption as it provides confidentiality but not authentication. To provide both
authentication and confidentiality, the private key is used.
Message authentication code (MAC): A message authentication code is a security
code that the user of a computer has to type in order to access any account or portal. These
codes are recognized by the system so that it can grant access to the right user. These codes
help in maintaining information integrity. It also confirms the authenticity of the message.
Hash function: A hash function is nothing but a mathematical function that can
convert a numeric value into another numeric value that is compressed. The input to this
hash function can be of any length but the output is always of fixed length. The values that
a hash function returns are called the message digest or hash values.
Measures to deal with these attacks:
Each of the above attacks has to be dealt with differently.
Message Confidentiality: To prevent the messages from being revealed, care must be
taken during the transmission of messages. For this, the message should be encrypted
before it is sent over the network.
Message Authentication: To deal with the analysis of traffic and deception issues,
message authentication is helpful. Here, the receiver can be sure of the real sender and his
identity. To do this, these methods can be incorporated:
Parties should share secret codes that can be used at the time of identity
authentication.
Digital signatures are helpful in the authentication.
A third party can be relied upon for verifying the authenticity of parties.
Digital Signatures: Digital signatures provide help against a majority of these issues.
With the help of digital signatures, content, sequence, and timing of the messages can be
easily monitored. Moreover, it also prevents denial of message transmission by the source.
Combination of protocols with Digital Signatures: This is needed to deal with the
denial of messages received. Here, the use of digital signature is not sufficient and it
additionally needs protocols to support its monitoring.
Que: Message Authentication Code (MAC)
MAC algorithm is a symmetric key cryptographic technique to provide message authentication.
For establishing MAC process, the sender and receiver share a symmetric key K.
Essentially, a MAC is an encrypted checksum generated on the underlying message that is sent
along with a message to ensure message authentication.
The process of using MAC for authentication is depicted in the following illustration −
Let us now try to understand the entire process in detail −
The sender uses some publicly known MAC algorithm, inputs the message and the secret
key K and produces a MAC value.
Similar to hash, MAC function also compresses an arbitrary long input into a fixed length
output. The major difference between hash and MAC is that MAC uses secret key during
the compression.
The sender forwards the message along with the MAC. Here, we assume that the message
is sent in the clear, as we are concerned of providing message origin authentication, not
confidentiality. If confidentiality is required then the message needs encryption.
On receipt of the message and the MAC, the receiver feeds the received message and the
shared secret key K into the MAC algorithm and re-computes the MAC value.
The receiver now checks equality of freshly computed MAC with the MAC received
from the sender. If they match, then the receiver accepts the message and assures himself
that the message has been sent by the intended sender.
If the computed MAC does not match the MAC sent by the sender, the receiver cannot
determine whether it is the message that has been altered or it is the origin that has been
falsified. As a bottom-line, a receiver safely assumes that the message is not the genuine.
AD
Limitations of MAC
There are two major limitations of MAC, both due to its symmetric nature of operation −
Establishment of Shared Secret.
o It can provide message authentication among pre-decided legitimate users who
have shared key.
o This requires establishment of shared secret prior to use of MAC.
Inability to Provide Non-Repudiation
o Non-repudiation is the assurance that a message originator cannot deny any
previously sent messages and commitments or actions.
o MAC technique does not provide a non-repudiation service. If the sender and
receiver get involved in a dispute over message origination, MACs cannot provide
a proof that a message was indeed sent by the sender.
o Though no third party can compute the MAC, still sender could deny having sent
the message and claim that the receiver forged it, as it is impossible to determine
which of the two parties computed the MAC.
Que: Hash Functions:
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 −
Features of Hash Functions
The typical features of hash functions are −
Fixed Length Output (Hash Value)
o Hash function coverts data of arbitrary length to a fixed length. This process is
often referred to as hashing the data.
o In general, the hash is much smaller than the input data, hence hash functions are
sometimes called compression functions.
o Since a hash is a smaller representation of a larger data, it is also referred to as
a digest.
o Hash function with n bit output is referred to as an n-bit hash function. Popular
hash functions generate values between 160 and 512 bits.
Efficiency of Operation
o Generally for any hash function h with input x, computation of h(x) is a fast
operation.
o Computationally hash functions are much faster than a symmetric encryption.
AD
Properties of Hash Functions
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.
Design of Hashing Algorithms
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.
AD
Popular Hash Functions
Let us briefly see some popular hash functions −
Message Digest (MD)
MD5 was most popular and widely used hash function for quite some years.
The MD family comprises of hash functions MD2, MD4, MD5 and MD6. It was adopted
as Internet Standard RFC 1321. It is a 128-bit hash function.
MD5 digests have been widely used in the software world to provide assurance about
integrity of transferred file. For example, file servers often provide a pre-computed MD5
checksum for the files, so that a user can compare the checksum of the downloaded file to
it.
In 2004, collisions were found in MD5. An analytical attack was reported to be
successful only in an hour by using computer cluster. This collision attack resulted in
compromised MD5 and hence it is no longer recommended for use.
Secure Hash Function (SHA)
Family of SHA comprise of four SHA algorithms; SHA-0, SHA-1, SHA-2, and SHA-3. Though
from same family, there are structurally different.
The original version is SHA-0, a 160-bit hash function, was published by the National
Institute of Standards and Technology (NIST) in 1993. It had few weaknesses and did not
become very popular. Later in 1995, SHA-1 was designed to correct alleged weaknesses
of SHA-0.
SHA-1 is the most widely used of the existing SHA hash functions. It is employed in
several widely used applications and protocols including Secure Socket Layer (SSL)
security.
In 2005, a method was found for uncovering collisions for SHA-1 within practical time
frame making long-term employability of SHA-1 doubtful.
SHA-2 family has four further SHA variants, SHA-224, SHA-256, SHA-384, and SHA-
512 depending up on number of bits in their hash value. No successful attacks have yet
been reported on SHA-2 hash function.
Though SHA-2 is a strong hash function. Though significantly different, its basic design
is still follows design of SHA-1. Hence, NIST called for new competitive hash function
designs.
In October 2012, the NIST chose the Keccak algorithm as the new SHA-3 standard.
Keccak offers many benefits, such as efficient performance and good resistance for
attacks.
RIPEMD
The RIPEMD is an acronym for RACE Integrity Primitives Evaluation Message Digest. This set
of hash functions was designed by open research community and generally known as a family of
European hash functions.
The set includes RIPEMD, RIPEMD-128, and RIPEMD-160. There also exist 256, and
320-bit versions of this algorithm.
Original RIPEMD (128 bit) is based upon the design principles used in MD4 and found
to provide questionable security. RIPEMD 128-bit version came as a quick fix
replacement to overcome vulnerabilities on the original RIPEMD.
RIPEMD-160 is an improved version and the most widely used version in the family.
The 256 and 320-bit versions reduce the chance of accidental collision, but do not have
higher levels of security as compared to RIPEMD-128 and RIPEMD-160 respectively.
Whirlpool
This is a 512-bit hash function.
It is derived from the modified version of Advanced Encryption Standard (AES). One of
the designer was Vincent Rijmen, a co-creator of the AES.
Three versions of Whirlpool have been released; namely WHIRLPOOL-0,
WHIRLPOOL-T, and WHIRLPOOL.
Applications of Hash Functions
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.
Data Integrity Check
Data integrity check is a most common application of the hash functions. It is used to generate
the checksums on data files. This application provides assurance to the user about correctness of
the data.
The process is depicted in the following illustration −
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.
Que: Security of Hash Functions:
Three security properties of a hash function:
pre-image resistance
second pre-image resistance
collision-resistance
These security properties are often meaningless on their own, and they depend on how you make
use of the hash function. Nonetheless, it’s important that we understand some limitations here
before we look at some of the real-world hash functions.
First, these security properties assume that you’re reasonably using the hash function. Imagine
that I either hash the word “yes” or the word “no” and then publish the digest. If you have some
idea of what I was doing, you can hash both of the words and compare the result with what I
gave you. Because there are no secrets involved, and because the hashing algorithm we’ve used
is public, you’re free to do that. And indeed, one could think this breaks the pre-image resistance
of the hash function, but we’ll argue that your input wasn’t “random” enough. Furthermore,
because a hash function accepts an arbitrary-length input and always produces an output of the
same length, there are also an infinite number of inputs that hash to the same output.
Second, the size of the parameters matters. This isn’t a peculiarity of hash functions by any
mean, all cryptographic algorithms must care about the size of their parameters in practice. Let’s
imagine the following extreme example, we have a hash function which produces outputs of
length two bits in a uniformly random fashion (meaning that it outputs
00 25% of the time, 01 25% of the time, etc.) You don’t need to do too much work to produce a
collision: after hashing a few random input strings you should be able to find two that hash to the
same output. For this reason, there’s a minimum output size which a hash function must produce
in practice: 256 bits (or 32 bytes). With this large an output, collisions should be out of reach
unless a breakthrough happens in computing.
How was this number obtained? In real world cryptography, algorithms aim for a minimum
of 128 bits of security. It means that an attacker who wants to break an algorithm (providing
128-bit security) would have to perform around 2128 operations (for example, trying all the
possible input strings of length 128-bit would take 2128 operations). For a hash function to
provide all three security properties we mentioned earlier, it needs to provide at least 128 bits of
security against all three attacks. The easiest attack is usually to find collisions, due to
the birthday bound.
The birthday bound takes its roots from probability theory, in which the birthday problem
reveals some unintuitive results: how many people do you need in a room when there’s at least a
50% chance two people share the same birthday (this is a collision). It turns out that twenty-three
people taken at random are enough to reach these odds. In practice, when we are randomly
generating strings from a space of 2N possibilities, you can expect someone to find a collision
with 50% chance after having generated 2N/2 strings.
If our hash function generates random outputs of 256 bits, the space of all outputs is of size 2256.
This mean that collisions can be found with good probability after generating 2128 digests. This
is in the number we’re aiming for, and this is why hash functions at a minimum must provide
256-bit outputs.
Certain constraints sometimes push developers to reduce the size of a digest by truncating it
(removing some of its bytes). In theory this is possible, but can greatly reduce security. In order
to achieve 128-bit security at a minimum, a digest must not be truncated under:
256-bit for collision-resistance.
128-bit for pre-image and second pre-image resistance.
This means that depending on which property one relies on, the output of a hash function could
be truncated to obtain a shorter digest.
Que: MD5:
MD5 is a cryptographic hash function algorithm that takes the message as input of any length
and changes it into a fixed-length message of 16 bytes. MD5 algorithm stands for the message-
digest algorithm. MD5 was developed as an improvement of MD4, with advanced security
purposes. The output of MD5 (Digest size) is always 128 bits. MD5 was developed in 1991
by Ronald Rivest.
Use Of MD5 Algorithm:
It is used for file authentication.
In a web application, it is used for security purposes. e.g. Secure password of users etc.
Using this algorithm, We can store our password in 128 bits format.
MD5 Algorithm
Working of the MD5 Algorithm:
MD5 algorithm follows the following steps
1. Append Padding Bits: In the first step, we add padding bits in the original message in such
a way that the total length of the message is 64 bits less than the exact multiple of 512.
Suppose we are given a message of 1000 bits. Now we have to add padding bits to the original
message. Here we will add 472 padding bits to the original message. After adding the padding
bits the size of the original message/output of the first step will be 1472 i.e. 64 bits less than an
exact multiple of 512 (i.e. 512*3 = 1536).
Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . . .
2. Append Length Bits: In this step, we add the length bit in the output of the first step in such
a way that the total number of the bits is the perfect multiple of 512. Simply, here we add the
64-bit as a length bit in the output of the first step.
i.e. output of first step = 512 * n – 64
length bits = 64.
After adding both we will get 512 * n i.e. the exact multiple of 512.
3. Initialize MD buffer: Here, we use the 4 buffers i.e. J, K, L, and M. The size of each buffer
is 32 bits.
- J = 0x67425301
- K = 0xEDFCBA45
- L = 0x98CBADFE
- M = 0x13DCE476
4. Process Each 512-bit Block: This is the most important step of the MD5 algorithm. Here, a
total of 64 operations are performed in 4 rounds. In the 1st round, 16 operations will be
performed, 2nd round 16 operations will be performed, 3rd round 16 operations will be
performed, and in the 4th round, 16 operations will be performed. We apply a different
function on each round i.e. for the 1st round we apply the F function, for the 2nd G function,
3rd for the H function, and 4th for the I function.
We perform OR, AND, XOR, and NOT (basically these are logic gates) for calculating
functions. We use 3 buffers for each function i.e. K, L, M.
- F(K,L,M) = (K AND L) OR (NOT K AND M)
- G(K,L,M) = (K AND L) OR (L AND NOT M)
- H(K,L,M) = K XOR L XOR M
- I(K,L,M) = L XOR (K OR NOT M)
After applying the function now we perform an operation on each block. For performing
operations we need
add modulo 232
M[i] – 32 bit message.
K[i] – 32 bit constant.
<<<n – Left shift by n bits.
Now take input as initialize MD buffer i.e. J, K, L, M. Output of K will be fed in L, L will be
fed into M, and M will be fed into J. After doing this now we perform some operations to find
the output for J.
In the first step, Outputs of K, L, and M are taken and then the function F is applied to
them. We will add modulo 2 32 bits for the output of this with J.
In a second step, we add the M[i] bit message with the output of the first step.
Then add 32 bits constant i.e. K[i] to the output of the second step.
At last, we do left shift operation by n (can be any value of n) and addition modulo by
232.
After all steps, the result of J will be fed into K. Now same steps will be used for all functions
G, H, and I. After performing all 64 operations we will get our message digest.
Output:
After all, rounds have been performed, the buffer J, K, L, and M contains the MD5 output
starting with the lower bit J and ending with Higher bits M.
Application Of MD5 Algorithm:
We use message digest to verify the integrity of files/ authenticates files.
MD5 was used for data security and encryption.
It is used to Digest the message of any size and also used for Password verification.
For Game Boards and Graphics.
Advantages of MD5 Algorithm:
MD5 is faster and simple to understand.
MD5 algorithm generates a strong password in 16 bytes format. All developers like
web developers etc use the MD5 algorithm to secure the password of users.
To integrate the MD5 algorithm, relatively low memory is necessary.
It is very easy and faster to generate a digest message of the original message.
Disadvantages of MD5 Algorithm:
MD5 generates the same hash function for different inputs.
MD5 has been considered an insecure algorithm. So now we are using SHA256 instead
of MD5
MD5 is neither a symmetric nor asymmetric algorithm.
Que: Secure Hash Algorithm:
SHA stands for secure hashing algorithm. SHA is a modified version of MD5 and used for
hashing information and certificates. A hashing algorithm shortens the input information into a
smaller form that cannot be learned by utilizing bitwise operations, modular additions, and
compression functions.
SHAs also help in revealing if an original message was transformed in any way. By imputing
the original hash digest, a user can tell if even an individual letter has been shifted, as the hash
digests will be effectively different.
The important element of SHAs are that they are deterministic. This define that consider the
hash function used is known, any computer or user can regenerate the hash digest. The
determinism of SHAs is one of main reasons that each SSL certificate on the Internet is needed
to have been hashed with a SHA-2 function.
A secure hash algorithm is generally a pair of algorithms invented by the National Institutes of
Standards and Technology (NIST) and other government and private parties.
These private encryption or "file check" functions have derive to meet some of the top
cybersecurity challenges of the 21st century, as multiple public service set work with federal
government agencies to support better online security standards for organizations and the public.
There are multiple instances of these tools that were set up to support better digital security. The
first one, SHA-0, was invented in 1993. Like its successor, SHA-1, SHA-0 features 16-bit
hashing.
The next secure hash algorithm, SHA-2, includes a set of two functions with 256-bit and 512-bit
technologies, respectively. There is also a top-level secure hash algorithm known as SHA-3 or
"Keccak" that produced from a crowd sourcing contest to view who can design another new
algorithm for cyber security.
All of these secure hash algorithms are an element of new encryption standards to keep sensitive
information safe and avoid different types of attacks.
Although some of these were produced by agencies like the National Security Agency, and
some by independent developers, all of them are associated to the general functions of hash
encryption that shields information in specific database and network scenarios, providing to
evolve information security in the digital age.
Digital certificates follow the same hashing structure, wherein the certificate file is hashed, and
the hashed file is digitally signed by the CA issuing the certificate.
The essential part of any digital communication is authentication, that is, to create sure that the
entity at the other end of the channel is authentically the one that the session initiator need to
communicate with. That is why the TLS protocol provides a more stringent authentication
measure that needs asymmetric cryptography.
Que: Digital Signatures:
Digital signatures are the public-key primitives of message authentication. In the physical world,
it is common to use handwritten signatures on handwritten or typed messages. They are used to
bind signatory to the message.
Similarly, a digital signature is a technique that binds a person/entity to the digital data. This
binding can be independently verified by receiver as well as any third party.
Digital signature is a cryptographic value that is calculated from the data and a secret key known
only by the signer.
In real world, the receiver of message needs assurance that the message belongs to the sender
and he should not be able to repudiate the origination of that message. This requirement is very
crucial in business applications, since likelihood of a dispute over exchanged data is very high.
Model of Digital Signature
As mentioned earlier, the digital signature scheme is based on public key cryptography. The
model of digital signature scheme is depicted in the following illustration −
The following points explain the entire process in detail −
Each person adopting this scheme has a public-private key pair.
Generally, the key pairs used for encryption/decryption and signing/verifying are
different. The private key used for signing is referred to as the signature key and the
public key as the verification key.
Signer feeds data to the hash function and generates hash of data.
Hash value and signature key are then fed to the signature algorithm which produces the
digital signature on given hash. Signature is appended to the data and then both are sent to
the verifier.
Verifier feeds the digital signature and the verification key into the verification algorithm.
The verification algorithm gives some value as output.
Verifier also runs same hash function on received data to generate hash value.
For verification, this hash value and output of verification algorithm are compared. Based
on the comparison result, verifier decides whether the digital signature is valid.
Since digital signature is created by ‘private’ key of signer and no one else can have this
key; the signer cannot repudiate signing the data in future.
It should be noticed that instead of signing data directly by signing algorithm, usually a hash of
data is created. Since the hash of data is a unique representation of data, it is sufficient to sign the
hash in place of data. The most important reason of using hash instead of data directly for
signing is efficiency of the scheme.
Let us assume RSA is used as the signing algorithm. As discussed in public key encryption
chapter, the encryption/signing process using RSA involves modular exponentiation.
Signing large data through modular exponentiation is computationally expensive and time
consuming. The hash of the data is a relatively small digest of the data, hence signing a hash is
more efficient than signing the entire data.
AD
Importance of Digital Signature
Out of all cryptographic primitives, the digital signature using public key cryptography is
considered as very important and useful tool to achieve information security.
Apart from ability to provide non-repudiation of message, the digital signature also provides
message authentication and data integrity. Let us briefly see how this is achieved by the digital
signature −
Message authentication − When the verifier validates the digital signature using public
key of a sender, he is assured that signature has been created only by sender who possess
the corresponding secret private key and no one else.
Data Integrity − In case an attacker has access to the data and modifies it, the digital
signature verification at receiver end fails. The hash of modified data and the output
provided by the verification algorithm will not match. Hence, receiver can safely deny the
message assuming that data integrity has been breached.
Non-repudiation − Since it is assumed that only the signer has the knowledge of the
signature key, he can only create unique signature on a given data. Thus the receiver can
present data and the digital signature to a third party as evidence if any dispute arises in
the future.
By adding public-key encryption to digital signature scheme, we can create a cryptosystem that
can provide the four essential elements of security namely − Privacy, Authentication, Integrity,
and Non-repudiation.
Encryption with Digital Signature
In many digital communications, it is desirable to exchange an encrypted messages than plaintext
to achieve confidentiality. In public key encryption scheme, a public (encryption) key of sender
is available in open domain, and hence anyone can spoof his identity and send any encrypted
message to the receiver.
This makes it essential for users employing PKC for encryption to seek digital signatures along
with encrypted data to be assured of message authentication and non-repudiation.
This can archived by combining digital signatures with encryption scheme. Let us briefly discuss
how to achieve this requirement. There are two possibilities, sign-then-encrypt and encrypt-
then-sign.
However, the crypto system based on sign-then-encrypt can be exploited by receiver to spoof
identity of sender and sent that data to third party. Hence, this method is not preferred. The
process of encrypt-then-sign is more reliable and widely adopted. This is depicted in the
following illustration −
The receiver after receiving the encrypted data and signature on it, first verifies the signature
using sender’s public key. After ensuring the validity of the signature, he then retrieves the data
through decryption using his private key.
Que: Key Management:
In cryptography, it is a very tedious task to distribute the public and private keys between
sender and receiver. If the key is known to the third party (forger/eavesdropper) then the whole
security mechanism becomes worthless. So, there comes the need to secure the exchange of
keys.
There are two aspects for Key Management:
1. Distribution of public keys.
2. Use of public-key encryption to distribute secrets.
Distribution of Public Key:
The public key can be distributed in four ways:
1. Public announcement
2. Publicly available directory
3. Public-key authority
4. Public-key certificates.
These are explained as following below:
1. Public Announcement: Here the public key is broadcasted to everyone. The major
weakness of this method is a forgery. Anyone can create a key claiming to be someone else
and broadcast it. Until forgery is discovered can masquerade as claimed user.
2. Publicly Available Directory: In this type, the public key is stored in a public directory.
Directories are trusted here, with properties like Participant Registration, access and allow to
modify values at any time, contains entries like {name, public-key}. Directories can be
accessed electronically still vulnerable to forgery or tampering.
3. Public Key Authority: It is similar to the directory but, improves security by tightening
control over the distribution of keys from the directory. It requires users to know the public key
for the directory. Whenever the keys are needed, real-time access to the directory is made by
the user to obtain any desired public key securely.
4. Public Certification: This time authority provides a certificate (which binds an identity to
the public key) to allow key exchange without real-time access to the public authority each
time. The certificate is accompanied by some other info such as period of validity, rights of
use, etc. All of this content is signed by the private key of the certificate authority and it can be
verified by anyone possessing the authority’s public key.
First sender and receiver both request CA for a certificate which contains a public key and
other information and then they can exchange these certificates and can start communication.
Que: Elliptic Curve Cryptography (ECC) is an approach to public-key cryptography, based
on the algebraic structure of elliptic curves over finite fields. ECC requires a smaller key as
compared to non-ECC cryptography to provide equivalent security (a 256-bit ECC security has
equivalent security attained by 3072-bit RSA cryptography).
For a better understanding of Elliptic Curve Cryptography, it is very important to understand
the basics of the Elliptic Curve. An elliptic curve is a planar algebraic curve defined by an
equation of the form
Where ‘a’ is the co-efficient of x and ‘b’ is the constant of the equation
The curve is non-singular; that is, its graph has no cusps or self-intersections (when the
characteristic of the Co-efficient field is equal to 2 or 3).
In general, an elliptic curve looks like as shown below. Elliptic curves can intersect almost 3
points when a straight line is drawn intersecting the curve. As we can see, the elliptic curve is
symmetric about the x-axis. This property plays a key role in the algorithm.
Diffie-Hellman algorithm
The Diffie-Hellman algorithm is being used to establish a shared secret that can be used for
secret communications while exchanging data over a public network using the elliptic curve to
generate points and get the secret key using the parameters.
For the sake of simplicity and practical implementation of the algorithm, we will consider
only 4 variables, one prime P and G (a primitive root of P) and two private values a and b.
P and G are both publicly available numbers. Users (say Alice and Bob) pick private values
a and b and they generate a key and exchange it publicly. The opposite person receives the
key and that generates a secret key, after which they have the same secret key to encrypt.
Que: Kerberos:
Kerberos provides a centralized authentication server whose function is to authenticate users
to servers and servers to users. In Kerberos Authentication server and database is used for
client authentication. Kerberos runs as a third-party trusted server known as the Key
Distribution Center (KDC). Each user and service on the network is a principal.
The main components of Kerberos are:
Authentication Server (AS):
The Authentication Server performs the initial authentication and ticket for Ticket Granting
Service.
Database:
The Authentication Server verifies the access rights of users in the database.
Ticket Granting Server (TGS):
The Ticket Granting Server issues the ticket for the Server
Kerberos Overview:
Step-1:
User login and request services on the host. Thus user requests for ticket-granting service.
Step-2:
Authentication Server verifies user’s access right using database and then gives ticket-
granting-ticket and session key. Results are encrypted using the Password of the user.
Step-3:
The decryption of the message is done using the password then send the ticket to Ticket
Granting Server. The Ticket contains authenticators like user names and network
addresses.
Step-4:
Ticket Granting Server decrypts the ticket sent by User and authenticator verifies the
request then creates the ticket for requesting services from the Server.
Step-5:
The user sends the Ticket and Authenticator to the Server.
Step-6:
The server verifies the Ticket and authenticators then generate access to the service. After
this User can access the services.
Kerberos Limitations
Each network service must be modified individually for use with Kerberos
It doesn’t work well in a timeshare environment
Secured Kerberos Server
Requires an always-on Kerberos server
Stores all passwords are encrypted with a single key
Assumes workstations are secure
May result in cascading loss of trust.
Scalability