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

Chapter-2-Part2

Cryptographic algorithms are processes used to encipher and decipher messages, ensuring data protection and secure communications. They include symmetric key methods like DES and AES, and asymmetric methods like Diffie-Hellman. The Data Encryption Standard (DES) specifically operates on 64-bit blocks using a 56-bit key and involves multiple rounds of processing to encrypt and decrypt data.

Uploaded by

ETHIOPIA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter-2-Part2

Cryptographic algorithms are processes used to encipher and decipher messages, ensuring data protection and secure communications. They include symmetric key methods like DES and AES, and asymmetric methods like Diffie-Hellman. The Data Encryption Standard (DES) specifically operates on 64-bit blocks using a 56-bit key and involves multiple rounds of processing to encrypt and decrypt data.

Uploaded by

ETHIOPIA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

Cryptographic Algorithms

Chapter 2-continued

12/14/2024 1
Cryptographic Algorithms

▪ Cryptographic algorithms are sequences of processes, or rules,

used to encipher and decipher messages in a cryptographic system.

▪ In simple terms, they're processes that protect data by making sure that

unwanted people can't access it.

▪ These algorithms have a wide variety of uses, including ensuring secure

and authenticated financial transactions.

12/14/2024 2
Cryptographic Algorithms…
▪ Most cryptography algorithms involve the use of encryption, which
allows two parties to communicate while preventing
unauthorized third parties from understanding those
communications.

▪ Encryption transforms human readable plaintext into something


unreadable, also known as ciphertext.

▪ The encrypted data is then decrypted to restore it, making it


understandable to the intended party.

▪ Both encryption and decryption operate based on algorithms.


12/14/2024 3
Cryptographic Algorithms…
▪ Traditional – Caesar Cipher Algorithm, rail fence, …

▪ Data Encryption Standard (DES)

▪ Triple DES Symmetric key


encryption methods
▪ Advanced Encryption Standard (AES)

▪ Digital Signature - cryptographic tool, appln of AKE

▪ Digital Certificate - access control

▪ Diffie-Hellman Key Exchange Algorithm (PKC) Asymmetric key


encryption methods
▪ Secure hash Algorithm (SHA-1)
12/14/2024 4
Feistel Cipher Structure
• Many symmetric block encryption algorithms, including DES, have a
structure first described by Horst Feistel of IBM
• The inputs to the encryption algorithm are a plaintext block of length
2w bits and a key K.
• The plaintext block is divided into two halves, L0 and R0.
• The two halves of the data pass through n rounds of processing and
then combine to produce the ciphertext block.
• Each round i has as inputs Li-1 and Ri-1, derived from the previous
round, as well as a subkey Ki, derived from the overall K.
• In general, the sub keys Ki are different from K and from each other
and are generated from the key by a subkey generation algorithm.
Feistel Cipher Structure
• All rounds have the same structure.
• A substitution is performed on the left half
of the data.
• This is done by applying a round function F
to the right half of the data and then
taking the exclusive-OR (XOR) of the
output of that function and the left half of
the data.
• The round function has the same general
structure for each round but is
parameterized by the round subkey Ki.
• Following this substitution, a permutation
is performed that consists of the
interchange of the two halves of the data.
Parameters and design features (of BC):

• Block size – larger, better; e.g. 128 bits


• Key size – larger, better; e.g. 128 bits (modern)
• Number of rounds – greater, better; e.g. 16 rounds
• Subkey generation algorithm
• Round function
• Fast software encryption/decryption
• Ease of analysis
1. Data Encryption Standard (DES)

• The Data Encryption Standard (DES) is a symmetric key algorithm for


the encryption of electronic data.

• It was highly influential in the advancement of modern cryptography.

• DES uses a 56-bit key and operates on 64-bit blocks of data.

• It was adopted as a federal standard in the United States in 1977.


