0% found this document useful (0 votes)
12 views

Is-Unit 2- Cryptography- Euclidean Algorithm - Extended Euclidean Algorithm

The document explains the Euclidean Algorithm and its extended version for finding the greatest common divisor (GCD) of two integers, along with examples. It also discusses the differences between Block Ciphers and Stream Ciphers, detailing their features, modes of operation, and security implications. Additionally, the document introduces the RSA encryption algorithm, a public-key encryption method, outlining the steps for generating public and private keys.

Uploaded by

godvenom2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Is-Unit 2- Cryptography- Euclidean Algorithm - Extended Euclidean Algorithm

The document explains the Euclidean Algorithm and its extended version for finding the greatest common divisor (GCD) of two integers, along with examples. It also discusses the differences between Block Ciphers and Stream Ciphers, detailing their features, modes of operation, and security implications. Additionally, the document introduces the RSA encryption algorithm, a public-key encryption method, outlining the steps for generating public and private keys.

Uploaded by

godvenom2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Module -2

Cryptography: Euclidean Algorithm & Extended Euclidean Algorithm


Euclidean algorithms (Basic and Extended)
The Euclidean algorithm is a way to find the greatest common divisor of two positive integers.
GCD of two numbers is the largest number that divides both of them. A simple way to find GCD
is to factorize both numbers and multiply common prime factors.​

Basic Euclidean Algorithm for GCD:


The algorithm is based on the below facts.
If we subtract a smaller number from a larger one (we reduce a larger number), GCD doesn’t
change. So if we keep subtracting repeatedly the larger of two, we end up with GCD.
Now instead of subtraction, if we divide the larger number, the algorithm stops when we find the
remainder 0.
Extended Euclidean Algorithm: Extended Euclidean algorithm also finds integer coefficients x
and y such that: ax + by = gcd(a, b)

Examples:
Input: a = 30, b = 20​
Output: gcd = 10, x = 1, y = -1​
(Note that 30*1 + 20*(-1) = 10)

Input: a = 35, b = 15​


Output: gcd = 5, x = 1, y = -2​
(Note that 35*1 + 15*(-2) = 5)

The extended Euclidean algorithm updates the results of gcd(a, b) using the results calculated by
the recursive call gcd(b%a, a). Let values of x and y calculated by the recursive call be x1 and
y1. x and y are updated using the below expressions.
ax + by = gcd(a, b)​
gcd(a, b) = gcd(b%a, a)​
gcd(b%a, a) = (b%a)x1 + ay1​
ax + by = (b%a)x1 + ay1​
ax + by = (b – [b/a] * a)x1 + ay1​
ax + by = a(y1 – [b/a] * x1) + bx1

Comparing LHS and RHS,​


x = y1 –
⌊b/a⌋

1
⌊b/a⌋* x1​
y = x1

Block Cipher and Stream Cipher:


Block Cipher and Stream Cipher are the types of symmetric key cipher. These two block
ciphers are used to transform plain text into ciphertext. The difference between a Block cipher
and a Stream cipher is that the former transforms the plain text into cipher text by taking the
plain text block by block. On the other hand, a block cipher produces cipher text from plain text
by taking one byte of plain text at a time. In this article, we will see the difference between Block
Cipher and Stream Cipher in detail.

What is Block Cipher?


A block cipher encrypts data in fixed-size blocks usually 64 or 128 bits at a time. The encryption
algorithm processes each block of data separately using the cryptographic key to transform the
plaintext into the ciphertext. Block ciphers function on complex mathematical computation and
permutation to ensure that the data encrypted is safe. The choice of block size does not directly
affect the strength of the encryption scheme.
The strength of the cipher depends upon the key length. However, any size of the block is
acceptable. The following aspects can be kept in mind while selecting the size of a block: Avoid
very small block sizes, Do not have very large block sizes, and Multiples of 8-bit.

Block Cipher
Key Features of Block Ciphers
●​ Fixed Block Size: The Data is encrypted in a fixed-size block.
●​ Complex Operations: In block ciphers, substitution combined with permutation
forms the operation to achieve encryption.
●​ Modes of Operation: Block ciphers employ several modes such as ECB (Electronic
Codebook) and CBC (Cipher Block Chaining) for enhanced security.
Examples: AES (Advanced Encryption Standard), DES (Data Encryption Standard) and
Blowfish.

What is Stream Cipher?


A stream cipher encrypts data one bit or one byte at a time rather than in fixed-size blocks. It
generates a keystream that is combined with the plaintext to the produce ciphertext. Stream

2
ciphers are made for the scenarios where data needs to be encrypted in the continuous stream
making them suitable for the real-time applications.
It can be categorized into the synchronous, self-synchronizing and one-time pad types. The
Synchronous encryption requires independently generated keystream from both the plaintext and
the ciphertext. They have to be in the same state, with the same key, in order to decode the data
properly.

Key Features of Stream Ciphers


●​ Continuous Encryption: The data is encrypted in a stream that runs continuously, a
bit or byte at a time
●​ Keystream Generation: To create encryption keys, the Stream ciphers use a
pseudorandom keystream generator.
●​ Efficiency: Stream ciphers are generally more efficient for encrypting data of
variable length and in the streaming applications.
Examples: RC4, Salsa20, and ChaCha20.

3
Difference Between Block Cipher and Stream Cipher
Block Cipher Stream Cipher

Block Cipher Converts the plain text into Stream Cipher Converts the plain text
cipher text by taking plain text’s block at a into cipher text by taking 1 bit plain
time. text at a time.

Block cipher uses either 64 bits or more


While stream cipher uses 8 bits.
than 64 bits.

The complexity of block cipher is simple. While stream cipher is more complex.

Block cipher uses confusion as well as While stream cipher uses only
diffusion. confusion.

In block cipher, reverse encrypted text is While in-stream cipher, reverse


hard. encrypted text is easy.

The algorithm modes which are used


