ISS Complete Notes
ISS Complete Notes
On
Course Objective:
• To impart the basic security concepts, concerns and vulnerabilities.
• To understand mathematics behind cryptography.
• To understand different types of cryptosystems.
• To create awareness for the design of various cryptographic algorithms.
• To analyze different types of attacks.
Course Outcomes:
After successful completion of course student should be able to:
Bloom’s
CO Description Taxonomy
Level
Impart the basic concepts of Cryptography and Network Security, and Understand
6CS4-03.1 relate it to mathematical concepts of substitution and transposition and Apply
techniques along with types of ciphers. (Level 2 and 3)
Acquire the knowledge of various modes of block of ciphers techniques and Understand
6CS4-03.2
design the concepts of DES and AES algorithms. (Level 2)
Understand the various private and public key algorithms such as RSA,
Understand
6CS4-03.3 Elgamal etc., implemented in network security along with its encryption and
(Level 2 and 3)
decryption.
Acquire the knowledge of message authentication using well-known
Acquire
6CS4-03.4 signature scheme. And also describe existing authentication protocols such
(Level 2)
as SHA, MD5.
Acquire the knowledge of key distribution protocols with respect to X.509,
Acquire
6CS4-03.5 PGP protocols, and also Understand the various security aspects with regard
(Level 3 and 5)
to SSL and HTTPS.
Evaluate the various types of cryptography techniques and implement a Evaluate
6CS4-03.6
problem-based solution in computer system. (Level 5)
CO-PO mapping:
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
6CS4-03.1 3 2 1
6CS4-03.2 1 1
6CS4-03.3 1
6CS4-03.4 2 2 1 1
6CS4-03.5 2 2
6CS4-03.6 3 2 2 1 2
University Syllabus
Text Books:
1. Cryptography and Network Security: 4th Edition, Atul Kahate, McGraw-Hill.
2. Cryptography and Network Security: Principles and Practice, 7th Edition, William
Stallings, Pearson Education.
3. Cryptography and Network Security, 3rd Edition, Behrouz A. Fourouzan and Debdeep
Mukhopadhyay, McGraw-Hill.
Reference Books:
1. Fundamentals of Network Security by Eric Maiwald (Dreamtech press)
2. Principles of Information Security, Whitman, Thomson.
3. Introduction to Cryptography, Buchmann, Springer.
4. Applied Cryptography, 2nd Edition, Bruce Schneier, Johnwiley & Sons.
Unit 1
Basics of Information and Network Security
• In daily life we use information for various purposes and use network for communication and exchange
information between different parties.
• In many cases these information are sensitive so we need to take care that only authorized party can get that
information.
• For maintaining such privacy we require some mechanism or physical device which ensures that it is safe.
Such mechanism or physical devices are known as security system.
• Computer Security: The protection afforded to an automated information system in order to attain the
applicable objectives of preserving the integrity, availability, and confidentiality of information system
resources.
• This definition of computer security introduces three key objectives that are at the heart of computer security:
1. Confidentiality: It covers two concepts
Data Confidentiality: Assures that private or confidential information is not made available or
disclosed to unauthorized individuals.
Privacy: Assures that individuals control or influence what information related to them may be
collected and stored and by whom and to whom that information may be disclosed.
2. Integrity: It covers two concepts
Data Integrity: Assures that information and programs are changed only in a specified and
authorize manner.
System Integrity: Assures that a system performs its intended function in an unimpaired manner, free from
deliberate or inadvertent unauthorized manipulation of the system.
3. Availability: Assures that systems work promptly and service is not denied to authorize user.
• Unconditionally secure algorithm: An algorithm or an encryption scheme is unconditionally secure if the
attacker cannot obtain the corresponding plaintext from ciphertext no matter how much ciphertext is available.
• Computationally secure algorithm: An encryption scheme is said to be computationally secure if either of
the following criteria is met:
o The cost of breaking the cipher exceeds the value of the encrypted information.
o The time required to break the cipher exceeds the useful lifetime of the information.
• Threat: A potential for violation of security, which exists when there is a circumstance, capability,
action, or event that could breach security and cause harm. That is, a threat is a possible danger that might exploit
vulnerability.
Security Attacks
• Security Attacks: An attack is an action that comprises the information or network security.
• There are two types of attacks:
1. Passive Attack
2. Active Attack
Passive Attack
• Passive Attack: The attacker only monitors the traffic attacking the confidentiality of the data. It
contains release of message contents and traffic analysis (in case of encrypted data).
1. Release of message contents:
o The release of message contents is easily understood.
o A telephone conversation, an electronic mail message, and a transferred file may contain sensitive
or confidential information.
o We would like to prevent an opponent from learning the contents of these transmissions.
2. Traffic analysis:
o A second type of passive attack, traffic analysis.
o Suppose that we had a way of masking the contents of messages or other information.
o Even if they captured the message, could not extract the information from the message.
o The common technique for masking contents is encryption.
o If we had encryption protection in place, an opponent might still be able to observe the pattern of
these messages.
o The opponent could determine the location and identity of communicating hosts and could observe
the frequency and length of messages being exchanged.
o This information might be useful in guessing the nature of the communication that was taking place.
o Passive attacks are very difficult to detect because they do not involve any alteration of the data.
o Typically, the message traffic is send and received in an apparently normal fashion and the sender
nor receiver is aware that a third party has read the messages or observed the traffic pattern.
Active attack
• Active attack: Attacker tries to alter transmitted data. It includes masquerade, modification, replay and
denial of service.
1. Masquerade: A masquerade takes place when one entity pretends to be a different entity (Figure a). A
masquerade attack usually includes one of the other forms of active attack.
2. Replay: Replay involves the passive capture of a data unit and its subsequent retransmission to produce
an unauthorizedeffect.
3. Modification of messages:
o Modification of messages simply means that some portion of a legitimate message is altered, or that
messages are delayed or reordered, to produce an unauthorized effect (Figure c).
o For example, a message meaning "Allow John Smith to read confidential file accounts" is
modified to mean "Allow Fred Brown to read confidential file accounts."
4. Denial of service:
o The denial of service prevents or inhibits the normal use or management of communications
facilities.
o This attack may have a specific target; for example, an entity may suppress all messages
directed to a particular destination (e.g., the security audit service).
o Another form of service denial is the disruption of an entire network, either by disabling the
network or by overloading it with messages so as to degrade performance.
Security services
• A security service is a processing or communicating service that can prevent or detect the above-
mentioned attacks. Various security services are:
o Authentication: the recipient should be able to identify the sender, and verify that the sender, who
claims to be the sender, actually did send the message.
o Data Confidentiality: An attacker should not be able to read the transmitted data or extract data in case of
encrypted data. In short, confidentiality is the protection of transmitted data from passive attacks.
o Data Integrity: Make sure that the message received was exactly the message the sender sent.
o Nonrepudiation: The sender should not be able to deny sending the should message. The receiver
not be able to deny receiving the message.
Cryptography
• Cryptography: The area of study containing the principles and methods of transforming an
intelligible message into one that is unintelligible, and then retransforming that message back to its original form.
• Cryptographic systems are characterized along three independent dimensions.
1. The types of operations used for transforming plaintext to ciphertext. All encryption algorithms are
based on two general principles substitution, and transposition. Basic requirement is that no
information be lost. Most systems referred to as product system, involves multiple stages of
substitutions and transpositions.
2. The number of keys used. If both sender and receiver use the same key, the system is referred to as symmetric,
single-key, secret-key, or conventional encryption. If the sender and receiver use different keys the
system is referred to as asymmetric, two-key, or public-key encryption.
3. The way in which the plaintext is processed. A block cipher process a block at a time and produce an output
block for each input block. A stream cipher process the input element continuously, producing output
one element at a time, as it goes along.
Brute-force attack
• This type of attack becomes impractical as the key size increases as trying all the possible
alternative keys for a very large key may take a huge amount of time.
• For example, for a binary key of 128 bits, 2128 keys are possible which would require around 5 X1024 years at
the rate of 1 decryption per microsecond (current machine’s speed).
• The Data Encryption Standard (DES) algorithm uses a 56-bit key a 128-bit key is used in AES.
• With massively parallel systems, even DES is also not secure against Brute Force attack.
• AES with its 128-bit key is secure since the time required to break it makes it impractical to try Brute-
Force attack
Substitution Techniques
• Various conventional encryption schemes or substitution techniques are as under:
Caesar cipher
• The encryption rule is simple; replace each letter of the alphabet with the letter standing 3 places further
down the alphabet.
• The alphabet is wrapped around so that Z follows A.
• Example:
Plaintext: MEET ME AFTER THE PARTY
Ciphertext: PHHW PH DIWHU WKH SDUWB
• Here, the key is 3. If different key is used, different substitution will be obtained.
• Mathematically, starting from a=0, b=1 and so on, Caesar cipher can be written as:
E(e) = (e + k) mod (26)
D(C) = (C – k) mod (26)
• This cipher can be broken
o If we know one plaintext-cipher text pair since the difference will be same.
o By applying Brute Force attack as there are only 26 possible keys.
Playfair Cipher
• In this technique multiple (2) letters are encrypted at a time.
• This technique uses a 5 X 5 matrix which is also called key matrix.
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Hill Cipher
• This cipher is based on linear algebra.
• Each letter is represented by numbers from 0 to 25 and calculations are done m dulo 26.
• This encryption algorithm takes m successive plaintext letters and substitutes them with m cipher text letters.
• The substitution is determined by m linear equations. For m = 3, the system can be described as:
c1 = (k11 e1 + k12 e2 + k13 e3 ) Nod 26 c2
= (k21 e1 + k22 e2 + k23 e3 ) Nod 26 c3 =
(k31 e1 + k32 e2 + k33 e3 ) Nod 26
• This can also be expressed in terms of row vectors and matrices.
k11 k12 k13
(c1 c2 c3 ) = (e1 e2 e3 ) (k21 k22 k23) Nod 26
k31 k32 k33
Where C and P are row vectors of length 3 representing the plaintext and cipher text, and K is a 3 X 3 matrix
representing the encryption key
• Key is an invertible matrix K modulo 26, of size m. For example:
17 17 5 4 19 15
K = (21 18 21) K–1 = (15 17 6 )
2 2 19 24 0 17
• Encryption and decryption can be given by the following formulae:
Encryption: C = PK Nod 26
Decryption: P = CK –1 Nod 26
• The strength of the Hill cipher is that it completely hides single-letter frequencies.
• Although the Hill cipher is strong against a cipher text-only attack, it is easily broken with a known
plaintext attack.
o Collect m pair of plaintext-cipher text, where m is the size of the key.
o Write the m plaintexts as the rows of a square matrix P of size m.
o Write the m cipher texts as the rows of a square matrix C of size m.
o We have that C=PK mod 26.
o If P is invertible, then K=P-1C mod 26,
o If P is not invertible, then collect more plaintext-cipher text pairs until an invertible P is obtained.
Vernam Cipher
• This system works on binary data (bits) rather than letters.
• The technique can be expressed as follows:
Ci = Pi ⊕ Ki
Where
Pi = ith binary digit of plaintext.
Ki = ith binary digit of key.
Ci = ith binary digit of ciphertext.
⊕ = exclusive-or (XOR) operation
• Thus, the ciphertext is generated by performing the bitwise XOR of the plaintext and the key.
• Decryption simply involves the same bitwise operation:
Pi = Ci ⊕ Ki
• The essence of this technique is the means of construction of the key.
• It was produced by the use of a running loop of tape that eventually repeated the key, so that in fact the system
worked with a very long but repeating keyword.
• Although such a scheme has cryptanalytic difficulties, but it can be broken with a very long ciphertext or known
plaintext as the key is repeated.
One-Time Pad
• In this scheme, a random key that is as long as the message is used.
• The key is used to encrypt and decrypt a single message, and then is discarded. Each new message requires a
new key of the same length as the new message.
• This scheme is unbreakable.
• It produces random output that bears no statistical relationship to the plaintext.
• Because the ciphertext contains no information whatsoever about the plaintext, there is simply no way to break
the code.
• For any plaintext of equal length to the ciphertext, there is a key that produces that plaintext.
• Therefore, if you did an exhaustive search of all possible keys, you would e d up with many legible
plaintexts, with no way of knowing which the intended plaintext was.
• Therefore, the code is unbreakable.
• The security of the one-time pad is entirely due to the randomness of the key.
• The one-time pad offers complete security but, in practice, has two fundamental difficulties:
o There is the practical problem of making large quantities of random keys. Any heavily used system might
require millions of random characters on a regular basis. Supplying truly random characters in this volume is
a significant task.
o Another problem is that of key distribution and protection. For every message to be sent, a key of equal
length is needed by both sender and receiver.
• Because of these difficulties, the one-time pad is used where very high security is required.
• The one-time pad is the only cryptosystem that exhibits perfect secrecy.
Transposition Techniques
• A very different kind of mapping is achieved by performing some sort of permutation on the plaintext letters.
This technique is referred to as a transposition cipher.
• The simplest such cipher is the rail fence technique.
m e m a t r h p r ye t
e f e t e o at
Steganography
• Plaintext message may be hidden in one of two ways.
o Conceal the existence of the message-Steganography.
o Render the message unintelligible to outsiders by various transformations of the text- Cryptography
• A simple but time consuming form of steganography is the one in which an arrangement of words or letters
within an apparently normal text spells out the real message.
• For example, the sequence of first letters of each word of the overall message spells out the hidden message.
• Some other techniques that have been used historically are listed below:
o Character marking: Selected letters of printed or typewritten text are overwritten in pencil. The marks
are ordinarily not visible unless the paper is held at an angle to bright light.
o Invisible ink: A number of substances can be used for writing but leave no visible trace until heat or some
chemical is applied to the paper.
o Pin punctures: Small pin punctures on selected letters are ordinarily not visible unless the paper is held up in
front of a light.
o Typewriter correction ribbon: Used between lines typed with a black ribbon, the results of
typing with the correction tape are visible only under a strong light.
• Although these techniques may seem ancient, they have modern equivalents.
• For example, suppose an image has a resolution of 2048 X 3072 pixels where each pixel is denoted by 24 bits
(Kodak CD photo format).
• The least significant bit of each 24-bit pixel can be changed without greatly affecting the quality of the image.
• The result is that you can hide a 2.3-megabyte message in a single digital snapshot.
• There are now a number of software packages available that take this type of approach to steganography.
• Steganography has a number of drawbacks when compared to encryption.
o It requires a lot of overhead to hide a relatively few bits of information.
o Once the system is discovered, it becomes virtually worthless.
• The advantage of steganography is that it can be employed by parties who have something to lose if the fact of
their secret communication is discovered.
Rotor Machines
• The basic principle of the rotor machine is illustrated in figure. The machine consists of a set of
independently rotating cylinders through which electrical pulse can flow.
• Each cylinder has 26 input and 26 output pins, with internal wiring that connect each input pin to unique
output pin.
• If we associate each input and output pin with a letter of the alphabet, then a single cylinder defines a
monoalphabetic substitution.
• If we use multiple cylinders then we will obtain polyalphabetic substitution.
Unit 2
Block Cipher Principles
Stream Cipher and Block Cipher
• A stream cipher is one that encrypts a data stream one bit or one byte at a time. Example of stream cipher are
the autokeyes vigenere cipher and vernam cipher.
• A Block Cipher is one in which a block of plaintext is treated as a whole and used to produce a cipher text block
of equal length. Example of block cipher is DES.
• A 4-bit input produce one of 16 possible input states, which is mapped by substitution cipher into one of unique
16 possible output states, each of which is represented by 4-bit ciphertext.
• The encryption and decryption mapping can be defined by tabulation, as shown in table. This is the most general
form of block cipher and can be used to define any reversible mapping between plaintext and ciphertext.
• Feistel refers to this as the ideal block cipher, because it allows for the maximum number of possible
encryption mappings from the plaintext block.
• But there are practical problem with ideal block cipher is if we use small block size such as n=4 then it is
vulnerable to statistical analysis of the plain text.
• If n is sufficiently large and an arbitrary reversible substitution between plaintext and ciphertext is allowed
then statistical analysis is infeasible.
• Ideal block cipher is not practical for large block size according implementation and performance point of view.
• For such transformation mapping itself is a key and we require nX2n bits for n bit ideal block cipher which is not
practical.
• In considering these difficulties, Feistel points out that what is needed is an approximation to the ideal cipher
system for large n, built up out of components that are easily realizable.
The exact realization of a Feistel network depends on the choice of the following parameters:
• Block size: Larger block sizes mean greater security but reduced encryption/decryption speed for a given algorithm.
Traditionally, a block size of 64 bits is used which gives enough security without greatly affecting the
speed.
• Key size: Larger key size means greater security but may decrease encryption/ decryption speed. The greater
security is achieved by greater resistance to brute-force attacks and greater confusion. Key sizes of 64 bits or less are
now widely considered to be inadequate, and 128 bits has become a common size.
• Number of rounds: The essence of the Feistel cipher is that a single round offers inadequate security but that
multiple rounds offer increasing security. A typical size is 16 rounds.
• Sub key generation algorithm: Greater complexity in this algorithm leads to greater difficulty of
cryptanalysis.
• Round function F: Again, greater complexity generally means greater resistance to cryptanalysis.
• There are two other considerations in the design of a Feistel cipher:
• Fast software encryption/decryption: In many cases, encryption is embedded in applications
implementation (as software). Accordingly, the speed of execution of the algorithm becomes a concern.
• Ease of analysis: Although we would like to make our algorithm as difficult as possible to crypt analyze, there is
great benefit in making the algorithm easy to analyze. That is, if The algorithm can be concisely and clearly
explained, it is easier to analyze that algorithm for cryptanalytic vulnerabilities and therefore develop a high level
of assurance as to its strength.
DES Encryption
• The DES encryption is shown in the figure below:
• Encryption function has two inputs: the plaintext to be encrypted and the key.
• The processing of the plaintext proceeds in three phases.
o The 64-bit plaintext passes through an initial permutation (IP) that rearranges the bits to produce the
permuted input.
o The permuted output is then passed through sixteen rounds of the same function, which involves
both permutation and substitution functions. The left and right halves from the last round are
swapped to produce preoutput.
o The preoutput is passed through a permutation that is the inverse of the initial
permutation function, to produce the 64-bit cipher text.
• The right-hand portion of the figure shows the way in which the 56-bit key is used.
o Initially, the key is passed through a permutation function.
o Then, a sub key (ki) is produces for each of the sixteen rounds by the combination of a left circular shift and
a permutation.
o The permutation function is the same for each round, but a different sub key is produced because of the
repeated shifts of the key bits.
• The left and right halves are treated as separate 32-bit quantities, labeled L (left) and R (right).
• The overall processing at each round can be summarized as:
Li = Ri–1
Ri = Li–1 ⊕ F(Ri–1 , Ki )
Expansion (E)
• The 32-bit input is first expanded to 48 bits.
o Bits of input are split into groups of 4 bits.
o Each group is written as groups of 6 bits by taking the outer bits from the wo adjacent groups. For
example
Substitution (S-Box)
• This 48-bit result is input to S-Boxes that perform a substitution on input and produces a 32-bit
output.
• It is easy to understand S-Box by following figure.
• The decimal value in the cell selected by the row and column is then converted to its 4-bit binary number
to produce the output.
• For example, in S1, for input 101110, the row is 10 (row 2) and the column is 0111 (column 7).The value in
row 2, column 7 is 11, so the output is 1011.
Permutation (P)
• The result is again permuted using a permutation table.
Key Generation
• A 64-bit key is used as input to the algorithm while only 56 bits are actually used. Every eighth bit is ignored.
Sub-keys at each round are generated as given below:
o The key is first permuted using a table named Permuted Choice One.
o The resulting 56-bit key is divided into two 28-bit quantities, C0 and D0. At each round, Ci-1 and Di-1 are
separately subjected to a circular left shift of 1 or 2 bits, as governed by a table.
o These shifted values are forwarded to the next round. They are also input to a permutation table- Permuted
Choice Two.
o The table produces a 48-bit output that serves as the round key ki.
DES Decryption
• Decryption in DES is same as encryption, except that the sub keys are used in reverse order.
Strength of DES
The Use of 56-Bit Keys
• DES has been developed from LUCIFER which used 128-bit keys.
• As a result, DES with only 56-bit key-length is considered insecure and devices have been proposed time and
again showing that DES is no longer secure.
A DES Example
• Let see example of DES and consider some of its implications. Although you are not expected to
duplicate the example by hand, you will find it informative to study the hex patterns that occure from one step
to the next.
Plaintext: 02468aceeca86420
Key: 0f1571c947d9e859
Ciphertext: Da02ce3a89ecac3b
• Result: Above table shows plain text, key and cipher text when we apply all the steps of DES we will get cipher
text as shown.
• The Avalanche Effect: A desirable property of any encryption algorithm is that a small change in either the
plaintext or the key should produce a significant change in cipher text.
• In particular, a change in one bit of plaintext or one bit of the key should produce a change in many bits of the
ciphertext. This is referred to as the avalanche effect.
• In DES 1 bit change in input will affect nearly 32 bit of output after all rounds.
AES Structure
• Each transformation takes one or more 4 X 4 matrices as input and produces a 4 X 4 matrix as output.
• The key expansion function generates N+1 round key each of which is distinct 4 X 4 matrices. Each round key
serves as one of the inputs to the AddRoundKey transformation in each round.
Detail Structure
AES S-Box
• For example hexadecimal value 68 is referred to row 6 and column 8 and value in table at that position is 45 so byte
value 68 is replaced with 45.
• For inverse substitute byte procedure is same but S-box is different. Reverse of above example is shown in figure.
S(yx)
• Construction of S-box:
1. Initialize the S-box with the byte values in ascending sequence row by row.
2. Map each byte in the S-box to its multiplicative inverse in the finite field GF (28). The value {00} is
mapped to itself.
3. Consider that each byte in the S-box consist of 8 bits labeled (b7, b6, b5, b4, b3, b2, b1, b0). Apply the
transformation using matrix multiplication as shown in figure.
4. Finally convert that bit column vector to byte.
• Construction of IS-box:
1. Initialize the IS-box with the byte values in ascending sequence row by row.
2. Consider that each byte in the IS-box consist of 8 bits labeled (b7, b6, b5, b4, b3, b2, b1, b0). Apply the
transformation using matrix multiplication as shown in figure.
3. Convert that bit column vector to byte.
4. Map each byte in the IS-box to its multiplicative inverse in the finite field GF (28).
AddRoundKey Transformation
• In this transformation 128 bits state are bitwise XORed with the 128 bits of the round key.
• It is viewed as a byte level operation.
• Example
w
K0 K4 K8 K12
K1 K5 K9 K13
B0 B1 B2 B3
K2 K6 K10 K14
K3 K7 K11 K15
B1 B2 B3 B0
w0 w1 w2 w3
g S S S S
w0 w1 w2 w3
RCj 0 0 0
W’
(b) Function g.
W40 w41 w42 W43
First of all key is stores in 4X4 matrix in column major matrix as shown in figure.
Each column combines to form 32 bit word.
Than we apply function g to every fourth word that is w3, w7, w11 etc.
Than X-OR operation is performed as shown in figure to obtain next four word. And this process
continues till generation of all words.
As shown in figure (b) internal structure of function g.
First we convert word to 4 byte.
Then apply circular left shift operation.
Then apply substitute byte operation using S-box which is same as S-box of AES encryption process.
Than we apply X-OR operation with round constant which have least significant 3 byte as zero and most
significant byte is depend on round number which is shown in table below.
Round (j) 1 2 3 4 5 6 7 8 9 10
RC[j] 01 02 04 08 10 20 40 80 1B 36
And output of this function is used for X-OR operation as shown in figure (a).
AES Example
Let see example of AES and consider some of its implications.
Although you are not expected to duplicate the example by hand, you will find it informative to study the hex
patterns that occur from one step to the next.
Plaintext: 0123456789abcdeffedcba9876543210
Key: 0f1571c947d9e8590cb7add6af7f6798
Ciphertext: Ff0b844a0853bf7c6934ab4364148fb9
Result: Above table shows plain text, key and cipher text when we apply all the steps of AES we will get cipher
text as shown.
The Avalanche Effect: A desirable property of any encryption algorithm is that a small change in either the
plaintext or the key should produce a significant change in cipher text.
In particular, a change in one bit of plaintext or one bit of the key should produce a change in many bits of the
ciphertext. This is referred to as the avalanche effect.
In AES 1 bit change in input will affect nearly all bit of output after all rounds.
AES Implementation
Equivalent Inverse Cipher
While implementing AES if we interchange the order of operation than it will affect the result or not is
discussed here.
If we interchange inverse shift row and inverse substitute byte operation than it will not affect and we get the
same output.
So we can obtain two equivalent decryption algorithms for one encryption algorithm.
As inverse shift row will change position of byte and it will not affect byte value. While inverse substitute byte
will change byte value by table lookup and it not concern with byte position. So we can interchange those two
operations.
If we interchange inverse mix column and add round key operation than it will affect and we do not get the same
output.
Both the operation will affect the value and so it cannot be interchange.
Implementation Aspects
As in AES out of four three operation are byte level operation and it can be efficiently implemented on 8- bit
processors.
Only mix column operation is requiring matrix multiplication which requires some storage space and also time
consuming on 8-bit processor.
To overcome it we can use table lookup to reduce time requirement.
Also we can implement it on 32-bit processors.
In 32-bit processor we can use word by word operation and it much faster.
Double DES
The simplest form of multiple encryptions has two encryption stages and two keys and is known as Double
DES.
Given a plaintext P and two encryption keys K1 and K2, cipher text C is generated as: C = E(K2, E(K1, P))
Decryption applies keys in reverse order: P = D(K1, D(K2, C))
This scheme involves a key length of 56 * 2 = 112 bits, making Brute-Force attack impractical.
However, other types of attacks are possible:
Meet-In-The-Middle Attack
o This attack is based on the on the observation that if:
C = E(K2, E(K1, P)), then
X = E(K1, P) = D(K2, C)
o Given a known (P, C) pair, the attack proceeds as follows:
First, encrypt P for all 256 possible values of K1.
Store these results in a table and then sort the table by the values of X.
Decrypt C using all 256 possible values of K2.
Check the result against the table for a match after every decryption.
If a match occurs, then test the two resulting keys against a new known plaintext– ciphertext pair.
If the two keys produce the correct ciphertext, accept them as the correct keys.
For any given plaintext, 248 false alarms are possible since there are only 264 ciphertext values whereas
2112 key values.
Thus, the order of attack can be reduced to 248 instead of 2112.
Chosen-Plaintext Attack
o Find plaintext values that gives A = 0.
o Then, use the meet-in-the- middle attack to determine the two keys.
o However, this attack requires 256 chosen plaintext-cipher text pairs which is impractical.
Known-Plaintext Attack
o This method does not require chosen plaintext-cipher text pairs but requires more effort.
o The attack is based on the observation that if an attacker knows A and C, then the problem reduces to that of an
attack on double DES.
o The attack is as follows:
The attacker obtains n(P, C) pairs places them in Table 1 sorted on the values of P.
For an arbitrary value a for A, calculate the plaintext value that produces: Pi =
D(i, a)
For each Pi that matches an entry in Table 1, create an entry in Table 2 that contains value of K1 and b that is
obtained by decrypting the corresponding cipher text from Table 2.
B = D(i, C)
Table 2 contains a number of candidate values of Ki. Now, for each of the 256 possible values of K2, calculate
the second intermediate value for our chosen value of a:
Bj = D(j, a)
At each step, look up Bj in Table 2. If there is a match, then the corresponding key i from Table 2 plus this
value of j are candidate values for the unknown keys (K1, K2).
Test each candidate pair of keys on a few other plaintext–cipher text pairs. If a pair of keys produces the
desired cipher text, the task is complete.
If no pair succeeds, repeat from step 1 with a new value of a.
Although the attacks just described appear impractical, anyone using two-key 3DES may feel some concern.
In that case, three-key 3DES is the preferred alternative.
Three-key 3DES has an effective key length of 168 bits and is defined as: C =
E(K3, D(K2, E(K1, P)))
Backward compatibility with DES is provided by putting K3 = K1 or K1 = K3.
A number of Internet-based applications have adopted three-key 3DES, including PGP and S/MIME.
Modes of Operations
There are 5 modes of operation which are listed below.
This is the simplest mode in which plaintext is handled one block at a time and each block of plaintext is
encrypted using the same key.
The term codebook is used because, for a given key, there is a unique ciphertext for every -bit block of plaintext.
Therefore, we can imagine a huge codebook in which there is an entry for every possible b-bit plaintext showing
its corresponding ciphertext.
For a message longer than b bits, the procedure is simply to break the message into b-bit blocks, padding the last
block if necessary.
Decryption is performed one block at a time, always using the same key.
For lengthy messages, ECB mode may be not secure. If the message has repetitive elements, then these elements
can be identified by the analyst.
Thus, the ECB method is ideal for a short amount of data, such as an encryption key.
To overcome the security deficiencies of ECB, a technique is needed in which the sameplaintext block, if
repeated, produces different cipher text blocks.
A simple way to satisfy this requirement is the cipher block chaining (CBC) which is shown in the figure.
In this mode, the input to the encryption algorithm is the X-OR of the current plaintext block and the
preceding ciphertext block; the same key is
used for each block.
The input to the encryption function for each plaintext block has no fixed relationship to the plaintext block.
Therefore, repeating patterns will not produce same ciphertext.
The last block is padded to a full b bits if it is a partial block.
For decryption, each cipher block is passed through the decryption algorithm. The result is X-ORed with the
preceding ciphertext block to produce the plaintext block.
The expressions for CBC are:
Encryption:
Cj = E(K, [Cj — 1 ⊕ Pj)
Decryption:
D(K, Cj) = D(K, E(K, [cj — 1 ⊕ Pj]))
D(K, Cj) = Cj — 1 ⊕ Pj
Cj — 1 ⊕ D(K, Cj) = Cj — 1 ⊕ Cj — 1 ⊕ Pj = Pj
DES is a block cipher, but it may be used as a stream cipher if the Cipher Fee Output back Mode (CFB) or the
Feedback Mode (OFB) is used. CFB scheme is depicted below.
A stream cipher eliminates the need to pad a message to be an integral number of blocks.
It also can operate in real time.
‘s’ bits is the size usually selected by the user, most of time it is 8 bits.
In this case, rather than block of 64 bits, the plaintext is divided into segments of s bits.
Encryption: The input to the encryption function is a 64-bit shift register that is initially set to some
initialization vector (IV).
The leftmost (most significant) s bits of the output of the encryption function are X-ORed with the first
segment of plaintext P1 to produce the first unit of ciphertext C1, which is then transmitted.
In addition, the contents of the shift register are shifted left by s bits and C1 is placed in the rightmost
s bits of the shift register.
This process continues until all plaintext units have been encrypted.
Decryption: The same scheme is used except that the received ciphertext unit is X-ORed with the output of
the encryption function to produce the plaintext unit.
The disadvantage of this scheme is that bit error in one ciphertext propagates to next stage also.
Unit 3
Public Key Cryptography
Public-key cryptography is a cryptographic system that uses two separate keys, one of which is secret and
the other one is public. The algorithms used for public key cryptography are based on mathematical
functions.
oDecryption algorithm: This algorithm accepts the ciphertext and the matching key and produces the original
plaintext.
Any cryptosystem are designed to meet following goal
1. Secrecy (Encryption)
2. Authentication
Now we will discuss how it is maintain in public key cryptosystem
If the adversary is interested only in this particular message, then the focus of effort is to recover X by
generating a plaintext estimate.
Whereas if the adversary is interested in being able to read future messages as well, then he attempts to recover PRb
by generating an estimate
Authentication and Secrecy both can be achieved by combining above both techniques.
o First sender A encrypt message X with private key of A.
Y = E (PRa, X)
o Then again A encrypt Y with public key of B.
Z = E (PUb, Y)
o Then send Z.
o Only B can decrypt Z as it is encrypted with public key of B. So it gives Secrecy.
Y = D (PRb, Z)
o Now Y can be decrypted with public key of A. So it gives authentication.
X = D (PUa, Y)
So by using public key cryptography we can achieve secrecy and authentication.
o It is computationally easy for a sender A, knowing the public key and themessage M, to generate the
corresponding ciphertext and for the receiver B to decrypt the resulting ciphertextusing the private key to
recover the original message.
o It is computationally infeasible for an adversary, knowing the public key, PUb, todetermine the private
key,PRb.
o It is computationally infeasible for an adversary, knowing the public key, PUb, and a ciphertext, C, to recover
the original message, M.
o The two keys can be applied in either order:
M = D[PUb, E(PRb,M)] = D[PRb, E(PUb,M)]
These are requirements that only a few algorithms have been able to fulfill. Some of these are RSA, elliptic
curve cryptography, Diffie-Hellman, & DSS.
C = Memod n
M = Cdmod n
M= (Me)d mod n
For the above equation to be true, d must be an inverse of e.
D can be calculated from e using extended Euclid’s algorithm.
Both sender and receiver must know the value of n.
The sender knows the value of e, and only the receiver knows the value of d.
RSA can also be subjected to various attacks like brute-force attack, various mathematical attacks, timing attacks
and chosen ciphertext attacks.
Some of these attacks exploit the mathematical characteristics of RSA.
RSA Example
Let p = 17 and q = 11.
n = pq = 17 X 11 = 187
ϕ(n) = (p-1)(q-1) = 16 X 10 = 160
Let e be 7.
d = e-1 mod 160 = 23 (can be calculated by extended Euclid’s algorithm).
Now, PU = { 7, 187 } and PR = { 23, 187 }
If M = 88, then by RSA
Encryption
Decryption
Here, C = 11.
M = 1123 mod 187
= [ 11 X 112 X 114 X 118 X 118 ] mod 187
= 88
Efficiency of exponentiation:
o RSA deals with very large exponents.
o But this operation can be implemented efficiently.
o Consider x16. A straightforward approach requires multiplying x 16 times.
o But, the same can be achieved by only four multiplications - x2,(x2)2=x4, (x4)2=x8, (x8)2=x16.
Efficient operation using the public key:
o To speed up the operation of the RSA algorithm using the public key, a specific choice of e is usually made.
o The most common choice is 65537 (216 + 1).
Brute force
This involves trying all possible private keys.
The defense against this attack is to use a large key.
However, the key should not be so large that it makes calculation too time consuming and hence
impractical.
Thus, there is a tradeoff between key size and security of RSA.
Mathematical attacks
There are three approaches to attacking RSA mathematically, all of which are equivalent in effort to the factoring
the product of two primes.
o Factor n into its two prime factors. This enables calculation of (n) = (p - 1)(q - 1), which in turn
enables determination of d =e-1 (mod (n)).
o Determine (n) directly, without first determining p and q. Again, this enables determination of d =e- 1 (mod
(n)). This is equivalent to factoring n.
o Determine d directly, without first determining (n) which is at least as time-consuming as the
factoring problem.
Size of n should be considerably large.
To avoid values of n that may be factored more easily, the
o P and q should differ in length by only a few digits.
o Both (p - 1) and (q - 1) should contain a large prime factor.
o gcd(p - 1, q - 1) should be small.
Timing attacks
These depend on the running time of the decryption algorithm.
It is a ciphertext only attack.
In RSA, modular exponentiation is done bit by bit. Suppose the system uses a modular multiplication function
that is very fast in almost all cases but in a few cases takes much more time than an entire average modular
exponentiation.
The attack proceeds as follows:
o Suppose that the first j bits are known.
o For a given ciphertext, the attacker can complete the first j iterations of the for-loop.
o The operationof the subsequent step depends on the unknown exponent bit.
oFor a few values of e and d, the modular multiplication will be extremely slow, and the attacker knows
which these are.
o Therefore, if the observed time to execute the decryption algorithm is always slow when this
particular iteration is slow with a 1 bit, then this bit is assumed to be 1.
o If a number of observed execution times for the entire algorithm are fast, then this bit is assumed to be 0.
Generally modular exponentiation implementations do not have such extreme timing variations but there is
enough variation to make this attack practical.
Countermeasures to this attack are:
o Constant exponentiation time: Ensure that all exponentiations take the before same amount of time
returning a result. However, this degrades performance.
o Random delay: Better performance could be achieved by adding a random delay to the
exponentiation algorithm to confuse the timing attack. But if the defenders don’t add enough noise, attackers
could still succeed by additional measurements to compensate for the random delays.
o Blinding: Multiply the ciphertext by a random number before performing exponentiation. This
process prevents the attacker from knowing what ciphertext bits are being processed inside the computer
and therefore prevents the bit-by-bit analysis that is essential to the timing attack. Steps for blinding are:
Generate a secret random number r between 0 and n – 1.
C’= C(re) mod n, where e is the public exponent.
Compute M’= (C’)dmod n
Compute M=M’r-1 mod n, r-1 is the multiplicative inverse of r mod n
K = (YA)XBmodq
= (αXAmod q)XBmodq
= (αXA)XBmodq
= αXBXAmod q
= (αXB)XAmod q (by the rules of modular arithmetic)
= (αXBmodq)XAmod q
= (YB)XAmod q
The result is that the two sides have exchanged a secret value.
Furthermore, because XA and XB are private, an adversary only has the following information: q, α, YA and YB.
Thus, the adversary is forced to take a discrete logarithm to determine the key.
For example, to determine the private key of user B, an adversary must compute
XB= dloga,q(YB)
The adversary can then calculate the key K.
The security of the Diffie-Hellman key exchange lies in the fact that, while it is relatively easy to calculate
exponentials modulo a prime, it is very difficult to calculate discrete logarithms.
For large primes, calculating discrete logarithms is considered infeasible.
Because only A and B can determine the key, no other user can read the message (confidentiality).
Recipient B knows that only user A could have created a message using this key (authentication).
However, the technique does not protect against replay attacks. One such example is Man-in-the-Middle Attack.
Man-in-the-Middle Attack
Suppose A and B wish to exchange keys, and E is the attacker.
The attack proceeds as follows.
o E generates two random private keys XE1andandXE2then computing the corresponding public keys
YE1and YE2.
o A transmits YA to B.
o E intercepts YA and transmits ‘ YE1 to B.
o B receives YE1 and calculates K1= (YE1)XBmod q.
o B transmits YBto A.
o E intercepts YBand transmits YE2 to A.
o A receivesYE2 and calculates K2= (YE2)XA mod q.
o E also calculates K1= (YB)XE1mod qand K2= (YA)XE2 mod q
At this point, B and A think that they share a secret key, but instead Band E share secret key and A and E share
secret key.
All future communication between B and A is compromised in the following way.
o A sends an encrypted message M as E(K2, M).
o E intercepts the encrypted message and decrypts it to recover M.
o E sends E(K1, M) or E(K1, M’) to B , where M’ is any message.
The key exchange protocol is vulnerable to such an attack because it does not authenticate the
participants.
This vulnerability can be overcome with the use of digital signatures and public-key certificates.
Unit 4
Hash Function
A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value.
A “good” hash function has the property that the results of applying the function to a large set of inputs
will produce outputs that are evenly distributed and apparently random.
In general terms, the principal object of a hash function is data integrity.
A change to any bit or bits in results, with high probability, in a change to the hash code.
Hash function used for security applications is referred to as a cryptographic hash function.
A cryptographic hash function is an algorithm for which it is computationally infeasible to find either
o A data object that maps to a pre-specified hash result (the one-way property) or
o Two data objects that map to the same hash result (the collision-free property).
Because of these characteristics, hash functions are often used to determine whether or not data has changed.
Figure depicts the general operation of a cryptographic hash function.
Message Authentication
Message authentication is a mechanism or service used to verify the integrity of a message.
Message authentication assures that data received are exactly as sent.
Hash function is used to provide message authentication.
The hash function value is often referred to as a message digest.
Variety of ways in which a hash code can be used to provide message authentication, as follows.
a) The message plus concatenated hash code is encrypted using symmetric encryption. Because only A and B share
the secret key, the message must have come from A and has not been altered. The hash code provides the
structure or redundancy required to achieve authentication. Confidentiality is also provided.
b) Only the hash code is encrypted, using symmetric encryption. This reduces the processing burden for those
applications that do not require confidentiality.
c) It is possible to use a hash function but no encryption for message authentication. Two communicating parties
share a common secret value S. A computes the hash value over the concatenation of M and S and appends the
resulting hash value to M. Because B possesses, it can recomputed the hash value to verify. Opponent cannot
generate a false message.
d) Confidentiality can be added to the approach of method (c) by encrypting the entire message plus the hash
code.
Digital Signatures
Another important application, which is similar to the message authentication application, is the digital
signature.
The operation of the digital signature is similar to that of the MAC.
In the case of the digital signature, the hash value of a message is encrypted with a user’s private key.
Anyone who knows the user’s public key can verify the integrity of the message that is associated with the digital
signature.
In this case, an attacker who wishes to alter the message would need to know the user’s private key.
a) The hash code is encrypted, using public-key encryption with the sender’s private key. This provides
authentication. It also provides a digital signature, because only the sender could have produced the encrypted
hash code.
b) If confidentiality as well as a digital signature is desired, then the message plus the private-key-encrypted hash code
can be encrypted using a symmetric secret key.
Other Applications
Hash functions are commonly used to create a one-way password file.
Hash functions can be used for intrusion detection and virus detection.
A cryptographic hash function can be used to construct a pseudorandom function (PRF) or a
pseudorandom number generator (PRNG).
In the case of a hash function, a brute-force attack depends only on the bit length of the hash value.
A cryptanalysis in contrast, is an attack based on weaknesses in a particular cryptographic algorithm.
We look first at brute-force attacks.
Cryptanalysis
As with encryption algorithms, cryptanalytic attacks on hash functions seek to exploit some property of the
algorithm to perform some attack other than an exhaustive search.
The way to measure the resistance of a hash algorithm to cryptanalysis is to compare its strength to the effort
required for a brute-force attack.
In recent years, there has been considerable effort, and some successes, in developing cryptanalytic attacks on hash
functions.
To understand these, we need to look at the overall structure of a typical secure hash function, indicated in Figure.
Cryptanalysis of hash functions focuses on the internal structure of f and is based on attempts to find efficient
techniques for producing collisions for a single execution of f.
Once that is done, the attack must take into account the fixed value of IV.
The attack on f depends on exploiting its internal structure.
Typically, as with symmetric block ciphers, f consists of a series of rounds of processing, so that the attack involves
analysis of the pattern of bit changes from round to round.
oAdditive constant Kt which represent the first sixty-four bits of the fractional parts of the cube roots of the
first eighty prime numbers.
The contents of the buffer are updated after every round.
SHA algorithm
The output of the eightieth round is added modulo 264to the input to the first round (Hi-1) to produce Hi.
5. Output.
After all N 1024-bit blocks have been processed, the output from the Nth stage is the 512-bit message
digest.
Where
Message Schedule
The 64-bit word values Wtare derived from the 1024-bit message.
The first16 values ofWt are taken directly from the 16 words of the current block. The remaining values are
defined as follows:
Message schedule
The message schedule introduces a great deal of redundancy and interdependence into the message blocksthat
are compressed, which complicates the task of finding a different message block that maps to the same
compression function output.
Message authentication is a mechanism or service used to verify the integrity of a message. Message
authentication assures that data received are exactly as sent by (i.e., contain no modification, insertion, deletion,
or replay) and that the purported identity of the sender is valid.
Authentication Techniques
Following techniques are used for authentication:
o Hash function: Hash function maps a message of any length into a fixed-lengthhash value, which serves as
the authenticator.
o Message encryption: The ciphertext of the entire message serves as its authenticator.
o Message authentication code (MAC): A MAC is a function of the message and a secretkey that produces
a fixed-length value that serves as the authenticator.
Authentication using message encryption is explained below:
Message Encryption
Symmetric Encryption: A message M transmitted from source A to destination B is encrypted using a secret
key K shared by A and B.
No other party knows the key, and hence confidentiality is provided as no other party can recover the plaintext
of the message without the knowledge of key.
The message must have come from A because A is the only other party that possesses K and therefore the only other
party which can construct cipher text that can be decrypted with K. Thus, authentication is provided.
Furthermore, if M is recovered, B knows that none of the bits of M have been altered, because an opponent
that does not know K would not know how to alter bits in the cipher text to produce desired changes in the
plaintext. Thus, data integrity is also provided.
If the message contains regular language, then the legitimacy of the message can be determined.
But if the message contains arbitrary data like binary object file, digitized X-ray, then alteration in the
message cannot be determined by simply looking at the messages.
In that case, plaintext must have some structure like some message based function (one example is checksum)
or add TCP header if TCP/IP is being used.
Public-Key Encryption: The source (A) uses the public key PUb of the destination (B) to encrypt M. Because only B
has the corresponding private key PRb, only B can decrypt the message. But this scheme provides confidentiality
but not authentication because any opponent could also use B's public key to encrypt a message, claiming to be
A.
To provide authentication, A uses its private key to encrypt the message, and B uses A's public key to decrypt it.
The message must have come from A because A is the only party that possesses PRa. Anyone with PUa can decrypt
the message. This scheme also provides digital signature because only A could have constructed the cipher text by
encrypting it with PRa.
If both authentication and confidentiality is needed, then message is encrypted using both PUa and PRa.by
using its private key to encrypt. Note that this scheme does not provide confidentiality.
This scheme also requires some structure in plaintext if it contains arbitrary data.
A MAC function is similar to encryption. One difference is that the MAC algorithm need not be reversible, as in
the case of decryption.
A MAC function is generally a many-to-one function.
Application of MAC
Three situations in which a message authentication code is used are:
1. Many applications need to broadcast message to a number of destinations.
Examples are notification to users that the network is now unavailable or an alarm signal in a military
control center.
Instead of decrypting message at every node it is cheaper and more reliable to have only one
destination responsible for monitoring authenticity.
The message is broadcasted in plaintext with an associated message authentication code. The
responsible system has the secret key and performs authentication.
If a violation occurs, the other destination systems are alerted by a general alarm.
2. One side in the communication has a heavy load and cannot afford the time to decrypt all incoming messages.
Authentication is carried out on a selective basis. Messages are chosen at random for checking.
3. Authentication of a computer program in plaintext.
The computer program can be executed without having to decrypt it every time.
However, if a message authentication code were attached to the program, it could be checked whenever
assurance is required about the integrity of the program.
Since only the receiver and the sender know the secret key, and if the received MAC matches the calculated
MAC, then
o The receiver is assured that the message has not been altered. If an attacker alters the message but
does not alter the MAC, then the receiver’s calculation of the MAC will differ from the received MAC.
o The receiver is assured that the message is from the alleged sender. Because no one else knows the secret key.
Confidentiality can be provided by performing message encryption either after or before the MAC
algorithm.
In both these cases, two separate keys are needed, each of which is shared by the sender and the receiver.
MAC can be calculated with the message as input and then concatenated to the message. The entire block is then
encrypted.
The tag is appended to the message at the source at a time when the message is assumed or known to be correct. The
receiver authenticates that message by re-computing the tag.
When an entire message is encrypted for confidentiality, using either symmetric or asymmetric
encryption, the security of the scheme generally depends on the bit length of the key.
Barring some weakness in the algorithm, the opponent must resort to a brute-force attack using all possible
keys.
On average, such an attack will require 2k-1 attempts for a k-bit key. In particular, for a cipher text only attack,
the opponent, given cipher text C, performs 𝑃𝑃𝑖𝑖 = 𝐷𝐷(𝐾𝐾𝑖𝑖 , 𝐶𝐶) for all possible key values 𝐾𝐾𝑖𝑖 until a 𝑃𝑃𝑖𝑖 is produced that
matches the form of acceptable plaintext.
Then the MAC function should satisfy the following requirements.
1. If an opponent observes M and 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀), it should be computationally infeasible for the opponent to construct
a message M’ such that 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀) = 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀′).
2. 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀) should be uniformly distributed in the sense that for randomly chosen messages, M and M’, the
probability that 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀) = 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀′) is 2-n, where n is the number of bits in the tag.
3. Let M’ be equal to some known transformation on M. That is, 𝑀𝑀′ = 𝑓𝑓(𝑀𝑀). For example, f may involve inverting
one or more specific bits. In that case, Pr[𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀) = 𝑀𝑀𝐴𝐴𝐶𝐶(𝐾𝐾, 𝑀𝑀′ )] = 2−𝑛𝑛
Brute-Force Attacks
A brute-force attack on a MAC requires more known message-MAC pairs than a brute-force attack on a hash
function.
There are two types of possible attack:
o attack the key space
o attack the MAC value
1. Attacking the key space
If an attacker can determine the MAC key, then it is possible to generate a valid MAC value for any input.
Suppose the key size is k bits and that the attacker has one known text–tag (MAC) pair.
The attacker can then compute the n-bit tag on the known text for all possible keys.
At least one key will produce the correct MAC value for the message. Till now, the level of effort is 2k.
However, the MAC is a many-to-one mapping, so there may be other keys that produce the correct value.
Thus, if more than one key is found to produce the correct value, additional text–tag pairs must be tested.
The level of effort becomes less with each additional text–MAC pair and after 2 or 3 levels, a single key is
obtained.
2. Attacking the MAC value
The attacker will try to generate a valid MAC for a given message or to find a message that matches a given
MAC value.
Here the level of effort is that of 2n.
This attack cannot be conducted off line without further input; the attacker will require chosen text– tag
pairs or knowledge of the key.
Cryptanalysis
Cryptanalytic attacks on MAC algorithms try to exploit some property of the algorithm to perform some attack
other than an exhaustive search.
The way to measure the resistance of a MAC algorithm to cryptanalysis is to compare its strength to the effort
required for a brute-force attack.
An ideal MAC algorithm will require a cryptanalytic effort greater than or equal to the brute-force effort.
Security of HMAC
The security of any HMAC function is based on the cryptographic strength of the underlying hash function.
The security of a MAC function is expressed in terms of the probability of successful forgery with a given amount
of time spent by the forger and a given number of message-MAC pairs created with the same key.
The probability of successful attack on HMAC is equivalent to one of the following attacks on the
embedded hash function:
o The attacker is able to compute an output of the compression function even with an IV that is random, secret,
and unknown to the attacker.
o The attacker finds collisions in the hash function even when the IV is random and secret.
operation of CMAC
The message is divided into n blocks (M1, M2, …, Mn ).
The algorithm makes use of a k-bit encryption key K and an n-bit constant, K1.
For AES, the key size is 128, 192, or 256 bits;
for triple DES, the key size is 112 or 168 bits.
CMAC is calculated as follows:
where multiplication (● ) is done in the finite field GF(2n) and x and x2 are first- and second-order polynomials that are
elements of GF(2n).
A digital signature is an authentication mechanism that enables the creator of a message to attach a code that acts as a
signature. Typically the signature is formed by taking the hash of the message and encrypting the message with the
creator’s private key. The signature guarantees the source and integrity of the message.
Figure above is a generic model of the process of making and using digital signatures.
Bob can sign a message using a digital signature generation algorithm.
The inputs to the algorithm are the message and Bob’s private key.
Any other user, say Alice, can verify the signature using a verification algorithm, whose inputs are the
message, the signature, and Bob’s public key.
In simplified terms, the essence of the digital signature mechanism is shown in Figure below.
Example
let us start with the q = 19 and α=10
Alice generates a key pair as follows:
1. Alice chooses 𝑋𝑋𝐴𝐴 = 16.
2. Then 𝑌𝑌𝐴𝐴 = 𝛼𝛼𝑋𝑋𝐴𝐴 𝑚𝑚𝑚𝑚𝑚𝑚 𝑞𝑞 = 1016𝑚𝑚𝑚𝑚𝑚𝑚 19 = 4.
3. Alice’s private key is 16; Alice’s pubic key is {𝑞𝑞, 𝛼𝛼, 𝑌𝑌𝐴𝐴 } = {19, 10, 4}.
Suppose Alice wants to sign a message with hash value 𝑚𝑚 = 14.
1) Alice chooses 𝐾𝐾 = 5, which is relatively prime to 𝑞𝑞 − 1 = 18. 2) 𝑆𝑆1 =
𝛼𝛼𝐾𝐾𝑚𝑚𝑚𝑚𝑚𝑚 𝑞𝑞 = 105𝑚𝑚𝑚𝑚𝑚𝑚 19 = 3.
3) 𝐾𝐾−1𝑚𝑚𝑚𝑚𝑚𝑚 (𝑞𝑞 − 1) = 5−1𝑚𝑚𝑚𝑚𝑚𝑚 (19 − 1) = 11.
4) 𝑆𝑆2 = 𝐾𝐾 −1 (𝑚𝑚 − 𝑋𝑋𝐴𝐴 𝑆𝑆1 )𝑚𝑚𝑜𝑜𝑑𝑑(𝑞𝑞 − 1) = 11(14 − (16)(3))𝑚𝑚𝑜𝑜𝑑𝑑(19 − 1) = −347 𝑚𝑚𝑜𝑜𝑑𝑑 18 = 4.
Bob can verify the signature as follows.
1. 𝑉𝑉1 = 𝛼𝛼𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚 𝑞𝑞 = 1014𝑚𝑚𝑚𝑚𝑚𝑚 19 = 16.
2. 𝑉𝑉2 = (𝑌𝑌𝐴𝐴 )𝑆𝑆1 (𝑆𝑆1 )𝑆𝑆2 𝑚𝑚𝑜𝑜𝑑𝑑 𝑞𝑞 = (4)3 (3)4 𝑚𝑚𝑜𝑜𝑑𝑑 19 = 5184 𝑚𝑚𝑜𝑜𝑑𝑑 19 = 16.
Thus, the signature is valid.
1) Choose a random integer r with 0 < 𝑟𝑟 < 𝑞𝑞 and compute𝑥𝑥 = 𝛼𝛼𝑟𝑟𝑚𝑚𝑚𝑚𝑚𝑚 𝑝𝑝. This computation is a preprocessing
stage independent of the message M to be signed.
2) Concatenate the message with x and hash the result to compute the value e: 𝑒𝑒 = 𝐻𝐻(𝑀𝑀||𝑥𝑥 ).
3) Compute𝑦𝑦 = (𝑟𝑟 + 𝑠𝑠𝑠𝑠)𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚. The signature consists of the pair (e, y).
Any other user can verify the signature as follows. 1.
Compute 𝑥𝑥 ′ = 𝛼𝛼 𝑦𝑦 𝑣𝑣 𝑒𝑒 𝑚𝑚𝑜𝑜𝑜𝑜 𝑝𝑝.
2. Verify that 𝑒𝑒 = 𝐻𝐻(𝑀𝑀||𝑥𝑥 ′ ).
Figure contrasts the DSS approach for generating digital signatures to that used with RSA.
RSA approach
In the RSA approach, the message to be signed is input to a hash function that produces a secure hash code of
fixed length.
This hash code is then encrypted using the sender’s private key to form the signature.
Both the message and the signature are then transmitted.
The recipient takes the message and produces a hash code.
The recipient also decrypts the signature using the sender’s public key.
If the calculated hash code matches the decrypted signature, the signature is accepted as valid.
DSS approach
The DSS approach also makes use of a hash function.
The hash code is provided as input to a signature function along with a random number k, generated for this
particular signature.
The signature function also depends on the sender’s private key (PRa), and a set of parameters known to a group of
communicating principals.
We can consider this set to constitute a global public key (PUG).
The result is a signature consisting of two components, labeled s and r.
At the receiving end, the hash code of the incoming message is generated.
This plus the signature is input to a verification function.
The verification function also depends on the global public key as well as the sender’s public key (PUa), which is
paired with the sender’s private key.
The output ofthe verification functionis a valuethat is equal to the signature component r, if the signature is valid.
The signature function is such that only the sender, with knowledge of the private key, could have
produced the valid signature.
Creating Signature
To create a signature, a user calculates two quantities, r and s, that are functions of the public key
components (p, q, g), the user’s private key x, the hash code of the message H(M), and an additional integer k
that should be generated randomly and be unique for each signing.
Verification
At the receiving end, verification is performed using the formulas shown in Figure.
The receiver generates a quantity that is a function of the public key components, the sender’s public key,
and the hash code of the incoming message.
If this quantity matches the component of the signature, then the signature is validated.
Figure below depicts the functions of signing and verifying.
Unit 5
Key distribution is the function that delivers a key to two parties who wish to exchange secure encrypted data. Some sort
of mechanism or protocol is needed to provide for the secure distribution of keys.
Thus, A can verify that its original request. Also, the message includes two items intended for B:
These last two items are encrypted with Kb (the master key that the KDC shares with B). They are to be sent to
B to establish the connection and prove A’s identity.
3. A stores the session key and forwards the 𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴]) to B. Because this information is encrypted with Kb, it
is protected from eavesdropping. B now knows the session key Ks, knows that the other party is A (from
IDA), and knows that the information originated at the KDC (because it is encrypted using Kb).
4. Using the newly minted session key for encryption, B sends a nonce, N2, to A.
5. Also, using Ks, A responds with f(N2), where f is a function that performs some transformation on N2.
Note that the actual key distribution involves only steps 1 through 3, but that steps 4 and 5, as well as step 3, perform
an authentication function.
A security manager must try to balance these competing considerations in determining the lifetime of a particular
session key.
For connection-oriented protocols, one obvious choice is to use the same session key for the length of time that the
connection is open.
If a logical connection has a very long lifetime, then it would be prudent to change the session key periodically.
For a connectionless protocol, it is not obvious how often one needs to change the session key.
The most secure approach is to use a new session key for each exchange.
However, this negates one of the principal benefits of connectionless protocols, which is minimum overhead and delay
for each transaction.
A better strategy is to use a given session key for a certain fixed period only or for a certain number of transactions.
The approach assumes that communication makes use of a connection-oriented end-to-end protocol, such as
TCP.
The steps involved in establishing a connection are shown in Figure.
When one host wishes to set up a connection to another host, it transmits a connection request packet (step 1).
The SSM saves that packet and applies to the KDC for permission to establish the connection (step 2).
The communication between the SSM and the KDC is encrypted using a master key shared only by this SSM and
the KDC.
If the KDC approves the connection request, it generates the session key and delivers it to the two
appropriate SSMs, using a unique permanent key for each SSM (step 3).
The requesting SSM can now release the connection request packet, and a connection is set up between the two end
systems (step 4).
All user data exchanged between the two end systems are encrypted by their respective SSMs using the onetime
session key.
1. A generates a public/private key pair and transmits a message to B consisting of PUa and an identifier of A, IDA.
2. B generates a secret key, Ks, and transmits it to A, which is encrypted with A’s public key.
3. A computes 𝐷𝐷(𝑃𝑃𝑃𝑃𝑎𝑎, 𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎, 𝐾𝐾𝑠𝑠)) to recover the secret key. Because only A can decrypt the message, only A and
B will know the identity of Ks.
4. A discards PUa and PRa and B discards PUa.
A and B can now securely communicate using conventional encryption and the session key Ks.
At the completion of the exchange, both A and B discard Ks.
No keys exist before and after the communication.
The protocol depicted is insecure against man-in-the-middle attack.
man-in-the-middle attack
In this case, if an adversary, E, has control of the intervening communication channel, then E can compromise the
communication in the following fashion without being detected.
1) A generates a public/private key pair {PUa, PRa} and transmits a message intended for B consisting of PUa and
an identifier of A, IDA.
2) E intercepts the message, creates its own public/private key pair {PUe, PRe} and transmits PUe||IDA to B.
3) B generates a secret key, Ks, and transmits E(PUe, Ks).
4) E intercepts the message and learns Ks by computing D(PRe, E(PUe, Ks)).
5) E transmits E(PUa, Ks) to A.
The result is that both A and B know Ks and are unaware that Ks has also been revealed to E.
3. A returns N2, encrypted using B’s public key, to assure B that its correspondent is A.
4. A selects a secret key Ks and sends M=E(PUb, E(PRa, Ks)) to B. Encryption of this message with B’s public key
ensures that only B can read it; encryption with A’s private key ensures that only A could have sent it.
5. B computes D(PUa, D(PRb, M)) to recover the secret key.
Scheme ensures both confidentiality and authentication in the exchange of a secret key.
A Hybrid Scheme
Yet another way to use public-key encryption to distribute secret keys is a hybrid approach in use on IBM
mainframes.
This scheme retains the use of a key distribution center (KDC) that shares a secret master key with each user and
distributes secret session keys encrypted with the master key.
A public key scheme is used to distribute the master keys.
The following rationale is provided for using this three-level approach:
Performance
Backward compatibility
Public-Key Authority
Stronger security for public-key distribution can be achieved by providing tighter control over the distribution of
public keys from the directory.
A typical scenario is illustrated in Figure.
Assumes that a central authority maintains a dynamic directory of public keys of all participants.
Each participant reliably knows a public key for the authority, with only the authority knowing the corresponding
private key.
The following steps occur.
1. A sends a timestamped message to the public-key authority containing a request for the current public key of B.
2. The authority responds with a message that is encrypted using the authority’s private key, PRauth.Thus,A is able to
decrypt the message using the authority’s public key. Therefore, A is assured that the message originated with
the authority. The message includes the following:
o B’s public key, PUb, which A can use to encrypt messages destined for B
o The original request used to enable A to match this response with the corresponding earlier request and to
verify that the original request was not altered before reception by the authority
o The original timestamp given so A can determine that this is not an old message from the authority
containing a key other than B’s current public key
3. A stores B’s public key and also uses it to encrypt a message to B containing an identifier of A (IDA) and a
nonce (N1), which is used to identify this transaction uniquely.
4. –Step 4 and 5 are similar to 2 and 3.
5. B retrieves A’s public key from the authority in the same manner as A retrieved B’s public key.
6. B sends a message to A encrypted with PUa and containing A’s nonce (N1) as well as a new nonce generated by
B (N2). Because only B could have decrypted message (3), the presence of in message
(6) assures A that the correspondent is B.
7. A returns N2, which is encrypted using B’s public key, to assure B that its correspondent is A.
Public-Key Certificates
The directory of names and public keys maintained by the authority is vulnerable to tampering.
An alternative approach, first suggested by Kohnfelder, is to use certificates.
In essence, a certificate consists of a public key, an identifier of the key owner, and the whole block signed by a
trusted third party.
Typically, the third party is a certificate authority, such as a government agency or a financial institution that is trusted
by the user community.
A user can present his or her public key to the authority in a secure manner and obtain a certificate.
The user can then publish the certificate. Anyone needing this user’s public key can obtain the certificate and verify
that it is valid by way of the attached trusted signature.
A participant can also convey its key information to another by transmitting its certificate.
Other participants can verify that the certificate was created by the authority.
We can place the following requirements on this scheme:
1. Any participant can read a certificate to determine the name and public key of the certificate’s owner.
2. Any participant can verify that the certificate originated from the certificate authority and is not counterfeit.
3. Only the certificate authority can create and update certificates.
4. Any participant can verify the certificate.
X.509 Certificates
X.509 provides authentication services and defines authentication protocols.
X.509 uses X.500 directory which contains:
o Public key certificates
o Public key of users signed by certification authority
X.509 certificate format is used in S/MIME, IP Security, and SSL/TLS.
X.509 is based on the use of public-key cryptography (preferably RSA) and digital signatures.
Version: Differentiates among successive versions of the certificate format; the default is version 1. Two other
versions (2 and 3) are also available as shown in the figure.
Serial number: An integer value, unique within the issuing CA, different for each certificate.
Signature algorithm identifier: The algorithm used to sign the certificate, together with any associated
parameters.
Issuer name: X.500 name of the CA that created and signed this certificate.
Period of validity: Consists of two dates: the first and last on which the certificate is valid.
Subject name: The name of the user to whom this certificate refers.
Subject's public-key information: The public key of the subject, plus an identifier of the algorithm for which
this key is to be used, together with any associated parameters.
Issuer unique identifier: An optional bit string field used to identify uniquely the issuing CA in the event the
X.500 name has been reused for different entities.
Subject unique identifier: An optional bit string field used to identify uniquely the subject in the event the
X.500 name has been reused for different entities.
Extensions: A set of one or more extension fields.
Signature: Covers all of the other fields of the certificate; it contains the hash code of the other fields,
encrypted with the CA's private key. This field includes the signature algorithm identifier.
Authentication Procedures
X.509 supports three types of authenticating using public key signatures. The types of authentication are
1. One-way authentication
2. Two- way authentication
3. Three- way authentication
One-way authentication
It involves single transfer of information from one user (say A) to other (B).
This method authenticates the identity of A to B and the integrity of message.
Here, message in the {} is signed by A.
sgnData is the information that needs to be conveyed.
tA is timestamp and rA is the nonce.
User A User B
Suppose, A has obtained a certificate from certification authority X1 and B has obtained a certificate from CA X2.
If A does not know the public key of X2, then B's certificate, issued by X2, is useless to A because A can read B's
certificate, but A cannot verify the signature.
But if the two CAs have securely exchanged their own public keys, the following procedure will enable A to
obtain B's public key:
o A obtains the certificate of X2 signed by X1 from the directory. A securely knows X1's public key, so A can
obtain X2's public key from its certificate and verify X1's signature on the certificate.
o A then obtains the certificate of B signed by X2. A now has a copy of X2's public key, so A can verify the
signature and securely obtain B's public key.
o In this case, A has used a chain of certificates to obtain B's public key. In the notation of X.509, this chain is
expressed as:
X1<<X2>> X2 <<B>>
Any level of hierarchy can be followed to produce a chain in this way. For example, in the figure given below,
A can establish a certification path to B in the following way:
X<<W>> W <<V>> V <<Y>> <<Z>> Z <<B>>
When A has obtained these certificates, it can decrypt the certification path in sequence to recover a copy of B's
public key.
Using this public key, A can send encrypted messages to B.
If B requires A's public key, it can be obtained in the similar way.
Z<<Y>> Y <<V>> V <<W>> W <<X>>X <<A>>
Revocation of Certificates
Public-Key Infrastructure
Public-key infrastructure (PKI) is the set of hardware, software, people, policies, and procedures needed to create,
manage, store, distribute, and revoke digital certificates based on asymmetric cryptography.
The principal objective for developing a PKI is to enable secure, convenient, and efficient acquisition of public
keys.
The Internet Engineering Task Force (IETF) Public Key Infrastructure X.509 (PKIX) working group has been the
driving force behind setting up a formal (and generic) model based on X.509.
Figure shows the interrelationship among the key elements of the PKIX model.
Remote user authentication is a mechanism in which the remote server verifies the legitimacy of a user over an
insecure communication channel.
Mutual Authentication
Two-level hierarchy of symmetric encryption keys can be used to provide confidentiality for communication in a
distributed environment.
In general, this strategy involves the use of a trusted key distribution center (KDC).
Each party in the network shares a secret key, known as a master key, with the KDC.
The KDC is responsible for generating keys to be used for a short time over a connection between two parties,
known as session keys, and for distributing those keys using the master keys to protect the distribution.
Proposal initially put forth by Needham and Schroeder for secret key distribution using a KDC includes
authentication features.
The protocol can be summarized as follows.
1. 𝐴𝐴 → 𝐾𝐾𝐾𝐾𝐾𝐾: 𝐼𝐼𝐼𝐼𝐴𝐴||𝐼𝐼𝐼𝐼𝐵𝐵||𝑁𝑁1
2. 𝐾𝐾𝐾𝐾𝐾𝐾 → 𝐴𝐴: 𝐸𝐸(𝐾𝐾𝑎𝑎, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐵𝐵||𝑁𝑁1||𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴])])
3. 𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴])
4. 𝐵𝐵 → 𝐴𝐴: 𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑁𝑁2)
5. 𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑓𝑓(𝑁𝑁2))
The protocol is still vulnerable to a form of replay attack.
Suppose that an opponent, X, has been able to compromise an old session key.
X can impersonate A and trick B into using the old key by simply replaying step 3.
Unless B remembers indefinitely all previous session keys used with A, B will be unable to determine that this is a
replay.
If X can intercept the handshake message in step 4, then it can impersonate A’s response in step 5.
From this point on, X can send bogus messages to B that appear to B to come from A using an authenticated session
key.
Denning proposes to overcome this weakness by a modification to the Needham/Schroeder protocol that includes the
addition of a timestamp to steps 2 and 3.
Her proposal assumes that the master keys, Ka and Kb, are secure, and it consists of the following steps.
1. 𝐴𝐴 → 𝐾𝐾𝐾𝐾𝐾𝐾: 𝐼𝐼𝐼𝐼𝐴𝐴||𝐼𝐼𝐼𝐼𝐵𝐵
2. 𝐾𝐾𝐾𝐾𝐾𝐾 → 𝐴𝐴: 𝐸𝐸(𝐾𝐾𝑎𝑎, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐵𝐵||𝑇𝑇||𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴||𝑇𝑇])])
3. 𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴||𝑇𝑇])
4. 𝐵𝐵 → 𝐴𝐴: 𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑁𝑁1)
5. 𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑓𝑓(𝑁𝑁1))
T is a timestamp that assures A and B that the session key has only just been generated.
Thus, both A and B know that the key distribution is a fresh exchange.
A and B can verify timeliness by checking that
|𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶 − 𝑇𝑇| < ∆𝑡𝑡1 + ∆𝑡𝑡2
Where ∆𝑡𝑡1, is the estimated normal discrepancy between the KDC’s clock and the local clock (at A or B) and ∆𝑡𝑡2 is
the expected network delay time.
A new concern is raised: namely, that this new scheme requires reliance on clocks that are synchronized throughout
the network points out a risk involved.
The risk is based on the fact that the distributed clocks can become unsynchronized as a result of sabotage on or faults
in the clocks or the synchronization mechanism.
The problem occurs when a sender’s clock is ahead of the intended recipient’s clock. In this case, an opponent can
intercept a message from the sender and replay it later when the timestamp in the message becomes current at the
recipient’s site.
This replay could cause unexpected results.
One-Way Authentication
With some refinement, the KDC strategy is a candidate for encrypted electronic mail.
Because we wish to avoid requiring that the recipient (B) be on line at the same time as the sender (A), steps 4 and 5
must be eliminated.
For a message with content , the sequence is as follows:
1. 𝐴𝐴 → 𝐾𝐾𝐾𝐾𝐾𝐾: 𝐼𝐼𝐼𝐼𝐴𝐴||𝐼𝐼𝐼𝐼𝐵𝐵||𝑁𝑁1
2. 𝐾𝐾𝐾𝐾𝐾𝐾 → 𝐴𝐴: 𝐸𝐸(𝐾𝐾𝑎𝑎, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐵𝐵||𝑁𝑁1||𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴])])
3. 𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝐾𝐾𝑏𝑏, [𝐾𝐾𝑠𝑠||𝐼𝐼𝐼𝐼𝐴𝐴])||𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑀𝑀)
This approach guarantees that only the intended recipient of a message will be able to read it.
It also provides a level of authentication that the sender is A.
The protocol does not protect against replays.
Kerberos
Kerberos is an authentication protocol.
It provides a way to authenticate clients to services to each other through a trusted third party.
Requirements of Kerberos
Secure: Kerberos should be strong enough that a potential opponent does not find it to be the weak link.
Reliable: For all services that rely on Kerberos for access control, lack of availability of the Kerberos service means
lack of availability of the supported services. Hence, Kerberos should be highly reliable and should employ
distributed server architecture, with one system able to back up another.
Transparent: Ideally, the user should not be aware that authentication is taking place, beyond the
requirement to enter a password.
Scalable: The system should be capable of supporting large numbers of clients and servers. This suggests a modular,
distributed architecture.
Overview of Kerberos
The overview of Kerberos is shown and described below:
The user sends the Service Granting Ticket to the application server (of which the service is needed).
The message also contains authenticator which proves the sender’s identity to the server. Moreover, the
server replies with the timestamp present in the authenticator. This authenticates the server to the user.
C → V: Ticketv || Authenticatorc V
Kerberos Realm
A Kerberos realm is a set of managed nodes that share the same Kerberos database.
The Kerberos database resides on the Kerberos master computer system, which should be kept in a physically
secure room.
A read-only copy of the Kerberos database might also reside on other Kerberos computer systems.
However, all changes to the database must be made on the master computer system using Kerberos master
password.
A Kerberos principal, is a service or user that is known to the Kerberos system. Each Kerberos principal is identified
by its principal name.
Networks of clients and servers under different administrative organizations constitute different realms.
For inter realm communication, the Kerberos servers in the two realms must be authenticated and registered
to each other.
A user wishing service on a server in another realm obtains a ticket for that server as given below:
1. C →AS: IDc||IDtgs||TS1
2. AS→ C: E(Kc, [Kc,tgs||IDtgs||TS2||Lifetime2||Tickettgs]
3. C→ TGS: IDtgsrem||Tickettgs||Authenticatorc
4. TGS→ C: E(Kc,tgs, [Kc,tgsrem||IDtgsrem||TS4||Tickettgsrem])
5. C→ TGSrem: IDvrem||Tickettgsrem||Authenticatorc
6. TGSrem→ C: E(Kc,tgsrem , [Kc,vrem||IDvrem||TS6||Ticketvrem])
7. C→ Vvrem: Ticketvrem||Authenticatorc where
IDtgsrem is the identity of remote TGS,
Tickettgsrem is the TGT for remote TGS,
IDvrem is the identity of remote server and
Ticketvrem is the Service granting ticket for remote server.
Mutual Authentication
This protocol assumes that each of the two parties is in possession of the current public key of the other.
A protocol using timestamps is: 1.
𝐴𝐴 → 𝐴𝐴𝐴𝐴: 𝐼𝐼𝐼𝐼𝐴𝐴||𝐼𝐼𝐼𝐼𝐵𝐵
2. 𝐴𝐴𝐴𝐴 → 𝐴𝐴: 𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎𝑎𝑎, [𝐼𝐼𝐼𝐼𝐴𝐴||𝑃𝑃𝑃𝑃𝑎𝑎||𝑇𝑇])||𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎𝑎𝑎, [𝐼𝐼𝐼𝐼𝐵𝐵||𝑃𝑃𝑃𝑃𝑏𝑏||𝑇𝑇])
3. 𝐴𝐴 → 𝑏𝑏: 𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎𝑎𝑎, [𝐼𝐼𝐼𝐼𝐴𝐴||𝑃𝑃𝑃𝑃𝑎𝑎||𝑇𝑇])||𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎𝑎𝑎, [𝐼𝐼𝐼𝐼𝐵𝐵||𝑃𝑃𝑃𝑃𝑏𝑏||𝑇𝑇])||𝐸𝐸(𝑃𝑃𝑃𝑃𝑏𝑏, 𝐸𝐸(𝑃𝑃𝑃𝑃𝑎𝑎, [𝐾𝐾𝑠𝑠||𝑇𝑇]))
In this case, the central system is referred to as an authentication server (AS), because it is not actually responsible
for secret-key distribution.
AS provides public-key certificates.
The session key is chosen and encrypted by A; hence, there is no risk of exposure by the AS.
The timestamps protect against replays of compromised keys.
One-Way Authentication
We have already presented public-key encryption approaches that are suited to electronic mail.
These approaches require that either the sender know the recipient’s public key (confidentiality), the recipient know
the sender’s public key (authentication), or both (confidentiality plus authentication).
In addition, the public-key algorithm must be applied once or twice to what may be a long message.
If confidentiality is the primary concern, then the following may be more efficient:
𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝑃𝑃𝑃𝑃𝑏𝑏, 𝐾𝐾𝑠𝑠)||𝐸𝐸(𝐾𝐾𝑠𝑠, 𝑀𝑀)
In this case, the message is encrypted with a one-time secret key.
A also encrypts this one-time key with B’s public key.
Only B will be able to use the corresponding private key to recover the one-time key and then use that key to decrypt
the message.
This scheme is more efficient than simply encrypting the entire message with B’s public key.
If authentication is the primary concern, then a digital signature may suffice:
𝐴𝐴 → 𝐵𝐵: 𝑀𝑀||𝐸𝐸(𝑃𝑃𝑅𝑅𝑎𝑎 , 𝐻𝐻(𝑀𝑀))
This method guarantees that A cannot later deny having sent the message.
However, this technique is not provide confidentiality.
To counter such a problem, both the message and signature can be encrypted with the recipient’s public key:
𝐴𝐴 → 𝐵𝐵: 𝐸𝐸(𝑃𝑃𝑈𝑈𝑏𝑏 , [𝑀𝑀||𝐸𝐸(𝑃𝑃𝑅𝑅𝑎𝑎 , 𝐻𝐻(𝑀𝑀))])
The latter two schemes require that B know A’s public key and be convinced that it is timely.
An effective way to provide this assurance is the digital certificate. Now we have
𝐴𝐴 → 𝐵𝐵: 𝑀𝑀||𝐸𝐸(𝑃𝑃𝑅𝑅𝑎𝑎 , 𝐻𝐻(𝑀𝑀))||𝐸𝐸(𝑃𝑃𝑅𝑅𝑎𝑎𝑠𝑠 , [𝑇𝑇||𝐼𝐼𝐷𝐷𝐴𝐴 ||𝑃𝑃𝑈𝑈𝑎𝑎 ])
Figure illustrates that one way to provide Web security is to use IP security (IPsec).
The advantage of using IPsec is that it is transparent to end users and applications and provides a general- purpose
solution.
Furthermore, IPsec includes a filtering capability so that only selected traffic need incur the overhead of IPsec
processing.
Another relatively general-purpose solution is to implement security just above TCP.
The foremost example of this approach is the Secure Sockets Layer (SSL) and the follow-on Internet standard
known as Transport Layer Security (TLS).
At this level, there are two implementation choices.
For full generality, SSL (or TLS) could be provided as part of the underlying protocol suite and therefore be
transparent to applications.
Alternatively, SSL can be embedded in specific packages.
For example, Netscape and Microsoft Explorer browsers come equipped with SSL, and most Web servers have
implemented the protocol.
Application-specific security services are embedded within the particular application.
Figure shows examples of this architecture.
The advantage of this approach is that the service can be tailored to the specific needs of a given
application.
SSL Architecture
SSL is designed to make use of TCP to provide a reliable end-to-end secure service.
SSL is not a single protocol but rather two layers of protocols, as illustrated in Figure below.
The SSL Record Protocol provides basic security services to various higher layer protocols.
In particular, the Hypertext Transfer Protocol (HTTP), which provides the transfer service for Web
client/server interaction, can operate on top of SSL.
Three higher-layer protocols are defined as part of SSL: the Handshake Protocol, The Change Cipher Spec Protocol,
and the Alert Protocol.
Two important SSL concepts are the SSL session and the SSL connection, which are defined in the
specification as follows.
o Connection: A connection is a transport that provides a suitable type of service. For SSL, such
connections are peer-to-peer relationships. The connections are transient. Every connection is
associated with one session.
o Session: An SSL session is an association between a client and a server.
There are a number of states associated with each session. Once a session is established, there is a current operating
state for both read and write (i.e., receive and send).
In addition, during the Handshake Protocol, pending read and write states are created. Upon successful conclusion
of the Handshake Protocol, the pending states become the current states.
A session state is defined by the following parameters.
o Session identifier: A random byte sequence chosen by the server to identify an active or resumable session
state.
o Peer certificate: An X509.v3 certificate of the peer. It may be null.
o Compression method: The algorithm used to compress data.
o Cipher spec: Specifies the data encryption algorithm (such as null, AES, etc.) and a hash algorithm (such as
MD5 or SHA-1) used for MAC calculation.
o Master secret: 48-byte secret shared between the client and server.
o Is resumable: A flag indicating whether or not the session can be used to initiate new connections.
A connection state is defined by the following parameters:
o Server and client random: Byte sequences that are chosen by the server and client for each
connection.
o Server write MAC secret: The secret key used in MAC operations on data sent by the server.
o Client write MAC secret: The secret key used in MAC operations on data sent by the client.
o Server write key: The conventional encryption key for data encrypted by the server and decrypted by the
client.
o Client write key: The conventional encryption key for data encrypted by the client and decrypted by the
server.
o Initialization vectors: When a block cipher in CBC mode is used, an initialization vector (IV) is
maintained for each key. This field is initialized by the SSL Handshake Protocol.
o Sequence numbers: Each party maintains separate sequence numbers for transmitted and received messages
for each connection. When a party sends or receives a change cipher spec message, the appropriate sequence
number is set to zero.
SSL Protocol
SSL protocol is implemented just above the TCP to provide web security.
SSL is designed to make use of TCP to provide a reliable end-to-end secure service.
SSL is not a single protocol but two layers of protocols.
The SSL Record Protocol provides basic security services to various higher layer protocols.
where
|| = concatenation,
SSLCompressed.fragment = the compressed fragment or plain text (if compression is not used) }
o Encryption: The compressed message plus the MAC are encrypted using symmetric encryption.
Algorithms supported are AES, RC4-40, IDEA, RC2, DES, 3DES and Fortezza.
o Add SSL Header: A header is prepared and added to the message. The header consists of the following fields:
Content Type (8 bits): The higher-layer protocol used to process the fragment.
Major Version (8 bits): Indicates major version of SSL in use. For SSLv3, the value is 3.
Minor Version (8 bits): Indicates minor version in use. For SSLv3, the value is 0.
Compressed Length (16 bits): The length in bytes of the fragment.
The purpose of this message is to cause the pending state to be copied into the current state, which updates the
cipher suite to be used on this connection.
Alert Protocol
The Alert Protocol is used to convey SSL-related alerts to the peer entity.
Each message in this protocol consists of two bytes:
o The first byte takes the value warning (1) or fatal (2) to convey the severity of the message.
o The second byte contains a code that indicates the specific alert.
Alert protocol
If the level is fatal, SSL immediately terminates the connection. Other connections on the same session may
continue, but no new connections are established.
Some of the alerts of fatal types are unexpected_message, bad_record_mac, decompression_failure etc.
Alerts of level warning include close_notify, no_certificate, bad_certificate etc.
Handshake Protocol
This protocol allows the server and client to authenticate each other and to negotiate an encryption and MAC
algorithm and cryptographic keys.
The Handshake Protocol is used before any application data is transmitted.
A handshake message has the following format:
o Type (1 byte): Indicates one of 10 messages of handshake protocol.
o Length (3 bytes): The length of the message in bytes.
o Content ( bytes): The parameters associated with this message.
Handshake protocol
o After sending the client_hello message, the client waits for the server_hello message, which contains the same
parameters as the client_hello message. The parameters contains the values which client had sent to the
server and the server has chosen to use.
Phase 2: Server Authentication and Key Exchange: This phase provides authentication of server to the client.
o The server sends its certificate (one or more) if it needs to be authenticated.
o The server sends a server_key_exchange message which contains the list of secret keys to be used for the
subsequent data.
o The certificate_request message is sent next which includes two parameters: certificate_type and
certificate_authorities.
o The final message in phase 2, and one that is always required, is the server_done message, which is sent by the
server to indicate the end of the server hello and associated messages.
o After sending this message, the server will wait for a client response. This message has no parameters.
Phase 3. Client Authentication and Key Exchange: This phase provides client authentication to the server.
o The client verifies the server certificates and checks whether the server_hello parameters are
acceptable.
o If all is satisfactory, the client sends a certificate message if the server has requested a certificate. If no
suitable certificate is available, the client sends a no_certificate alert.
o Next is the client_key_exchange message which has the same parameters as the
server_key_exchange message.
o The client may send a certificate_verify message to provide explicit verification of a client certificate. The
client encrypts all the previous messages and master secret with its private key.
Phase 4. Finish: This phase completes the setting up of a secure connection.
o The client sends a change_cipher_spec message and copies the pending CipherSpec into the current
CipherSpec.
o The client then immediately sends the finished message.
o The server sends its own change_cipher_spec message, transfers the pending to the current
CipherSpec, and sends its finished message.
At this point, the handshake is complete and the client and server may begin to exchange application-layer data.
Cryptographic Computations
Two further items are of interest:
o The creation of a shared master secret by means of the key exchange
The shared master secret is a 48-byte value unique to this session.
First, a pre_master_secret is exchanged.
Then, the master_secret is calculated by both parties.
o The generation of cryptographic parameters from the master secret.
The parameters include a client write MAC secret, a server write MAC secret, a client write key, a server
write key, a client write IV, and a server write IV, which are generated from the master secret.
These parameters are generated from the master secret by hashing the master secret into a sequence of
secure bytes of sufficient length for all needed parameters.
Version Number
The one difference is in version values. For the current version of TLS, the major version is 3 and the minor version is
3.
Pseudorandom Function
TLS makes use of a pseudorandom function referred to as PRF to expand secrets into blocks of data for purposes
of key generation or validation.
The objective is to make use of a relatively small shared secret value but to generate longer blocks of data in a way
that is secure from the kinds of attacks made on hash functions and MACs.
The PRF is based on the data expansion function (Figure) given as
P_hash(secret, seed)= HMAC_hash(secret,A(1) || seed) || HMAC_hash(secret, A(2) || seed) ||
HMAC_hash(secret, A(3) || seed) ||... where A() is defined as
A(0) = seed
A(i) = HMAC_hash(secret,A(i – 1))
PRF is defined as
PRF(secret, label, seed) = P_hash(S1,label || seed)
PRF takes as input a secret value, an identifying label, and a seed value and produces an output of arbitrary length.
Alert Codes
TLS supports all of the alert codes defined in SSLv3 with the exception of no_certificate.
A number of additional codes are defined in TLS; of these, the following are always fatal.
o record_overflow
o unknown_ca
o access_denied
o decode_error
o protocol_version
o insufficient_security
o unsupported_extension
o internal_error
o decrypt_error
o The remaining alerts include the following.
o user_canceled
o no_renegotiation
Cipher Suites
There are several small differences between the cipher suites available under SSLv3 and under TLS:
Key Exchange: TLS supports all of the key exchange techniques of SSLv3 with the exception of Fortezza.
Symmetric Encryption Algorithms: TLS includes all of the symmetric encryption algorithms found in SSLv3, with the
exception of Fortezza.
Cryptographic Computations
The pre_master_secret for TLS is calculated in the same way as in SSLv3.
As in SSLv3, the master_secretin TLS is calculated as a hash function of the pre_master_secret
and the two hello random numbers.
The form of the TLS calculation is different from that of SSLv3 and is defined as
master_secret=PRF(pre_master_secret,"master secret",ClientHello.random
||ServerHello.random)
The algorithm is performed until 48 bytes of pseudorandom output are produced.
The calculation of the key block material (MAC secret keys, session encryption keys, and IVs) is defined as
key_block = PRF(master_secret,"key expansion", SecurityParameters. server_random ||
SecurityParameters.client_random)
As with SSLv3, the key_blockis a function of the master_secretand the client and server random numbers, but for
TLS, the actual algorithm is different.
Padding
In SSL, the padding added prior to encryption of user data is the minimum amount required so that the total size
of the data to be encrypted is a multiple of the cipher’s block length.
In TLS, the padding can be any amount that results in a total that is a multiple of the cipher’s block length,
up to a maximum of 255 bytes.
A variable padding length may be used to frustrate attacks based on an analysis of the lengths of
exchanged messages.
HTTPS
HTTPS (HTTP over SSL) refers to the combination of HTTP and SSL to implement secure communication between
a Web browser and a Web server.
The HTTPS capability is built into all modern Web browsers. Its use depends on the Web server supporting HTTPS
communication.
For example, search engines do not support HTTPS.
The principal difference seen by a user of a Web browser is that URL (uniform resource locator) addresses begin
with https:// rather than http://.
A normal HTTP connection uses port 80. If HTTPS is specified, port 443 is used, which invokes SSL.
When HTTPS is used, the following elements of the communication are encrypted:
o URL of the requested document
o Contents of the document
o Contents of browser forms (filled in by browser user)
o Cookies sent from browser to server and from server to browser
o Contents of HTTP header
There is no fundamental change in using HTTP over either SSL or TLS, and both implementations are referred
to as HTTPS.
Connection Initiation
The client initiates a connection to the server on the appropriate port and then sends the TLS ClientHello to begin
the TLS handshake.
When the TLS handshake has finished, the client may then initiate the first HTTP request.
All HTTP data is to be sent as TLS application data.
Normal HTTP behavior, including retained connections, should be followed.
We need to be clear that there are three levels of awareness of a connection in HTTPS.
o At the HTTP level
o At the level of TLS
o At the level of TCP
Connection Closure
An HTTP client or server can indicate the closing of a connection by including the following line in an HTTP record:
Connection: close.
This indicates that the connection will be closed after this record is delivered.
At the TLS level, the proper way to close a connection is for each side to use the TLS alert protocol to send a
close_notify alert.
TLS implementations must initiate an exchange of closure alerts before closing a connection.
A TLS implementation may, after sending a closure alert, close the connection without waiting for the peer
to send its closure alert, generating an “incomplete close”.
Note that an implementation that does this may choose to reuse the session.
This should only be done when the application knows (typically through detecting HTTP message
boundaries) that it has received all the message data that it cares about.
HTTP clients also must be able to cope with a situation in which the underlying TCP connection is
terminated without a prior close_notify alert and without a Connection: close indicator.
Such a situation could be due to a programming error on the server or a communication error that causes
the TCP connection to drop.
However, the unannounced TCP closure could be evidence of some sort of attack.
So the HTTPS client should issue some sort of security warning when this occurs.
SSH Transport Layer Protocol: Provides server authentication, data confidentiality, and data integrity with forward
secrecy (i.e., if a key is compromised during one session, the knowledge does not affect the security of earlier
sessions).The transport layer may optionally provide compression.
SSH User Authentication Protocol: Authenticates the user to the server.
SSH Connection Protocol: Multiplexes multiple logical communications channels over a single, underlying SSH
connection.