1. DES …
• DES works on bits, or binary numbers--the 0s and 1s common to digital computers.
• Each group of four bits makes up a hexadecimal, or base 16, number.
• Binary "0001" is equal to the hexadecimal number "1", binary "1000" is equal to
the hexadecimal number "8", "1001" is equal to the hexadecimal number "9",
"1010" is equal to the hexadecimal number "A", and "1111" is equal to the
hexadecimal number "F".
• DES works by encrypting groups of 64 message bits, which is the same as 16
hexadecimal numbers.
• To do the encryption, DES uses "keys" which are also apparently 16 hexadecimal
numbers long, or apparently 64 bits long.
• However, every 8th key bit is ignored in the DES algorithm, so that the effective
key size is 56 bits.
• But, in any case, 64 bits (16 hexadecimal digits) is the round number upon which
DES is organized.
1. DES …
• For example, if we take the plaintext message "8787878787878787", and
encrypt it with the DES key "0E329232EA6D0D73", we end up with the
ciphertext "0000000000000000“ which gives same msg when deciphered.
• DES works only on 64 bit length, But most messages will not fall into this
category.
• take the message "Meet me at toga party I will show you the rat".
• This plaintext message is 48 bytes (96 hexadecimal digits) long. So this
message must be padded with some extra bytes at the tail end for the
encryption.
1. DES …

▪ Operation of DES:

▪ The basic process in enciphering a 64-bit data block using


the DES consists of:

1. An initial permutation (IP)

2. 16 rounds of a complex key dependent calculation f

3. A final permutation, being the inverse of IP

12/14/2024 11
1. DES …
▪ General Structure of DES

12/14/2024 12
1. DES ...
1. Initial Permutation (IP)

▪ The plain text is divided into smaller chunks of 64-bit size.

▪ The IP is performed before the first round.

▪ This phase describes the implementation of the transposition process.


For example, the 58th bit replaces the first bit, the 50th bit replaces the
second bit, and so on.

▪ The resultant 64-bit text is split into two equal halves of 32-bit each
called Left Plain Text (LPT) and Right Plain Text (RPT).

12/14/2024 13
1. DES …

2. Final Permtuation

▪ The final permutation is the inverse of initial permutation.

▪ They have no cryptography significance in DES.

▪ The initial and final permutations are shown as follows.

12/14/2024 14
2. DES ...
▪ Initial and Final Permutations

12/14/2024 15
2. DES ...
3. 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.

12/14/2024 16
1. DES ...
• DES is a block cipher--meaning it operates on plaintext blocks of a
given size (64-bits) and returns cipher text blocks of the same size.
• The steps are:
• Step 1: Create 16 sub keys, each of which is 48-bits long.
• Step 2: Encode each 64-bit block of data.
• Step 3: Repeat 16 times
• Step 4: Perform inverse permutation
How DES works:

• Let K be the hexadecimal key K = 133457799BBCDFF1. The binary equivalent


is:
• K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001

• Step1.1: perform permutation on 64 bit k; use the permutation table PC-1:


57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
How DES works:
• Step1.1: [contd.]
• From the original 64-bit key
K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001
• we get the 56-bit permutation
• K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111
• Step1.2: split this key into left and right halves, C0 and D0, where each half has 28
bits.
Example: From the permuted key K+, we get
C0 = 1111000 0110011 0010101 0101111
D0 = 0101010 1011001 1001111 0001111
• With C0 and D0 defined, we now create sixteen blocks Cn and Dn, 1<=n<=16. Each
pair of blocks Cn and Dn is formed from the previous pair Cn-1 and Dn-1, respectively,
for n = 1, 2, ..., 16, by using schedule of left shifts of the previous block
How DES works:
The 16 blocks Cn,Dn Shift schedule
C0 = 1111000011001100101010101111 C9 = 0101010101111111100001100110
D0 = 0101010101100110011110001111 D9 = 0011110001111010101010110011
C1 = 1110000110011001010101011111 C10 = 0101010111111110000110011001
D1 = 1010101011001100111100011110 D10 = 1111000111101010101011001100
C2 = 1100001100110010101010111111 C11 = 0101011111111000011001100101
D2 = 0101010110011001111000111101 D11 = 1100011110101010101100110011
C3 = 0000110011001010101011111111 C12 = 0101111111100001100110010101
D3 = 0101011001100111100011110101 D12 = 0001111010101010110011001111
C4 = 0011001100101010101111111100 C13 = 0111111110000110011001010101
D4 = 0101100110011110001111010101 D13 = 0111101010101011001100111100
C5 = 1100110010101010111111110000 C14 = 1111111000011001100101010101
D5 = 0110011001111000111101010101 D14 = 1110101010101100110011110001
C6 = 0011001010101011111111000011 C15 = 1111100001100110010101010111
D6 = 1001100111100011110101010101 D15 = 1010101010110011001111000111
C7 = 1100101010101111111100001100 C16 = 1111000011001100101010101111
D7 = 0110011110001111010101010110 D16 = 0101010101100110011110001111
C8 = 0010101010111111110000110011
D8 = 1001111000111101010101011001
How DES works:
• Step1.3: form the keys Kn, for 1<=n<=16, by applying the 48-bit permutation table
PC-2 to each of the concatenated pairs CnDn.
• PC-2:
14 17 11 24 1 5 3 28 15 6 21 10 23 19 12 4
26 8 16 7 27 20 13 2 41 52 31 37 47 55 30 40
51 45 33 48 44 49 39 56 34 53 46 42 50 36 29 32