The algorithm modes which are used in
in stream cipher are CFB (Cipher
block cipher are ECB (Electronic Code
Feedback) and OFB (Output
Book) and CBC (Cipher Block Chaining).
Feedback).

While stream cipher works on


Block cipher works on transposition
substitution techniques like Caesar
techniques like rail-fence technique,
cipher, polygram substitution cipher,
columnar transposition technique, etc.
etc.

Block cipher is slow as compared to a While stream cipher is fast in


stream cipher. comparison to block cipher.

4
Suitable for applications that require Suitable for applications that require
strong encryption, such as file storage and strong encryption, such as file storage
internet communications. and internet communications.

More secure than stream ciphers when the Less secure than block ciphers when
same key is used multiple times. the same key is used multiple times.

key length is typically 128 or 256


key length is typically 128 or 256 bits.
bits.

Operates on fixed-length blocks of data. Encrypts data one bit at a time.

confusion and diffusion:

In cryptography, confusion and diffusion are two properties of the operation of a secure cipher.
Both Confusion and Diffusion are used to stop the deduction of the secret writing key, these
properties, when present, work to thwart the application of statistics and other methods of
cryptanalysis.
Confusion is employed for making uninformed cipher text whereas diffusion is employed for
increasing the redundancy of the plain text over the foremost part of the cipher text to make it
obscure. The block cipher solely depends on diffusion, where else, confusion is employed by
both stream and block cipher.
What is Confusion?
In general, the idea of confusion is to obscure the relationship between the key and the plaintext
on one hand, and the ciphertext on the other. This is usually done by intricate methods of
substitution, by replacing one piece of data with another in a disorderly disordered way. The use
of confusion makes it possible to design the key in a way that even if the attacker has part of the
key, it will not be possible to deduce the other part of the key.
Example: The introduction of confusion is done through a substitution cipher whereby each
letter of the plaintext is replaced by a different letter in accordance with a relatively complicated
set of rules.
Confusion = Substitution
a --> b
Example : Caesar Cipher

What is Diffusion?
While in diffusion, it is a cryptographic technique that would ensure that the effect of one or one
plaintext digit would be evenly spread out to a number of ciphertext digits, thereby minimizing

5
on the redundancy on the plaintext. The aim here is to spread the statistical structure of the
plaintext over the entire ciphertext so as to mask patterns of data. It is usually done by use of
permutation as well as; transposition.
Example:In a block cipher, diffusion is responsible for the occurrence in which change in one bit
of the plaintext has an influence on many bits of the ciphertext so as to make it difficult for
attackers to identify any patterns.

Diffusion = Transposition or Permutation


abcd --> dacb
Example : DES

Difference Between Confusion and Diffusion

Confusion Diffusion

Confusion is a cryptographic technique Diffusion is used to create cryptic plain


that is used to create faint cipher texts. texts.

Confusion is possible through Diffusion is possible through


substitution algorithms. transposition algorithms.

In diffusion, if one image within the


In confusion, if one bit within the secret
plain text is modified, many or all image
is modified, most or all bits within the
within the cipher text also will be
cipher text also will be modified.
modified

In confusion, vagueness is increased in In diffusion, redundancy is increased in


resultant. the resultant.

Both stream cipher and block cipher


Only block cipher use diffusion.
use confusion.

The relation between the cipher text The relation between the cipher text and
and the key is masked by confusion. the plain text is masked by diffusion.

6
❖​Block Cipher Modes of Operation:
Block Cipher Modes of Operation define how to securely encrypt and decrypt large amounts of
data using a block cipher. A block cipher is an encryption algorithm that processes data in
fixed-size blocks (e.g., 128 bits) rather than one bit at a time. However, to encrypt data larger
than a single block, different modes of operation are used to ensure both security and efficiency.
Here are a few common modes. Here are a few common modes:
●​ Electronic Code Book (ECB):
The electronic codebook is the easiest block cipher mode of functioning. It is easier because of
the direct encryption of each block of input plaintext and output is in the form of blocks of
encrypted ciphertext. Generally, if a message is larger than b bits in size, it can be broken down
into a bunch of blocks and the procedure is repeated.
The procedure of ECB is illustrated below:

Electronic Code Book


Advantages of using ECB
●​ Parallel encryption of blocks of bits is possible, thus it is a faster way of encryption.
●​ Simple way of the block cipher.
Disadvantages of using ECB
●​ Prone to cryptanalysis since there is a direct relationship between plaintext and
ciphertext.
●​ Identical plaintext blocks produce identical ciphertext blocks, which can reveal
patterns.

●​ Cipher Block Chaining:


Cipher block chaining or CBC is an advancement made on ECB since ECB compromises some
security requirements. In CBC, the previous cipher block is given as input to the next encryption
algorithm after XOR with the original plaintext block. In a nutshell here, a cipher block is
produced by encrypting an XOR output of the previous cipher block and present plaintext block.
The process is illustrated here:

7
Cipher Block Chaining
Advantages of CBC
●​ CBC works well for input greater than b bits.
●​ CBC is a good authentication mechanism.
●​ Better resistive nature towards cryptanalysis than ECB.
●​ More secure than ECB as it hides patterns.
Disadvantages of CBC
●​ Requires the previous ciphertext block for encryption and decryption, making parallel
processing difficult.

●​ Cipher Feedback Mode (CFB)


In this mode the cipher is given as feedback to the next block of encryption with some new
specifications: first, an initial vector IV is used for first encryption and output bits are divided as
a set of s and b-s bits. The left-hand side s bits are selected along with plaintext bits to which an
XOR operation is applied. The result is given as input to a shift register having b-s bits to lhs, s
bits to rhs and the process continues. The encryption and decryption process for the same is
shown below, both of them use encryption algorithms.

8
Cipher Feedback Mode
Advantages of CFB
●​ Since, there is some data loss due to the use of shift register, thus it is difficult for
applying cryptanalysis.
●​ Can handle data streams of any size.
Disadvantages of using CFB
●​ The drawbacks of CFB are the same as those of CBC mode. Both block losses and
concurrent encryption of several blocks are not supported by the encryption.
Decryption, however, is parallelizable and loss-tolerant.
●​ Slightly more complex and can propagate errors.

●​ Output Feedback Mode:


The output feedback mode follows nearly the same process as the Cipher Feedback mode except
that it sends the encrypted output as feedback instead of the actual cipher which is XOR output.
In this output feedback mode, all bits of the block are sent instead of sending selected s bits. The
Output Feedback mode of block cipher holds great resistance towards bit transmission errors. It
also decreases the dependency or relationship of the cipher on the plaintext.

9
Output Feedback Mode
Advantages of OFB
●​ In the case of CFB, a single bit error in a block is propagated to all subsequent blocks.
This problem is solved by OFB as it is free from bit errors in the plaintext block. Thus
errors in transmission don’t propagate.
Disadvantages of OFB
●​ The drawback of OFB is that, because to its operational modes, it is more susceptible
to a message stream modification attack than CFB.
●​ If the keystream is reused, security is compromised.

❖​RSA Encryption Algorithm


RSA encryption algorithm is a type of public-key encryption algorithm. To better understand
RSA, lets first understand what is public-key encryption algorithm.
Public key encryption algorithm:
Public Key encryption algorithm is also called the Asymmetric algorithm. Asymmetric
algorithms are those algorithms in which sender and receiver use different keys for encryption
and decryption. Each sender is assigned a pair of keys:
○​ Public key
○​ Private key
The Public key is used for encryption, and the Private Key is used for decryption. Decryption
cannot be done using a public key. The two keys are linked, but the private key cannot be derived
from the public key. The public key is well known, but the private key is secret and it is known
only to the user who owns the key. It means that everybody can send a message to the user using
user's public key. But only the user can decrypt the message using his private key.
The Public key algorithm operates in the following manner:

10
The data to be sent is
encrypted by sender A using the public key of the intended receiver
○​ B decrypts the received ciphertext using its private key, which is known only to B. B
replies to A encrypting its message using A's public key.
○​ A decrypts the received ciphertext using its private key, which is known only to him.

RSA encryption algorithm:


RSA is the most common public-key algorithm, named after its inventors Rivest, Shamir, and
Adelman (RSA).

RSA algorithm
uses the following procedure to generate public and private keys:
○​ Select two large prime numbers, p and q.
○​ Multiply these numbers to find n = p x q, where n is called the modulus for encryption
and decryption.
○​ Choose a number e less than n, such that n is relatively prime to (p - 1) x (q -1). It means
that e and (p - 1) x (q - 1) have no common factor except 1. Choose "e" such that 1<e < φ
(n), e is prime to φ (n),​
gcd (e,d(n)) =1
○​ If n = p x q, then the public key is <e, n>. A plaintext message m is encrypted using
public key <e, n>. To find ciphertext from the plain text following formula is used to get
ciphertext C.​