For the first key we have C1D1 = 1110000 1100110 0101010 1011111 1010101
0110011 0011110 0011110
• which, after we apply the permutation PC-2, becomes
K1 = 000110 110000 001011 101111 111111 000111 000001 110010
K2 = 011110 011010 111011 011001 110110 111100 100111 100101
K3 = 010101 011111 110010 001010 010000 101100 111110 011001
K4 = 011100 101010 110111 010110 110110 110011 010100 011101
K5 = 011111 001110 110000 000111 111010 110101 001110 101000
K6 = 011000 111010 010100 111110 010100 000111 101100 101111
.....
How DES works:
Step 2: Encode each 64-bit block of data.
• Prepare the plain text into 64-bit length blocks; then continue with encoding
• Step2.1: perform initial permutation, IP on a block: e.g. use the following table:
58 50 42 34 26 18 10 2 60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6 64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1 59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5 63 55 47 39 31 23 15 7
• Applying the initial permutation to the block of text M:
M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
IP = 1100 1100 0000 0000 1100 1100 1111 1111 1111 0000 1010 1010 1111 0000 1010 1010

• Step2.2: divide the permuted block IP into a left half L0 and a right half R0 of 32 bits each.
• Example: From IP, we get L0 and R0
L0 = 1100 1100 0000 0000 1100 1100 1111 1111
R0 = 1111 0000 1010 1010 1111 0000 1010 1010
How DES works:
• Step2.3: proceed through 16 iterations, for 1<=n<=16, using a function f
which operates on two blocks--a data block of 32 bits and a key Kn of 48 bits--
to produce a block of 32 bits. Let + denote XOR addition, (bit-by-bit addition
modulo 2). Then for n going from 1 to 16 we calculate
Ln = Rn-1
Rn = Ln-1 + f(Rn-1,Kn)
• Example: For n = 1, we have
• K1 = 000110 110000 001011 101111 111111 000111 000001 110010
L1 = R0 = 1111 0000 1010 1010 1111 0000 1010 1010
R1 = L0 + f(R0,K1)
• how does the function f work?
How DES works:
• To calculate f, we first expand each block Rn-1 from 32 bits to 48 bits. This is
done by using a selection table that repeats some of the bits in Rn-1 .
• We'll call the use of this selection table the function E.
• Thus E(Rn-1) has a 32 bit input block, and a 48 bit output block.
• 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:
How DES works:
• Example: We calculate E(R0) from R0 as follows:
• R0 = 1111 0000 1010 1010 1111 0000 1010 1010
E(R0) = 011110 100001 010101 010101 011110 100001 010101 010101
• Next in the f calculation, we XOR the output E(Rn-1) with the key Kn:
• Example: For K1 , E(R0), we have
• K1 = 000110 110000 001011 101111 111111 000111 000001 110010
E(R0) = 011110 100001 010101 010101 011110 100001 010101 010101
K1+E(R0) = 011000 010001 011110 111010 100001 100110 010100 100111
• We have not yet finished calculating the function f,
How DES works:
Function f …
• To this point we have expanded Rn-1 from 32 bits to 48 bits, using the selection table, and
XORed the result with the key Kn .
• We now have 48 bits, or eight groups of six bits.
• We now do something strange with each group of six bits: we use them as addresses in
tables called "S boxes".
• Each group of six bits will give us an address in a different S box.
• Located at that address will be a 4 bit number. This 4 bit number will replace the original
6 bits.
• The net result is that the eight groups of 6 bits are transformed into eight groups of 4 bits
(the 4-bit outputs from the S boxes) for 32 bits total.
• Write the previous result, which is 48 bits, in the form:
• Kn + E(Rn-1) =B1B2B3B4B5B6B7B8, where each Bi is a group of six bits. We now calculate
• S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
• where Si(Bi) refers to the output of the i-th S box.
How DES works: S-box value calculation
• If S1 is the function defined in this table and B is a block of 6
bits, then S1(B) is determined as follows:
• The first and last bits of B represent in base 2 a number in
the decimal range 0 to 3 (or binary 00 to 11). let that number
be i.
• The middle 4 bits of B represent in base 2 a number in the
decimal range 0 to 15 (binary 0000 to 1111). Let that number
be j.
• Look up in the table the number in the i-th row and j-th
column. It is a number in the range 0 to 15 and is uniquely
represented by a 4 bit block. That block is the output S1(B) of
S1 for the input B.
• For example, for input block B = 011011 the first bit is "0"
and the last bit "1" giving 01 as the row. This is row 1.
• The middle four bits are "1101". This is the binary equivalent
of decimal 13, so the column is column number 13.
• In row 1, column 13 appears 5. This determines the output;
5 is binary 0101, so that the output is 0101. Hence
S1(011011) = 0101.
How DES works: Permutation on S-box
• Example: For the first round, we obtain as the output of the eight S boxes:
• K1 + E(R0) = 011000 010001 011110 111010 100001 100110 010100 100111.
• S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) = 0101 1100 1000 0010 1011 0101
1001 0111
• The final stage in the calculation of f is to do a permutation P of the S-box output to
obtain the final value of f:
• f = P(S1(B1)S2(B2)...S8(B8))
• Let The permutation P is(16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10 2 8 24 14 32
27 3 9 19 13 30 6 22 11 4 25)
• from the output of the eight S boxes:
• S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) = 0101 1100 1000 0010 1011 0101
1001 0111 we get
• f = 0010 0011 0100 1010 1010 1001 1011 1011
• Finally we have output of function F

f = 0010 0011 0100 1010 1010 1001 1011 1011


How DES works: Final stage -- do the same steps 16 times

• R1 = L0 + f(R0 , K1 )
= 1100 1100 0000 0000 1100 1100 1111 1111
+ 0010 0011 0100 1010 1010 1001 1011 1011
= 1110 1111 0100 1010 0110 0101 0100 0100
L1 = R0 = 1111 0000 1010 1010 1111 0000 1010 1010
R1 = 1110 1111 0100 1010 0110 0101 0100 0100

In the next round, we will have L2 = R1, which is the block we just calculated,
and then we must calculate R2 = L1 + f(R1, K2), and so on for 16 rounds.
At the end of the sixteenth round we have the blocks L16 and R16.
We then reverse the order of the two blocks into the 64-bit block
• R16L16
How DES works: Final Permutation
• apply a final permutation
• Let the permutation is defined by (40 8 48 16 56 24 64 32 39 7 47 15 55 23 63 31 38 6 46
14 54 22 62 30 37 5 45 13 53 21 61 29 36 4 44 12 52 20 60 28 35 3 43 11 51 19 59 27 34 2
42 10 50 18 58 26 33 1 41 9 49 17 57 25)
• Example: If we process all 16 blocks using the method defined previously, we get, on the
16th round,
• L16 = 0100 0011 0100 0010 0011 0010 0011 0100
R16 = 0000 1010 0100 1100 1101 1001 1001 0101
• We reverse the order of these two blocks and apply the final permutation to
R16L16 = 00001010 01001100 11011001 10010101 01000011 01000010 00110010 00110100
• Which gives:
IP-1 = 10000101 11101000 00010011 01010100 00001111 00001010 10110100 00000101
• which in hexadecimal format is 85E813540F0AB405.
• Thus, the encrypted form of M = 0123456789ABCDEF, with key K = 133457799BBCDFF1
is: C = 85E813540F0AB405.
How DES Works… summary
How secure is DES:
• Is it possible to crack DES?
• If yes, how much does it cost?
• 56-bit key means around 72 quadrillion keys
• DES was found out to be cracked by brute-force
• Dedicated system capable of brute-forcing DES keys in less than 5 days
was created in 1998
• Current machines (in parallel) – can do it in an hour
2. Toward triple DES
• Diffie and Hellman outlined a "brute force" attack on DES. (By "brute force" is
meant that you try as many of the 2^56 possible keys as you have to before
decrypting the ciphertext into a sensible plaintext message.) They proposed a
special purpose "parallel computer using one million chips to try one million
keys each" per second, and estimated the cost of such a machine at $20
million.
• Under the direction of John Gilmore of the EFF, a team spent $220,000 and
built a machine that can go through the entire 56-bit DES key space in an
average of 4.5 days. On July 17, 1998, they announced they had cracked a 56-
bit key in 56 hours. The computer, called Deep Crack, uses 27 boards each
containing 64 chips, and is capable of testing 90 billion keys a second.
2. Toward triple DES …
• Despite this, as recently as June 8, 1998, Robert Litt, principal associate
deputy attorney general at the Department of Justice, denied it was possible
for the FBI to crack DES: "Let me put the technical problem in context: It took
14,000 Pentium computers working for four months to decrypt a single
message . . . . We are not just talking FBI and NSA [needing massive
computing power], we are talking about every police department."
• Responded cryptograpy expert Bruce Schneier: " . . . the FBI is either
incompetent or lying, or both." Schneier went on to say: "The only solution
here is to pick an algorithm with a longer key; there isn't enough silicon in
the galaxy or enough time before the sun burns out to brute- force triple-
DES" (Crypto-Gram, Counterpane Systems, August 15, 1998).
• And in 1999 distributed.net and electronic frontier foundation collaborated
to break DES key in 22 hours and 15 minutes(the machine costs around
$250,000).
2. Triple DES
▪ Triple Data Encryption Standard (TDES) is upgraded or improved
version of DES which is a symmetric cryptographic approach in which
DES is used to each block three times which scrambles the plain text to
cipher text.