11
C = me mod n​
Here, m must be less than n. A larger message (>n) is treated as a concatenation of
messages, each of which is encrypted separately.
○​ To determine the private key, we use the following formula to calculate the d such that:​
De mod {(p - 1) x (q - 1)} = 1​
Or​
De mod φ (n) = 1
○​ The private key is <d, n>. A ciphertext message c is decrypted using private key <d, n>.
To calculate plain text m from the ciphertext c following formula is used to get plain text
m.​
m = cd mod n
Let's take some example of RSA encryption algorithm:
Example 1:
This example shows how we can encrypt plaintext 9 using the RSA public-key encryption
algorithm. This example uses prime numbers 7 and 11 to generate the public and private keys.
Explanation:
Step 1: Select two large prime numbers, p, and q.
p=7
q = 11
Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption
and decryption.
First, we calculate
n=pxq
n = 7 x 11
n = 77
Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q -1). It means
that e and (p - 1) x (q - 1) have no common factor except 1. Choose "e" such that 1<e < φ (n), e is
prime to φ (n), gcd (e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (7 - 1) x (11 - 1)
φ (n) = 6 x 10
φ (n) = 60
Let us now choose relative prime e of 60 as 7.
Thus the public key is <e, n> = (7, 77)
Step 4: A plaintext message m is encrypted using public key <e, n>. To find ciphertext from the
plain text following formula is used to get ciphertext C.
To find ciphertext from the plain text following formula is used to get ciphertext C.
C = me mod n
C = 97 mod 77
C = 37
Step 5: The private key is <d, n>. To determine the private key, we use the following formula d
such that:
De mod {(p - 1) x (q - 1)} = 1
7d mod 60 = 1, which gives d = 43
The private key is <d, n> = (43, 77)

12
Step 6: A ciphertext message c is decrypted using private key <d, n>. To calculate plain text m
from the ciphertext c following formula is used to get plain text m.
m = cd mod n
m = 3743 mod 77
m=9
In this example, Plain text = 9 and the ciphertext = 37
Example 2:
In an RSA cryptosystem, a particular A uses two prime numbers, 13 and 17, to generate the
public and private keys. If the public of A is 35. Then the private key of A is ……………?.
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p = 13
q = 17
Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption
and decryption.
First, we calculate
n=pxq
n = 13 x 17
n = 221
Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q -1). It means
that e and (p - 1) x (q - 1) have no common factor except 1. Choose "e" such that 1<e < φ (n), e is
prime to φ (n), gcd (e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (13 - 1) x (17 - 1)
φ (n) = 12 x 16
φ (n) = 192
g.c.d (35, 192) = 1
Step 3: To determine the private key, we use the following formula to calculate the d such that:
Calculate d = de mod φ (n) = 1
d = d x 35 mod 192 = 1
d = (1 + k.φ (n))/e [let k =0, 1, 2, 3………………]
Put k = 0
d = (1 + 0 x 192)/35
d = 1/35
Put k = 1
d = (1 + 1 x 192)/35
d = 193/35
Put k = 2
d = (1 + 2 x 192)/35
d = 385/35
d = 11
The private key is <d, n> = (11, 221)
Hence, private key i.e. d = 11

Example 3:

13
A RSA cryptosystem uses two prime numbers 3 and 13 to generate the public key= 3 and the
private key = 7. What is the value of cipher text for a plain text?
Explanation:
Step 1: In the first step, select two large prime numbers, p and q.
p=3
q = 13
Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption
and decryption.
First, we calculate
n=pxq
n = 3 x 13
n = 39
Step 3: If n = p x q, then the public key is <e, n>. A plaintext message m is encrypted using
public key <e, n>. Thus the public key is <e, n> = (3, 39).
To find ciphertext from the plain text following formula is used to get ciphertext C.
C = me mod n
C = 53 mod 39
C = 125 mod 39
C=8
Hence, the ciphertext generated from plain text, C = 8.
Example 4:
A RSA cryptosystem uses two prime numbers, 3 and 11, to generate private key = 7. What is the
value of ciphertext for a plain text 5 using the RSA public-key encryption algorithm?
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p=3
q = 11
Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption
and decryption.
First, we calculate
n=pxq
n = 3 x 11
n = 33
Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q -1). It means
that e and (p - 1) x (q - 1) have no common factor except 1. Choose "e" such that 1< e < φ (n), e
is prime to φ (n), gcd (e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (3 - 1) x (11 - 1)
φ (n) = 2 x 10
φ (n) = 20
Step 4: To determine the public key, we use the following formula to calculate the d such that:
Calculate e x d = 1 mod φ (n)
e x 7 = 1 mod 20
e x 7 = 1 mod 20
e = (1 + k. φ (n))/ d [let k =0, 1, 2, 3………………]

14
Put k = 0
e = (1 + 0 x 20) / 7
e = 1/7
Put k = 1
e = (1 + 1 x 20) / 7
e = 21/7
e=3
The public key is <e, n> = (3, 33)
Hence, public key i.e. e = 3

❖​Data Encryption Standard


What is DES?
Data Encryption Standard (DES) is a block cipher with a 56-bit key length that has played a
significant role in data security. Data encryption standard (DES) has been found vulnerable to
very powerful attacks therefore, the popularity of DES has been found slightly on the decline.
DES is a block cipher and encrypts data in blocks of size of 64 bits each, which means 64 bits of
plain text go as the input to DES, which produces 64 bits of ciphertext. 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:
We have mentioned that DES uses a 56-bit key. Actually, The initial key consists of 64 bits.
However, before the DES process even starts, every 8th bit of the key is discarded to produce a
56-bit key. That is bit positions 8, 16, 24, 32, 40, 48, 56, and 64 are discarded.

Thus, the discarding of every 8th 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
confusion) and transposition (also called diffusion). DES consists of 16 steps, each of which is
called a round. Each round performs the steps of substitution and transposition. Let us now
discuss the broad-level steps in DES.
●​ In the first step, the 64-bit plain text block is handed over to an initial Permutation
(IP) function.
●​ The initial permutation is performed on plain text.
●​ Next, the initial permutation (IP) produces two halves of the permuted block; saying
Left Plain Text (LPT) and Right Plain Text (RPT).
●​ Now each LPT and RPT go through 16 rounds of the encryption process.
●​ In the end, LPT and RPT are rejoined and a Final Permutation (FP) is performed on
the combined block
●​ The result of this process produces 64-bit ciphertext.

15
Initial Permutation (IP)
As we have noted, the initial permutation (IP) happens only once and it happens before the first
round. It suggests how the transposition in IP should proceed, as shown in the figure. For
example, it says that the IP replaces the first bit of the original plain text block with the 58th bit
of the original plain text, the second bit with the 50th bit of the original plain text block, and so
on.
This is nothing but jugglery of bit positions of the original plain text block. the same rule applies
to all the other bit positions shown in the figure.

As we have noted after IP is done, the resulting 64-bit permuted text block is divided into two
half blocks. Each half-block consists of 32 bits, and each of the 16 rounds, in turn, consists of the
broad-level steps outlined in the figure.

16
Step 1: Key transformation
We have noted initial 64-bit key is transformed into a 56-bit key by discarding every 8th bit of
the initial key. Thus, for each a 56-bit key is available. From this 56-bit key, a different 48-bit
Sub Key is generated during each round using a process called key transformation. For this, the
56-bit key is divided into two halves, each of 28 bits. These halves are circularly shifted left by
one or two positions, depending on the round.
For example: if the round numbers 1, 2, 9, or 16 the shift is done by only one position for other
rounds, the circular shift is done by two positions. The number of key bits shifted per round is
shown in the figure.

After an appropriate shift, 48 of the 56 bits are selected. From the 48 we might obtain 64 or 56
bits based on requirement which helps us to recognize that this model is very versatile and can
handle any range of requirements needed or provided. for selecting 48 of the 56 bits the table is
shown in the figure given below. For instance, after the shift, bit number 14 moves to the first

17
position, bit number 17 moves to the second position, and so on. If we observe the table , we will
realize that it contains only 48-bit positions. Bit number 18 is discarded (we will not find it in the
table), like 7 others, to reduce a 56-bit key to a 48-bit key. Since the key transformation process
involves permutation as well as a selection of a 48-bit subset of the original 56-bit key it is called
Compression Permutation.

Because of this compression permutation technique, a different subset of key bits is used in each
round. That makes DES not easy to crack.
Step 2: Expansion Permutation
Recall that after the initial permutation, we had two 32-bit plain text areas called Left Plain
Text(LPT) and Right Plain Text(RPT). During the expansion permutation, the RPT is expanded
from 32 bits to 48 bits. Bits are permuted as well hence called expansion permutation. This
happens as the 32-bit RPT is divided into 8 blocks, with each block consisting of 4 bits. Then,
each 4-bit block of the previous step is then expanded to a corresponding 6-bit block, i.e., per
4-bit block, 2 more bits are added.