▪ Triple DES runs three times gradual than DES, but is much safer if
used properly.

▪ The procedure for decrypting object is the similar as the procedure for
encryption, other than it is executed in reverse. Like DES, data is
encrypted and decrypted in 64- bit chunks
12/14/2024 Computer and Network Security 37 By: Mechal T.
2. Triple DES …
2. Triple DES …
Next:
Advanced Encryption Standard(AES)
AES

▪ The more popular and widely adopted symmetric encryption


algorithm likely to be encountered nowadays is the Advanced
Encryption Standard (AES).
▪ It is found to be at least six times faster than triple DES.
▪ A replacement for DES was needed as its key size was too small.
▪ With increasing computing power, it was considered vulnerable against
exhaustive key search attack.
▪ Triple DES was designed to overcome this drawback but it was found
slow.

12/14/2024 41
AES…
▪ The features of AES are as follows:
▪ Symmetric key symmetric block cipher
▪ 128-bit data, 128/192/256-bit keys

▪ Stronger and faster than Triple-DES

12/14/2024 42
AES…
▪ The features of AES are as follows:
▪ Symmetric key symmetric block cipher
▪ 128-bit data, 128/192/256-bit keys

▪ Stronger and faster than Triple-DES

Note: AES relies on substitution-permutation network principle which


means it is performed using a series of linked operations which involves
replacing and shuffling of the input data.

12/14/2024 43
AES…
▪ Working of the cipher

▪ AES performs operations on bytes of data rather than in bits. Since the
block size is 128 bits, the cipher processes 128 bits (or 16 bytes) of the
input data at a time.

▪ The number of rounds depends on the key length as follows :


▪ 128 bit key – 10 rounds
▪ 192 bit key – 12 rounds

▪ 256 bit key – 14 rounds

12/14/2024 44
AES Encryption Process

Stage 3
Stage 2
Stage 1
AES Structure
AES…
▪ Creation of Round keys :

▪ A Key Schedule algorithm is used to calculate all the round keys from
the key.

▪ So the initial key is used to create many different round keys which will
be used in the corresponding round of the encryption.

▪ But before that, let’s see how the 4 steps of each round are performed

12/14/2024 47
AES…
▪ Encryption :

▪ AES considers each block as a 16 byte (4 byte x 4 byte = 128 ) grid in a


column major arrangement:

b0 b4 b8 b12

b1 b5 b9 b13

b2 b6 b10 b14

b3 b7 b11 b15

12/14/2024 48
AES…
▪ Each round comprises of 4 steps :
▪ SubBytes

▪ ShiftRows

▪ MixColumns

▪ Add Round Key

▪ The last round doesn’t have the MixColumns round.

▪ The SubBytes does the substitution, and ShiftRows and MixColumns


performs the permutation in the algorithm.

12/14/2024 49
AES…

▪ SubBytes : forward substitute byte transformation


▪ This step implements the substitution.
▪ In this step each byte is substituted by another byte.
▪ Its performed using a lookup table also called the
S-box.
▪ This substitution is done in a way that a byte is
never substituted by itself and also not substituted
by another byte which is a compliment of the 16x16 matrix of
byte values -
current byte. permutation of
all possible 256
▪ The result of this step is a 16 byte (4 x 4 ) matrix 8-bit values
like before.
▪ x=leftmost 4 bits, y=rightmost 4 bits
12/14/2024 50
AES…
▪ ShiftRows :

▪ This step is just as it sounds. Each row is shifted a particular number of


times.
▪ The first row is not shifted

▪ The second row is shifted once to the left.

▪ The third row is shifted twice to the left.

▪ The fourth row is shifted thrice to the left.

12/14/2024 51
AES…
▪ ShiftRows :

(A left circular shift is performed.)

b0 b4 b8 b12 b0 b4 b8 b12

b1 b5 b9 b13 b5 b9 b13 b1

b2 b6 b10 b14 b10 b14 b2 b6

b3 b7 b11 b15 b15 b3 b7 b11

12/14/2024 52
AES…
▪ MixColumns :
▪ This step is basically a matrix
multiplication. Each column is
multiplied with a specific matrix and
thus the position of each byte in the
column is changed as a result.
▪ This step is skipped in the last round.

12/14/2024 53
AES…
▪ Add Round Keys :

▪ Now the resultant output of the previous stage is XOR-ed with the corresponding
round key.

▪ Here, the 16 bytes is not considered as a grid but just as 128 bits of data.

▪ After all these rounds 128 bits of encrypted data is given back as output.

▪ This process is repeated until all the data to be encrypted undergoes this process.

12/14/2024 54
AES Round
AES Key Expansion

➢ takes 128-bit (16-byte) key and expands


into array of 44/52/60 32-bit words
➢ start by copying key into first 4 words
➢ then loop creating words that depend on
values in previous & 4 places back
⚫ in 3 of 4 cases just XOR these together
⚫ 1st word in 4 has rotate + S-box + XOR round
constant on previous, before XOR 4th back
AES Key Expansion
Key Expansion Rationale

➢ designed to resist known attacks


➢ design criteria included
⚫ knowing part key insufficient to find many more
⚫ invertible transformation
⚫ fast on wide range of CPU’s
⚫ use round constants to break symmetry
⚫ diffuse key bits into round keys
⚫ enough non-linearity to hinder analysis
⚫ simplicity of description
AES Example Key
Expansion

Round constants:
(Rcon[i] = xi-1)
i Rcon[i]
1 01 00 00 00
2 02 00 00 00
3 04 00 00 00
4 08 00 00 00
5 10 00 00 00
6 20 00 00 00
7 40 00 00 00
8 80 00 00 00
9 1B 00 00 00
10 36 00 00 00
Digital Signatures
Digital Signature
▪ A digital signature is a mathematical technique which validates the
authenticity and integrity of a message, software or digital documents.

▪ It allows us to verify the author name, date and time of signatures, and
authenticate/signify agreement/ the message contents.