This process results in expansion as well as a permutation of the input bit while creating output.
The key transformation process compresses the 56-bit key to 48 bits. Then the expansion
permutation process expands the 32-bit RPT to 48-bits. Now the 48-bit key is XOR with 48-bit
RPT and the resulting output is given to the next step, which is the S-Box substitution.

18
—--------------------------------------------------------------------------------------------------------
Data Encryption Standard (DES)
The Data Encryption Standard (DES) is a symmetric-key block cipher published by the National
Institute of Standards and Technology (NIST).
DES is an implementation of a Feistel Cipher. It uses 16 round Feistel structure. The block size is
64-bit. Though, key length is 64-bit, DES has an effective key length of 56 bits, since 8 of the 64
bits of the key are not used by the encryption algorithm (function as check bits only). General
Structure of DES is depicted in the following illustration −

Since DES is based on the Feistel Cipher, all that is required to specify DES is −
​ Round function
​ Key schedule
​ Any additional processing − Initial and final permutation
Initial and Final Permutation
The initial and final permutations are straight Permutation boxes (P-boxes) that are inverses of
each other. They have no cryptography significance in DES. The initial and final permutations
are shown as follows −

19
Round Function
The heart of this cipher is the DES function, f. The DES function applies a 48-bit key to the
rightmost 32 bits to produce a 32-bit output.

20
​ Expansion Permutation Box − Since right input is 32-bit and round key is a 48-bit, we
first need to expand right input to 48 bits. Permutation logic is graphically depicted in the
following illustration −

​ The graphically depicted permutation logic is generally described as table in DES


specification illustrated as shown −

21
​ XOR (Whitener). − After the expansion permutation, DES does XOR operation on the
expanded right section and the round key. The round key is used only in this operation.
​ Substitution Boxes. − The S-boxes carry out the real mixing (confusion). DES uses 8
S-boxes, each with a 6-bit input and a 4-bit output. Refer the following illustration −

​ The S-box rule is illustrated below −

22
​ There are a total of eight S-box tables. The output of all eight s-boxes is then combined in
to 32 bit section.
​ Straight Permutation − The 32 bit output of S-boxes is then subjected to the straight
permutation with rule shown in the following illustration:

Explore our latest online courses and learn new skills at your own pace. Enroll and become a
certified expert to boost your career.
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key. The process of
key generation is depicted in the following illustration −

23
The logic for Parity drop, shifting, and Compression P-box is given in the DES description.
DES Analysis
The DES satisfies both the desired properties of block cipher. These two properties make cipher
very strong.
​ Avalanche effect − A small change in plaintext results in the very great change in the
ciphertext.
​ Completeness − Each bit of ciphertext depends on many bits of plaintext.
During the last few years, cryptanalysis have found some weaknesses in DES when key selected
are weak keys. These keys shall be avoided.
DES has proved to be a very well designed block cipher. There have been no significant
cryptanalytic attacks on DES other than exhaustive key search.

24
❖​Authentication:
Authentication is the process of identifying users that request access to a system, network, server,
app, website, or device. The primary goal of authentication is to ensure that a user is who they
claim to be. User A, for example, has access to only relevant information and is unable to see
User B’s personal information. Unauthorized users are prevented from accessing sensitive data
with user authentication. Authentication improves security by allowing any Organizational
admin to manage an individual user’s identity and access. The basic authentication used for
identity and access control verification is username and password, with different types of
authentication techniques that we shall cover moving forward.

Why Is User Authentication Important?


There is no organization, system, network, website, or server in today’s modern world that does
not require some form of authentication. If they are not, they are putting themselves at risk of
attacks that could result in the misappropriation of their resources and sensitive data at the very
least. A single blunder may expose your organization’s data to cybercriminals, as they are always
prepared with a variety of cyber weaponry, such as (Phishing, Data breaches, spoofing, etc).
When your authentication system isn’t up to par, they can quickly get access and steal
information. A few of the most recent major attacks will lead you to the conclusion that, whether
you are a little business or a large corporation, authentication using the finest security techniques
is a must to stay stable in this technological environment.

Different types of Authentication


When it comes to authentication and security, there is a vast ocean of different authentication
options to choose from. Before adopting or choosing any of the authentication methods for your
Organization’s employees or end-users, you should be aware of a few key factors that will help
you choose the most appropriate authentication technique for you:
1.​ Security capability of that Authentication Method
2.​ Usability interface

1. Password Based Login:​


The most commonly utilized regular login authentication system that you will employ on a daily
basis while utilizing an online service is password-based login. You need to input a combination
of your username/mobile number and a password when using the Password-Based
Authentication technique. The individual is authorized only when both of these elements have
been verified. However, because today’s customers use multiple online services (apps and
websites), it’s tough to keep track of all of their usernames and passwords. As a result of this,
end-users engage in unethical behaviors such as forgetting passwords, using the same password
for several services, and so on. Cybercriminals enter at this point and begin actions such as
phishing, data breaches, and so on. That is the fundamental reason why standard password-based
authentication is losing favor and more organizations are turning to advanced additional security
authentication factors.
2. Multi-Factor Authentication:
Multi-Factor Authentication (MFA) is an authentication method in which an individual must pass
multiple factors in order to gain access to a service or network. It’s an extra layer of security on
top of the standard password-based login. Individuals must also submit a second factor in the