▪ The digital signature offers far more inherent security and intended to
solve the problem of tampering and impersonation (Intentionally copy
another person's characteristics) in digital communications.

▪ It is best provided by public-key cryptography


12/14/2024 61
Digital Signature Model

• Signing data by
encryption – too
much overhead

• More efficient – use


of hash functions
(compute fixed length
“fingerprint of the
message), which are
smaller than message
Digital Signature Model
Basic goals of cryptography
Message integrity /
Message privacy
authentication

Message authentication
Symmetric keys Symmetric encryption
codes (MAC)

Asymmetric encryption
Asymmetric keys (a.k.a. public-key Digital signatures
encryption)

64
Digital Signature…

▪ Application of Digital Signature


▪ The important reason to implement digital signature to communication is:
▪ Authentication
▪ Non-repudiation
▪ Integrity
▪ E.g. public key certification, i.e., certifying that a public key belongs to a
specific entity - used in many popular secure networking protocols,
including IPsec and SSL and in e-commerce (see example in Kurose R)

12/14/2024 65
Digital Signature…

▪ A digital signature consists of three algorithms:


▪ Key Generation Algorithm
▪ Signing Algorithm
▪ Signature Verifying Algorithm

12/14/2024 66
Digital Signature…
1. Key generation algorithm

▪ The key generation algorithm selects private key randomly from a set of possible
private keys.

▪ This algorithm provides the private key and its corresponding public key.

2. Signing algorithm

▪ A signing algorithm produces a signature for the document.

3. Signature verifying algorithm

▪ A signature verifying algorithm either accepts or rejects the document's authenticity.

12/14/2024 67
Digital Signature…

▪ How digital signatures work

▪ Digital signatures are created and verified by using public key cryptography, also
known as asymmetric cryptography.

▪ By the use of a public key algorithm, such as RSA, one can generate two keys that are
mathematically linked- one is a private key, and another is a public key.

▪ The user who is creating the digital signature uses their own private key to encrypt the
signature-related document.

▪ There is only one way to decrypt that document: with the use of signer's public key.

12/14/2024 68
Digital Signature…
▪ How digital signatures work

▪ This technology requires all the parties to trust that the individual who
creates the signature has been able to keep their private key secret.

▪ If someone has access the signer's private key, there is a possibility that
they could create fraudulent signatures in the name of the private key
holder.

▪ Certification Authorities (CAs) – bind public key to a particular entity;


validate identities and issue certificates

12/14/2024 69
Digital Signature…

▪ The steps which are followed in creating a digital signature are:

Step 1. Select a file to be digitally signed.

Step 2. The hash value of the message or file content is calculated. This
message or file content is encrypted by using a private key of a sender
to form the digital signature.
Step 3. Now, the original message or file content along with the digital
signature is transmitted.

12/14/2024 70
Digital Signature…
▪ The steps . . .

Step 4. The receiver decrypts the digital signature by using a public


key of a sender.
Step 5. The receiver now has the message or file content and can
compute it.
Step 6. Comparing these computed message or file content with the
original computed message. The comparison needs to be the same for
ensuring integrity.

12/14/2024 71
Diffie-Hellman Key Exchange

▪ Diffie-Hellman algorithm is one of the most important algorithms used


for establishing a shared secret key securely.

▪ At the time of exchanging data over a public network, we can use the
shared secret for secret communication.

▪ We use an elliptic curve for generating points and getting a secret key
using the parameters.

12/14/2024 72
Public Key Cryptography
Public Key Cryptography
• Diffie and Hellman [1976] – proposed public key and private key cryptography
• Used in message authentication and key distribution
• Classical cryptography requires the sender and recipient to share a common key.
Public key cryptography does not.
• If the encipherment key is public, to send a secret message simply encipher the
message with the recipient’s public key. Then send it.
• The recipient can decipher it using his private key
• A public key cryptosystem must meet the following three conditions:
• It must be computationally:
• easy to encipher or decipher a message given the appropriate key.
• infeasible to derive the private key from the public key.
• infeasible to determine the private key from a chosen plaintext attack.
• E.g. The Riv.Sham.Adle. cipher, which provides both secrecy and authentication.
Diffie-Hellman Key Exchange…
▪ Working Principle

1. We will take four variables, i.e., P (prime), G (the primitive root


of P), and a and b (private values).
• primitive root of a prime number p is one whose powers generate all the
integers from 1 to p - 1. That is, if a is a primitive root of the prime number p,
then the numbers: a mod p, a2 mod p, ... , ap-1 mod p are distinct and consist
of the integers from 1 through p- 1 in some permutation.

2. The variables P and G both are publicly available. The sender selects a
private value, either a or b, for generating a key to exchange publicly.
The receiver receives the key, and that generates a secret key, after which
the sender and receiver both have the same secret key to encrypt.
12/14/2024 75
Diffie-Hellman Key Exchange…
▪ Steps..
Steps User1 User2
1. P, G => available public keys. P, G => available public keys.
2. a is selected as a private key. b is selected as a private key.
3. Eq. to generate key: x=Ga mod P Eq. to generate key: y=Gb mod P
4. After exchanging keys, user1 receives After exchanging keys, user2 receives
key y. key x.
5. User1 generates a secret key by using User2 generates a secret key by using
the received key y: ka=ya mod P the received key x: kb=xb mod P

12/14/2024 76
Diffie-Hellman Key Exchange…
▪ Algebraically, 5th step can be shown as follows:

▪ ka=kb

▪ It means that both the users have the symmetric secret key to encrypt.

▪ Example:
1. User1 and User2 get public keys P = 33 and G = 8.
2. User1 selects a as a private key, i.e., 3, and User2 selects b as a
private key, i.e., 2.
3. User1 calculate the public value: x=(83 mod 33)=512mod33=17

12/14/2024 77
Diffie-Hellman Key Exchange…
4. User2 calculate the public value:
y=(82 mod33)=64mod33= 31

5. User1 and User2 exchange public keys, i.e., 17 and 31.

6. User1 receives public key y = 31 and User2 receives public key x = 17.
7. User1 and User2 calculate symmetric keys:

User1: ka=ya modP=313 mod33=29791mod33=25


User2:kb=xb modP=172 mod33=289mod33=25

8. 25 is the shared secret.

12/14/2024 78
Hash Functions

• A cryptographic hash function is a hash


function that takes an arbitrary block of
data and returns a fixed-size bit string,
• The cryptographic hash value, such that
any (accidental or intentional) change to
the data will (with very high probability)
change the hash value.
• The data to be encoded are often called
the message, and the hash value is
sometimes called the message digest or
simply digest.
Hash Functions

• The ideal cryptographic hash function has four main properties:

✓ it is easy to compute the hash value for any given message

✓ it is infeasible to generate a message that has a given hash

✓ it is infeasible to modify a message without changing the hash

✓ it is infeasible to find two different messages with the same hash.


Hash Function - Examples
Secure Hash Algorithm(SHA-1)
▪ SHA-1 or Secure Hash Algorithm 1 is a cryptographic hash function
which takes an input and produces a 160-bit (20-byte) hash value.

▪ This hash value is known as a message digest.

▪ This message digest is usually then rendered as a hexadecimal number


which is 40 digits long.

▪ SHA-1 is now considered insecure since 2005.

▪ Major tech giants browsers like Microsoft, Google, Apple and Mozilla
have stopped accepting SHA-1 SSL certificates by 2017.

12/14/2024 82
Secure Hash Algorithm(SHA-1) …
▪ Because of the successful attacks on MD5, SHA-0 and theoretical
attacks on SHA-1, NIST perceived a need for an alternative,
dissimilar cryptographic hash, which became SHA-3.

▪ In October 2012, the National Institute of Standards and


Technology (NIST) chose the Keccak algorithm as the new SHA-3
standard.

12/14/2024 83
Summary

➢ have considered:
⚫ the AES selection process
⚫ the details of Rijndael – the AES cipher

⚫ looked at the steps in each round

⚫ the key expansion

⚫ implementation aspects

➢ Asymmetric Encryption
• Digital signature
• Hash Function
Please read about RSA and DSA digital
signature algorithm

12/14/2024 85

You might also like