25
form of a one-time code that they will receive through phone or email in addition to their
Username and Password.
You may quickly configure several Multi-Factor Authentication (MFA) methods to give an extra
layer of security to your resources. OTP/TOTP via SMS, OTP/TOTP over Email, Push
notification, Hardware Token, and Mobile Authenticator are all examples of MFA methods
(Google, Microsoft, Authy, etc). You can choose any of the MFA techniques and implement
them for organizational security based on your needs and requirements. After traditional
password-based login, Multi-Factor Authentication is the most trusted authentication
mechanism. For improved security, password-based traditional authentication and Multi-Factor
Authentication methods are usually used simultaneously.
3. Biometric Authentication:
Individual physical attributes such as fingerprints, palms, retinas, voice, face, and voice
recognition are used in biometric authentication. Biometric authentication works in the following
way: first, the physical characteristics of individuals are saved in a database. Individuals’
physical features are checked against the data contained in the database whenever a user wants to
access any device or physically enter any premises (Organization, School, Colleges, Workplace).
Biometric authentication technology is mostly employed by private organizations, airports, and
border crossing points where security is a top priority. Because of its capacity to create a high
level of security and a user-friendly frictionless flow, biometrics is one of the most often used
security technologies. Among the most common biometric authentication methods are:
1. Fingerprint: To enable access, fingerprint authentication matches the unique pattern of an
individual’s print. In some advanced Fingerprint authentication systems, the vascular structure of
the finger is also sensed. Because it is one of the most user-friendly and accurate biometric
systems, fingerprint authentication is currently the most common biometric technology for
ordinary customers. Biometrics’ popularity can be due to the fact that you use your mobile
phones with fingerprints on a regular basis, as well as companies or institutions that use
Fingerprint authentication.
2. Retina & Iris: Scanners shine a strong light into the eye and look for distinctive patterns in
the colorful ring around the pupil of the eye in this biometric. After that, the scanned pattern is
compared to data recorded in a database. When a person wears spectacles or contact lenses,
eye-based authentication can be inaccurate.
3. Facial: In facial authentication, multiple aspects of an individual’s face are scanned while they
try to get access to a certain resource. When comparing faces from different angles or persons
that look similar, such as family members, face recognition results can be inconsistent.
4. Voice Recognition: Your voice tone is stored with a standardized secret code in the same way
that the above-mentioned approach does. A check occurs because you must speak off each time
you want access.

4. Certificate-based authentication:
Certificate-based authentication identifies people, servers, workstations, and devices by using an
electronic digital identity. In our daily lives, a digital certificate functions similarly to a driver’s
license or a passport. A certificate is made up of a user’s digital identity, which contains a public
key and a certification authority’s digital signature. This certificate verifies that the public key
and the person who issued the certificate are both the same person. When a user attempts to log
in to a server, they must first present their digital certificate. The server checks the digital

26
certificate’s identity and credibility by confirming that the user has a correctly associated private
key with the certificate using cryptography.
5. Token-Based Authentication:
Token-Based Authentication allows users to enter their credentials only once and obtain a
one-of-a-kind encrypted string exchange in return. After that, you won’t have to input your
credentials every time you want to log in or acquire access. The digital token ensures that you
have already been granted access. Most use cases, such as Restful APIs that are accessed by
many frameworks and clients, require token-based authentication.

❖​Kerberos Authentication Process:

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
Working of Kerberos
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.

27
Limitations of Kerberos
●​ 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
Here are some examples of Kerberos authentication:
●​ Joining a meeting: A user can click on a link to join a meeting and be automatically
authenticated.
●​ Accessing a database: A user can access sensitive information in a database without
entering separate credentials.
●​ Authenticating to a mail server: A user can authenticate to a mail server to prove their
identity.
●​ Connecting to a MySQL server: A user can connect to a MySQL server using a
Kerberos account.

28
Kerberos authentication protects user credentials from hackers by keeping passwords away
from insecure networks.
How Kerberos authentication works
●​ The client requests authentication from the KDC.
●​ The KDC sends a TGT and a session key if the client exists in the database.
●​ The client asks for a service ticket along with the TGT.
●​ The KDC sends the ticket encrypted with the session key.
●​ The client uses the service ticket to request access from the application server.
●​ The application server authenticates the client and grants access to the service.

Applications of Kerberos
●​ User Authentication: User Authentication is one of the main applications of
Kerberos. Users only have to input their username and password once with Kerberos
to gain access to the network. The Kerberos server subsequently receives the
encrypted authentication data and issues a ticket granting ticket (TGT).
●​ Single Sign-On (SSO): Kerberos offers a Single Sign-On (SSO) solution that enables
users to log in once to access a variety of network resources. A user can access any
network resource they have been authorized to use after being authenticated by the
Kerberos server without having to provide their credentials again.
●​ Mutual Authentication: Before any data is transferred, Kerberos uses a mutual
authentication technique to make sure that both the client and server are
authenticated. Using a shared secret key that is securely kept on both the client and
server, this is accomplished. A client asks the Kerberos server for a service ticket
whenever it tries to access a network resource. The client must use its shared secret
key to decrypt the challenge that the Kerberos server sends via encryption. If the
decryption is successful, the client responds to the server with evidence of its identity.
●​ Authorization: Kerberos also offers a system for authorization in addition to
authentication. After being authenticated, a user can submit service tickets for certain
network resources. Users can access just the resources they have been given
permission to use thanks to information about their privileges and permissions
contained in the service tickets.
●​ Network Security: Kerberos offers a central authentication server that can regulate
user credentials and access restrictions, which helps to ensure network security. In
order to prevent unwanted access to sensitive data and resources, this server may
authenticate users before granting them access to network resources.
How Kerberos Version 5 authentication works:
1.​ Client Authentication Request: The client (user) sends a request to the Authentication
Server (AS), typically with a user ID and possibly a password.​

2.​ Ticket Granting Ticket (TGT): If the client is authenticated successfully, the AS issues
a TGT (Ticket Granting Ticket), which is used to request access to services.​

3.​ Requesting Service Access: The client uses the TGT to request a service ticket from the
Ticket Granting Server (TGS) for a specific service.​

29
4.​ Access Service: The client presents the service ticket to the target service, which then
verifies the ticket using its own secret key and grants access if the authentication is valid.​

5.​ Session Key: Both the client and service communicate securely using the session key
embedded in the service ticket.

❖​Integrating Biometric Authentication with Kerberos and KDC:


To incorporate biometric authentication into the existing Kerberos authentication process, the
flow of events could be enhanced as follows:
1. Biometric Enrollment
●​ When a user first registers with the system, their biometric data (e.g., fingerprint, facial
scan, or iris scan) is collected and securely stored, likely in an encrypted database.
●​ This data is tied to the user’s identity and can be used to verify their identity during future
authentication requests.

30
2. Biometric Authentication Request (Step 1)
●​ When a user attempts to authenticate, instead of simply providing a password, they scan
their biometric traits (e.g., scan their fingerprint or face).
●​ The biometric system compares the user's input to the stored biometric data. If the
biometric match is successful, the user is considered authenticated at this stage.
3. Generate TGT Based on Biometric Verification (Step 2)
●​ After successful biometric verification, the system can proceed to the Kerberos
authentication process.
●​ The Authentication Server (AS) is now able to validate the biometric authentication in
addition to checking the user’s password (if applicable), or the user’s biometric data can
be used directly as an additional authentication factor.
●​ Once the biometric authentication is successful, the AS issues the Ticket Granting
Ticket (TGT), which is encrypted and includes a session key for secure communication.
4. Requesting Service Access (Step 3)
●​ The client can now request service tickets from the Ticket Granting Server (TGS) using
the TGT obtained during the biometric-based authentication.
●​ The TGS checks the validity of the TGT, and if valid, issues a Service Ticket that
contains a session key.
5. Accessing the Service (Step 4)
●​ The client presents the service ticket to the requested service for access.
●​ The service verifies the ticket using its secret key and grants the client access if the ticket
is valid.
●​ Secure communication continues between the client and service using the session key.

Benefits of Integrating Biometric Authentication with Kerberos


●​ Enhanced Security: Biometric traits are unique to individuals, making it difficult for
attackers to spoof authentication, especially when combined with the existing Kerberos
ticket-based system.
●​ Multi-Factor Authentication (MFA): By combining something you know (password)
with something you are (biometrics), this method introduces a multi-factor authentication
approach, significantly strengthening security.
●​ User Convenience: For users, biometric authentication is seamless and doesn't require
the memorization of complex passwords or tokens.
●​ Reduced Risk of Credential Theft: With biometrics, there's no need to store and
transmit sensitive credentials like passwords. This can lower the risk of credential theft.

Challenges and Considerations


●​ Privacy Concerns: Biometric data is highly sensitive, and its storage and transmission
must be encrypted to prevent unauthorized access. There are also legal and regulatory
concerns about biometric data storage (e.g., GDPR, HIPAA).
●​ False Positives/Negatives: Biometric systems can have false positives (wrongly
authenticating someone) or false negatives (incorrectly denying access to a legitimate
user), especially in cases of poor-quality sensors or environmental factors.
●​ System Integration Complexity: Integrating biometric systems with Kerberos and KDC
requires careful design and implementation, ensuring that biometric data is captured

31
securely, integrated with existing infrastructure, and synchronized with Kerberos
authentication.
●​ Scalability: In a large enterprise environment, managing and securely storing biometric
data for many users can be challenging. Additionally, biometrics require specialized
hardware (e.g., fingerprint scanners, cameras), which can increase infrastructure costs.

Example Use Cases


1.​ Enterprise Network Security:​

○​ In an enterprise setting, biometric authentication can be used as an additional


layer of security to authenticate users before they can request a TGT from the
KDC. Once biometric authentication is successful, the user can seamlessly access
resources within the network using Kerberos authentication.
2.​ Remote Authentication with Biometric Authentication:​

○​ For employees working remotely, biometric authentication can be used on mobile


devices to confirm their identity before allowing access to corporate services
protected by Kerberos-based authentication.
3.​ Secure Transactions:​

○​ For systems requiring high-security transactions, such as banking, healthcare, or


government services, biometric authentication can be used alongside Kerberos
to ensure that only the authorized user can access critical services.

❖​ Third-party authentication using Key Distribution Center (KDC) and


Kerberos Version 5 :

Here’s a general workflow for how third-party authentication works in a system using Kerberos
v5:
1. Client Request to Authentication Server (AS):
●​ The client begins the authentication process by sending a request to the Authentication
Server (AS).
●​ This request typically includes the client’s username and a timestamp.
●​ The client is not sending a password directly over the network, but it is identified by the
AS, which has knowledge of the client’s secret key.
2. AS Responds with Ticket-Granting Ticket (TGT):
●​ The AS validates the client’s credentials (username, password, etc.) using its internal
database.
●​ If authentication is successful, the AS issues a Ticket-Granting Ticket (TGT) encrypted
with the client’s password.
●​ Along with the TGT, the AS sends a session key (shared between the client and the
KDC) and a lifetime for the ticket.
3. Client Requests Service Ticket from TGS:
●​ The client can now use the TGT to request access to a specific service from the
Ticket-Granting Server (TGS).
●​ The client sends the TGT to the TGS, indicating the target service it wants to access.

32
4. TGS Issues Service Ticket:
●​ The TGS decrypts the TGT, verifies its authenticity, and checks the client’s credentials.
●​ If everything is in order, the TGS issues a service ticket for the requested service.
●​ This service ticket is encrypted with the secret key of the target service, ensuring only
that service can decrypt it.
5. Client Accesses the Service:
●​ The client sends the service ticket to the target service it wants to interact with, along
with an authenticator (which contains a timestamp).
●​ The service decrypts the ticket using its secret key, verifies the client’s identity, and
grants access if everything matches.
●​ The service then uses the session key to communicate securely with the client.

Security Benefits of Kerberos v5:


1.​ Mutual Authentication: Both the client and the service authenticate each other, ensuring
that neither party is impersonated.
2.​ Password Protection: The user’s password is never sent over the network in plaintext.
The ticketing process protects the user’s credentials.
3.​ Single Sign-On (SSO): Once the client obtains a TGT, they can use it to access multiple
services without needing to re-authenticate.
4.​ Encrypted Communication: All communication between the client, KDC, and services
is encrypted, providing confidentiality and integrity.
Kerberos in Information Systems (IS):
In enterprise information systems (IS), Kerberos is often used for authentication in
environments where there is a need to manage user access to multiple services (e.g., file servers,
web servers, database systems) securely. Here are some examples of systems that rely on
Kerberos:
●​ Microsoft Active Directory: Uses Kerberos for authentication.
●​ Unix/Linux Systems: Kerberos is used for securing remote login and network
communication.
●​ Distributed Applications: Any service-oriented architecture (SOA) can benefit from
Kerberos for secure inter-service communication.

❖​Mutual Authentication:
Mutual Authentication is a process where both parties (typically a client and a server)
authenticate each other to ensure that neither party is impersonating the other. This is an
important security feature to protect against man-in-the-middle attacks, fraud, and unauthorized
access.
How Mutual Authentication Works:
1.​ Client Authentication (Server's Side):
○​ The client connects to the server and requests a secure connection.
○​ The server proves its identity by sending a certificate or using another means of
authentication (like a shared key, digital certificate, etc.).
○​ The client verifies the server’s identity using a trusted third party (e.g., a
Certificate Authority or KDC in the case of Kerberos).
2.​ Server Authentication (Client's Side):
○​ The server can also verify the client’s identity.

33
○​ Typically, this involves the client proving knowledge of a secret (e.g., a password,
digital signature, or other credentials) through a challenge-response mechanism or
certificate-based methods.
○​ Once both parties authenticate each other, they can establish a secure
communication channel.
Importance of Mutual Authentication:
●​ Prevention of Impersonation: Both the client and the server ensure they are
communicating with the intended party, protecting against identity theft.
●​ Confidentiality and Integrity: Once mutual authentication is complete, both parties can
exchange sensitive data over a secure channel (e.g., SSL/TLS encryption).
●​ Non-repudiation: Both parties have proof of who they communicated with, preventing
denial of actions or interactions.
Examples of Mutual Authentication:
●​ SSL/TLS (Web Browsing): SSL/TLS protocols often implement mutual authentication
by having both the client and server present certificates.
●​ Kerberos Authentication: As explained earlier, Kerberos ensures mutual authentication
by issuing tickets for both clients and services, validating both sides before granting
access.
❖​Reflection Attack:
A Reflection Attack is a type of denial-of-service (DoS) attack where an attacker reflects a
request they receive from a legitimate user (or system) back to the original source in a malicious
way. The attack involves sending a response to a request that was not directly from the attacker,
but is instead targeted at another entity (usually the victim). This attack can be particularly
dangerous in the context of authentication protocols.

Reflection Attack Mechanism:


1.​ Step 1: Attacker Sends a Request: The attacker sends an authentication or connection
request to a server, but with the source IP address of the victim, not their own. This is
often done by spoofing the source IP.​

2.​ Step 2: Server Responds to the Victim: The server, believing the request originated
from the victim, sends a response (often a challenge or authentication request) back to the
victim’s IP address.​

3.​ Step 3: Victim Receives the Malicious Response: The victim receives the server’s
response and might process it in a way that compromises their own system. In some
cases, this could lead to the victim inadvertently providing sensitive information,
triggering further attack vectors.​

In simpler terms, the attacker reflects a message (or request) that appears legitimate to the server
but is designed to affect the victim who’s unaware of the manipulation.
Examples of Reflection Attacks:
1.​ DNS Reflection Attack: Attackers send DNS queries to open DNS resolvers with the
victim’s IP address as the source. The victim gets flooded with DNS responses.​

34
2.​ Kerberos Reflection Attack: This occurs when an attacker attempts to reflect an
authentication request to the Key Distribution Center (KDC) to impersonate a legitimate
user. Since the attacker’s request appears to come from the victim, the KDC could issue a
service ticket for the victim, granting unauthorized access.​

Reflection Attacks in the Context of Kerberos (and IS):


In a Kerberos-based environment, reflection attacks can be a serious issue. Here's how it can
potentially occur:
●​ Step 1: The attacker requests a Ticket Granting Ticket (TGT) from the Authentication
Server (AS), but they spoof the source IP to appear as if the request is coming from a
legitimate user.
●​ Step 2: The AS responds with a TGT for that user, but since the request seems
legitimate, the attacker might trick the server into issuing a ticket for the victim user.
●​ Step 3: The attacker can use this ticket to impersonate the victim and access protected
resources.
This kind of reflection attack undermines the mutual authentication process by manipulating the
credentials exchange to bypass the intended safeguards.
Mitigation of Reflection Attacks:
1.​ Proper Source Address Validation:
○​ Ensuring that requests are validated based on correct IP addresses or additional
identifiers can help prevent attacks where the attacker impersonates the victim.
2.​ Use of Nonces or Timestamps:​

○​ A nonce (a random number) or timestamp can be included in requests and


responses. This ensures that even if a response is reflected back, it cannot be
reused or manipulated due to the uniqueness or time-based constraints.
3.​ Challenge-Response Mechanisms:​

○​ For mutual authentication systems, a challenge-response process should be used,


ensuring that each party proves they know a shared secret or can correctly
respond to a challenge. This prevents attackers from merely reflecting messages.
4.​ IP Source Filtering:​

○​ Enforcing that the source of a request must match the response address, and not
allowing spoofed IP addresses, can prevent many forms of reflection attacks.
5.​ Rate Limiting:​

○​ Limiting the rate of requests that can be made from a given IP can help mitigate
large-scale reflection attacks, particularly when flooding the victim with
responses.
6.​ Session Binding:​

○​ Using session-based or token-based mechanisms ensures that each session is tied


to a specific requestor and prevents the reuse of responses from unrelated
requests.

35

You might also like