CNS Lecture Note 3
CNS Lecture Note 3
com
CS6701 –CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
CS6701-
UNIT 1 NOTES
PREPARED BY
R.CYNTHIA PRIYADHARSHINI
AP/IT/SREC
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
Confidentiality
Data confidentiality
O Assures that private or confidential information is not made available or disclosed to unauthorized
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.
Integrity
Data integrity
O Assures that information and programs are changed only in a specified and authorized manner.
System integrity
0 Assures that a system performs its intended function in an unimpaired manner, free from deliberate or
inadvertent unauthorized manipulation of the system.
Availability
5888 Assures that systems work promptly and service is not denied to authorized users.
CIA Triad
Confidentiality
www.
5888 A processing or communication service that enhances the security of the data processing systems and
the
5889 information transfers of an organization
5888 The services are intended to counter security attacks, and they make use of one or
more security mechanisms to provide the service
Security Attacks
means of classifying security attacks, used both in X.800 and RFC 2828
A passive attack attempts to learn or make use of information but does not affect system resources.
An active attack attempts to alter system resources or affect their operation.
Passive Attacks
in the nature of eavesdropping on, or monitoring of, transmissions.
The goal is to obtain information that is being transmitted.
very difficult to detect, because they do not involve any alteration of the data
feasible to prevent the success of these attacks, usually by means of encryption
emphasis in dealing with passive attacks is on prevention rather than detection
Two types of passive attacks
Traffic Analysis
observe the pattern of these messages
5888 The opponent could
determine the location and identity of
communicating hosts and could
observe the frequency
5889 and length of messages being exchanged.
5888 This information might be useful in
guessing the nature of the communication
that was taking place
2
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
Active Attacks
Active attacks involve some modification of the data stream or the creation of a false stream
detect and to recover from any disruption or delays caused by them
can be subdivided into four categories:
O masquerade,
O replay,
O modification of messages
O denial of service
Masquerade
one entity pretends to be a different entity
usually includes one of the other forms
of active attack
Example
Replay
passive capture of a data unit and its subsequent retransmission to produce an unauthorized effect
Modification Of Messages
some portion of a legitimate message is altered, or that messages are delayed or reordered, to produce an
unauthorized effect
Example
a message meaning “Allow John Smith to read confidential file accounts” is modified to mean “Allow
Fred Brown to read confidential file accounts.”
Denial Of Service
prevents or inhibits the normal use or
management of communications facilities
may have a specific target; for example, an
entity may suppress all messages directed
to a particular destination
disruption of an entire network, either by
disabling the network or by overloading it with
messages so as to degrade performance
3
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
The assurance that the communicating entity is the one that it claims to be
Two types
Peer Entity Authentication
Data-Origin Authentication
Access control
The prevention of unauthorized use of a resource
Data confidentiality
The assurance that data received are exactly as sent by an authorized entity (i.e., contain no
modification, insertion, deletion, or replay).
Five types
O Connection Integrity with Recovery
O Connection Integrity without Recovery
O Selective-Field Connection Integrity
O Connectionless Integrity
O Selective-Field Connectionless Integrity
Nonrepudiation
Provides protection against denial by one of the entities involved in a communication of having participated
in all or part of the communication
Two types
O Nonrepudiation, Origin
O Nonrepudiation, Destination
trusted functionality, security labels, event detection, security audit trails, security recovery
those that are not specific to any particular protocol layer or security service
4
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
A message is to be transferred from one party to another across some sort of Internet service.
The two parties, who are the principals in this transaction, must cooperate for the exchange to take place.
A logical information channel is established by defining a route through the Internet from source to
destination and by the cooperative use of communication protocols (e.g., TCP/IP) by the two principals
5
www.
O Information access threats: Intercept or modify data on behalf of users who should not have access
O Service threats: Exploit service flaws in computers to inhibit use by legitimate users
O Examples: Viruses and worms, spread using disks & inserted over network
Transposition Techniques
Rotor Machines
Steganography
Introduction
Symmetric encryption is a form of cryptosystem in which encryption and decryption are performed using
the same key. It is also known as conventional encryption.
Symmetric encryption transforms plaintext into ciphertext using a secret key and an encryption algorithm.
Using the same key and a decryption algorithm, the plaintext is recovered from the ciphertext.
The two types of attack on an encryption algorithm are cryptanalysis,based on properties of the encryption
algorithm, and brute-force, which involves trying all possible keys.
Traditional (precomputer) symmetric ciphers use substitution and/or transposition techniques. Substitution
techniques map plaintext elements (characters, bits) into ciphertext elements. Transposition techniques
systematically transpose the positions of plaintext elements.
Rotor machines are sophisticated precomputer hardware devices that use substitution techniques.
Steganography is a technique for hiding a secret message within a larger one in such a way that others
cannot discern the presence or contents of the hidden message.
An original message is known as the plaintext, while the coded message is called the ciphertext.
The process of converting from plaintext to ciphertext is known as enciphering or encryption; restoring
the plaintext from the ciphertext is deciphering or decryption.
The many schemes used for encryption constitute the area of study known as cryptography. Such a
scheme is known as a cryptographic system or a cipher.
Techniques used for deciphering a message without any knowledge of the enciphering details fall into the
area of cryptanalysis. Cryptanalysis is what the layperson calls “breaking the code.”The areas of
cryptography and cryptanalysis together are called cryptology
6
www.
Plaintext
Encryption algorithm
O performs various substitutions and transformations
Secret key
O another input to the encryption algorithm
O a value independent of the plaintext and of the algorithm
Ciphertext
O For a given message, two different keys will produce two different ciphertexts
Decryption algorithm
O encryption algorithm run in reverse
Simplified Model of Symmetric Encryption
7
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
Encryption algorithm
Ciphertext Only
Ciphertext
Known Plaintext
Plaintext message chosen by cryptanalyst, together with its corresponding
Chosen Plaintext
ciphertext generated with the secret key
Chosen Ciphertext
Ciphertext chosen by cryptanalyst, together with its corresponding decrypted
Chosen Text
plaintext generated with the secret key
Two schemes
unconditionally secure
if the ciphertext generated by the scheme does not contain enough information to determine uniquely
the corresponding plaintext, no matter how much ciphertext is available
computationally secure
O meets either of the following criteria:
O The cost of breaking the cipher exceeds the value of the encrypted information.
The time required to break the cipher exceeds the useful lifetime of the information.
Brute-force attack
The attacker tries every possible key on a piece of ciphertext until an intelligible translation into plaintext
is obtained.
On average, half of all possible keys must be tried to achieve success.
8
www.
Substitution Techniques
A substitution technique is one in which the letters of plaintext are replaced by other letters or by
numbers or symbols
If the plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit
patterns with ciphertext bit patterns
abcdefghijklmnopqrstuvwxyzD
EFGHIJKLMNOPQRSTUVWXYZABC
mathematically give each letter a number
abcdefghij k l m n o p q r s t u v w x y z
1
0 1 2 3 4 5 6 7 8 9 10 11 2 13 14 15 16 17 18 19 20 21 22 23 24 25
then have Caesar cipher as:
c = E(p) = (p + k) mod (26) p
Monoalphabetic Ciphers
rather than just shifting the alphabet shuffle (jumble) the letters arbitrarily
each plaintext letter maps to a different random ciphertext letter
the “cipher” line can be any permutation of the 26 alphabetic characters, then there are 26! or greater
26
than 4x10 possible keys.
This is 10 orders of magnitude greater than the key space for DES and would seem to eliminate brute-
force techniques for cryptanalysis
Monoalphabetic ciphers are easy to break because they reflect the frequency data of the original alphabet
A countermeasure is to provide multiple substitutes, known as homophones, for a single letter.
For example, the letter e could be assigned a number of different cipher symbols, such as 16, 74, 35, and 21, with each
hencekeyis26letterslong
homophone assigned to a letter in rotation or randomly
9
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
Playfair Cipher
best-known multiple-letter encryption cipher
treats digrams in the plaintext as single units and translates these units into ciphertext digrams
Playfair Key Matrix
5 × 5 matrix of letters constructed using a keyword
filling in the letters of the keyword (minus duplicates) from left to right and
from top to bottom,
filling in the remainder matrix with the remaining letters in alphabetic order.
The letters I and J count as one letter
Example matrix using the keyword MONARCHY
Plaintext is encrypted two letters at a time, according to the following rules
Repeating plaintext letters that are in the same pair are separated with a filler letter, such as x,
O Ex: balloon would be treated as ba lx lo on.
Two plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with
the first element of the row circularly following the last.
O Ex: ar is encrypted as RM.
Two plaintext letters that fall in the same column are each replaced by the letter beneath, with the top
element of the column circularly following the last.
O Ex: mu is encrypted as CM.
Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and the column
occupied by the other plaintext letter.
O Ex: hs becomes BP and ea becomes IM (or JM, as the encipherer wishes)
Example
Given the key MONARCHY apply Play fair cipher to plain text “FACTIONALISM”
Solution
(p) FA CT IO NA LI SM
(c) IO DL FA AR SE LA
(d) FA CT IO NA LI SM
Security of Playfair Cipher
Hill Cipher
Finding the inverse of a matrix
10
www.
This encryption algorithm takes m successive plaintext letters and substitutes for them m ciphertext letters.
The substitution is determined by m linear equations in which each character is assigned a numerical
value (a = 0, b = 1, . , z = 25)
For m = 3, the system can be described as
where C and P are row vectors of length 3 representing the plaintext and ciphertext, and K is a 3x3
matrix representing the encryption key.
Operations are performed mod 26.
In general terms, the Hill system can be expressed as
Example
Encrypt the message “meet me at the usual place at ten rather than eight oclock” using the Hill cipher with the key ( ). Show your calculations and the result.Show the calculations for the corresponding decryption of the ciphertext to recover the original plaintext.
11
www.
Polyalphabetic Ciphers
use different monoalphabetic substitutions as one proceeds through the plaintext message.
improve security using multiple cipher alphabets
make cryptanalysis harder with more alphabets to guess and flatter frequency distribution
general name for this approach is polyalphabetic substitution cipher
has the following features in common:
O A set of related monoalphabetic substitution rules is used.
O A key determines which particular rule is chosen for a given transformation.
One-Time Pad
improvement to the Vernam cipher that yields the ultimate in security
using a random key that is as long as the message, so that the key need not be repeated
the key is to be 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
Example
ciphertext:ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
plaintext: mr mustard with the candlestick in the hall
ciphertext:ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
plaintext: miss scarlet with the knife in the library
two fundamental difficulties
Transposition Techniques
A very different kind of mapping is achieved by performing some sort of permutation on the plaintext letters
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
For example, to encipher the message "meet me after the toga party" with a rail fence of depth 2, we
write the following
mematrhtgpry
etefeteoaat
The encrypted message is
MEMATRHTGPRYETEFETEOAAT
Pure Transposition Cipher
write the message in a rectangle, row by row, and read the message off, column by column, but permute
the order of the columns.
The order of the columns then becomes the key to the algorithm
Example
Key: 4312 5 67
Input: ttnaapt
mtsuoao
dwcoixk
nlypetz
Output: NSCYAUOPTTWLTMDNAOIEPAXTTOKZ
This is a much less structured permutation and is much more difficult to cryptanalyze
Each cylinder has 26 input pins and 26 output pins, with internal wiring that connects each input pin to a unique
output pin
Steganography
A plaintext message may be hidden in one of two ways.
The methods of steganography conceal the existence of the message
The methods of cryptography render the message unintelligible to
outsiders O by various transformations of the text
Various ways to conceal the message
arrangement of words or letters within an apparently innocuous text spells out the real message
13
– www.BrainKart.com
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
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.
Invisible ink
A number of substances can be used for writing but leave no visible trace until heat or some chemical is applied
Pin punctures
Small pin punctures on selected letters are ordinarily not visible unless the paper is held up in front of a light.
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
hiding a message by using the least significant bits of frames on a CD
the Kodak Photo CD format's maximum resolution is 2048 by 3072 pixels, with each pixel containing 24 bits
of RGB color information.
The least significant bit of each 24-bit pixel can be changed without greatly affecting the quality of the image
Thus you can hide a 2.3-megabyte message in a single digital snapshot
Number of drawbacks
Advantage of steganography
can be employed by parties who have something to lose should the fact of their secret communication be
discovered
Encryption flags traffic as important or secret or may identify the sender or receiver as someone with
something to hide
14
www.BrainKart.com
CS6701 –CRYPTOGRAPHY AND NETWORK SECURITY UNIT - I
DISCRETE LOGARITHMS
www.BrainKart.com
POLYNOMIAL ARITHMETIC
CS6701-
SECURITY
UNIT 2 NOTES
PREPARED BY R.CYNTHIA
PRIYADHARSHINI
AP/IT/SREC
www.BrainKart.com
Block Ciphers
A block cipher is an encryption/decryption scheme in which a block of plaintext is treated as a whole and
used to produce a ciphertext block of equal length.
A stream cipher is one that encrypts a digital data stream one bit or one byte at a time.
O Examples of classical stream ciphers are the autokeyed Vigenère cipher and the Vernam cipher.
A block cipher is one in which a block of plaintext is treated as a whole and used to produce a
ciphertext block of equal length
Many block ciphers have a Feistel structure. Such a structure consists of a number of identical rounds of
processing. In each round, a substitution is performed on one half of the data being processed, followed by
a permutation that interchanges the two halves. The original key is expanded so that a different key is
used for each round.
The Data Encryption Standard (DES) has been the most widely used encryption algorithm until recently. It
exhibits the classic Feistel structure. DES uses a 64-bit block and a 56-bit key.
Two important methods of cryptanalysis are differential cryptanalysis and linear cryptanalysis. DES has
been shown to be highly resistant to these two types of attack
the statistical structure of the plaintext is dissipated into long-range statistics of the ciphertext.
This is achieved by having each plaintext digit affect the value of many ciphertext digits;
generally this is equivalent to having each ciphertext digit be affected by many plaintext digits
Confusion
seeks to make the relationship between the statistics of the ciphertext and the value of the encryption
key as complex as possible, again to thwart attempts to discover the key.
Thus, even if the attacker can get some handle on the statistics of the ciphertext, the way in which the
key was used to produce that ciphertext is so complex as to make it difficult to deduce the key.
This structure is a particular form of the substitution-permutation network (SPN)
Feistel network depends on the choice of the following parameters and design features
Block size, Key size, Number of rounds, Subkey generation algorithm, Round function,
Fast software encryption/decryption, Ease of analysis
Simplified DES
educational rather than a secure encryption
algorithm.
It has similar properties and structure to
DES with much smaller parameters
1 234 5 6 7 8 9 10
Plain Text 0 010 1 0 0 0
Key 1 100 0 1 1 11 0
P10 3 5 2 7 4 10 198 6 0 011 0 0 1 11 1
LS-1 0110 0 11110
P8 (K1) 6 3 7 4 8 5 10 9 1 110 1 0 01
www.BrainKart.com
LS-2 1 0 0 0 1 1 1 0 1 1
(K2 1 01 0 0 1 11
P8 ) 0 01 0 0 0 10
IP (PT) 26314857 0 01 0
R (IP) 0 0 0 1 0 1 0 0
EP 4 1 232 3 4 1 1 11 0 1 00 1
K1 1 11 1 1 10 1
XO S0 = 10 S1 = 0 0
R 001
S0 (10 11) 011
P4 0 0 1 1 0 0 1 0
P4 XOR L 0 0 1 0 0 0 1 1
SWITC 1 0 0 1 0 1 1 0
H 1 0 1 0 0 1 1 1
0 0 1 1 0 0 0 1
EP(SW(R)) 1 0 1 0
XOR 011
K2 010
001
& 0 00 1 0 0 1 1
S0 S1 1 00 0 1 01 0
P4
XOR L
IP-1
CT
O Calculation of F(R, K)
Definition of DES S-Boxes
O Key Generation
DES Decryption
The Avalanche Effect
Overview
data are encrypted in 64-bit blocks using a 56-bit key.
The algorithm transforms 64-bit input in a series of steps into a 64-bit output.
The same steps, with the same key, are used to reverse the encryption
DES Encryption
there are two inputs to the encryption function: the plaintext to be encrypted and the key.
In this case, the plaintext must be 64 bits in length and the key is 56 bits in length
Finally, the preoutput is passed through a permutation (IP-1) that is the inverse of the initial permutation
function, to produce the 64-bit ciphertext.
Initial Permutation
The initial permutation and its inverse are defined by tables
The tables are to be interpreted as follows.
The input to a table consists of 64 bits numbered from 1 to 64.
The 64 entries in the permutation table contain a permutation of the
numbers from 1 to 64.
Each entry in the permutation table indicates the position of a numbered
input bit in the output, which also consists of 64 bits
–1
Inverse Initial Permutation (IP )
Calculation of F(R, K)
Key Generation
a 64-bit key is used as input to the algorithm.
The bits of the key are numbered from 1 through 64; every eighth bit is ignored
The key is first subjected to a permutation governed by a table labeled Permuted Choice One
The resulting 56-bit key is then treated as two 28-bit quantities, labeled C0 and D0.
At each round, Ci-1 and Di-1 are separately subjected to a circular left shift, or rotation, of 1 or 2 bits
These shifted values serve as input to the next round.
They also serve as input to Permuted Choice Two , which produces a 48-bit output that serves as input
to the function F(Ri-1, Ki).
DES Decryption
As with any Feistel cipher, decryption uses the same algorithm as encryption, except that the application of
the subkeys is reversed
after just three rounds, 21 bits differ between the two blocks.
On completion, the two ciphertexts differ in 34 bit positions
similar test in which a single plaintext is input with two keys that differ in only one bit position
0110100 1000010 0010111 0111101 00010011 1110101
0 1 1 0 01110110 110100100
Keys
1110010 1111011 1101111 0011101 011000
0011000 0000100 111011100
0110010 1111011 1101111 0011000 0011101 0000100 0110001 11011100
about half of the bits in the ciphertext differ and that the avalanche effect is pronounced after just a few rounds
Linear Cryptanalysis
This attack is based on finding linear approximations to describe the transformations performed in DES
43 47
This method can find a DES key given 2 known plaintexts, as compared to 2 chosen plaintexts
for differential cryptanalysis
it may be easier to acquire known plaintext rather than chosen plaintext
infeasible as an attack on DES
For a cipher with nbit plaintext and ciphertext blocks and an m-bit key, let the plaintext block be labeled
P[1], ... P[n], the cipher text block C[1], ... C[n], and the key K[1], ... K[m]
Then define
The objective of linear cryptanalysis is to find an effective linear equation of the form
Once a proposed relation is determined, the procedure is to compute the results of the lefthand side of
the preceding equation for a large number of plaintext-ciphertext pairs
If it is 1 most of the time, assume = 1. This gives us a linear equation on the key bits.
Modes of operation
Mode Description Typical Application
Electronic
Each block of 64 plaintext bits is encoded independently Secure transmission of single
Codebook
using the same key values (e.g., an encryption key)
(ECB)
Cipher Block The input to the encryption algorithm is the XOR of the General-purpose block-oriented
Chaining next 64 bits of plaintext and the preceding 64 bits of transmission
(CBC) ciphertext Authentication
Input is processed j bits at a time. Preceding ciphertext is
Cipher General-purpose stream-oriented
used as input to the encryption algorithm to produce
Feedback transmission
pseudorandom output, which is XORed with plaintext to
(CFB) Authentication
produce next unit of ciphertext
Output Stream-oriented transmission over
Similar to CFB, except that the input to the encryption
Feedback noisy channel (e.g., satellite
algorithm is the preceding DES output.
(OFB) communication)
Each block of plaintext is XORed with an encrypted General-purpose block-oriented
Counter
counter. The counter is incremented for each subsequent transmission
(CTR)
block Useful for high-speed requirements
Various Modes
Electronic Codebook Mode
Cipher Block Chaining Mode
Cipher Feedback Mode
Output Feedback Mode
Counter Mode
www.BrainKart.com
Decryption
Decryption
www.BrainKart.com
Counter Mode
Encryption
Decryption
Hardware efficiency
Software efficiency
Preprocessing
Random access
Provable security
Simplicity
Encryption Algorithms
Advanced Encryption Standard
The AES Cipher
AES Parameters
AES Encryption and Decryption
AES Data Structures
AES Encryption Round
Substitute Bytes Transformation
ShiftRows Transformation
AddRoundKey Transformation
AES Key Expansion
www.BrainKart.com
AES Parameters
Double DES
has two encryption stages and two keys
Given a plaintext P and two encryption keys
K1 and K2 and , ciphertext C is generated as
C = E(K2, E(K1, P))
Decryption requires that the keys be applied
in reverse order P = D(K1, D(K2, C))
this scheme apparently involves a key length
of 56 * 2 = 112 bits, resulting in a dramatic
increase in cryptographic strength
Meet-In-The-Middle Attack
It is based on the observation that, if we have C =
E(K2, E(K1, P)) then X = E(K1, P) = D(K2, C)
Given a known pair, (P, C) the attack proceeds as follows
56
First, encrypt P for all 2 possible values of K1
Store these results in a table and then sort the table by the values of X
56
Next, decrypt C using all 2 possible values of K2
As each decryption is produced, check the result against the table for a match.
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.
64
For any given plaintext P, there are 2 possible ciphertext values that could be produced by double DES
48
the foregoing procedure will produce about 2 false alarms on the
48-64 -16
first (P,C) pair.
With an additional 64 bits of known plaintext and ciphertext, the false alarm rate is reduced to 2 =2 .
If the meet-in-the-middle attack is performed on two blocks of known plaintext–ciphertext, the
-16
probability that the correct keys are determined is 1 – 2 .
The result is that a known plaintext attack will succeed against double DES, which has a key size of
56 55
112 bits, with an effort on the order of 2 , which is not much more than the 2 required for single DES
Triple DES
triple encryption method that uses
only two keys
The function follows an encrypt-
decrypt-encrypt (EDE) sequence
C = E(K1, D(K2, E(K1, P)))
There is no cryptographic significance
to the use of decryption for the second
stage.
advantage is that it allows users of 3DES
to decrypt data encrypted by users of the older single DES:
C = E(K1, D(K1, E(K1, P))) = E(K1, P)
Attacks on TDES
Known-Plaintext Attack on Triple DES
Three-key 3DES has an effective key length of 168 bits and is defined as follows:
C = E(K3, D(K2, E(K1, P)))
Backward compatibility with DES is provided by putting K3 = K2 or K1 = K2.
A number of Internet-based applications have adopted three-key 3DES, including PGP and S/MIME
www.BrainKart.com
Blowfish
Symmetric block cipher that can be effectively used for encryption and safeguarding of data
It takes a variable-length key, from 32 bits to 448 bits, making it ideal for securing data.
fast, free alternative to existing encryption algorithms
unpatented and license-free, and is available free for all uses
Blowfish Algorithm is a Feistel Network, iterating a simple encryption function 16 times.
The block size is 64 bits, and the key can be any length up to 448 bits.
Although there is a complex initialization phase required before any encryption can take place, the actual
encryption of data is very efficient on large microprocessors.
Blowfish is a variable-length key block cipher.
It is suitable for applications where the key does not change often, like a communications link or an
automatic file encryptor.
It is significantly faster than most encryption algorithms when implemented on 32-bit microprocessors with
large data caches
Feistel Networks
A Feistel network is a general method of transforming
any function (usually called an Ffunction) into a
permutation.
It was invented by Horst Feistel and has been used in
many block cipher designs.
The working of a Feistal Network is given below:
O Split each block into halves
O Right half becomes new left half
O New right half is the final result when the left half is
XOR’d with the result of applying f to the right half
and the key.
Note that previous rounds can be derived even if the
function f is not invertible
The Blowfish Algorithm:
I
The only additional operations are four indexed array data lookups per round
Subkeys
for i = 1 to 16:
xL = xL XOR Pi
xR = F(xL) XOR xR
Swap xL and xR
After the sixteenth round, swap xL and xR again to undo the last swap.
Then, xR = xR XOR P17 and xL = xL XOR P18.
Finally, recombine xL and xR to get the ciphertext.
Decryption
Exactly the same as encryption, except that P1, P2,..., P18 are used in the reverse order
1. Initialize first the P-array and then the four S-boxes, in order, with a fixed string.
This string consists of the hexadecimal digits of pi (less the initial 3): P1 = 0x243f6a88, P2 = 0x85a308d3, P3
= 0x13198a2e, P4 = 0x03707344, etc.
XOR P1 with the first 32 bits of the key, XOR P2 with the second 32-bits of the key, and so on for all bits of
the key (possibly up to P14). Repeatedly cycle through the key bits until the entire P-array has been XORed
with key bits. (For every short key, there is at least one equivalent longer key; for example, if A is a 64-bit key,
then AA, AAA, etc., are equivalent keys.)
Encrypt the all-zero string with the Blowfish algorithm, using the subkeys described in steps (1) and (2).
Replace P1 and P2 with the output of step (3).
Encrypt the output of step (3) using the Blowfish algorithm with the modified subkeys.
Replace P3 and P4 with the output of step (5).
Continue the process, replacing all entries of the P array, and then all four S-boxes in order, with the output
of the continuously changing Blowfish algorithm.
In total, 521 iterations are required to generate all required subkeys.
Applications can store the subkeys rather than execute this derivation process multiple times.
www.BrainKart.com
RC5
Introduction
a proprietary cipher owned by RSADSI
designed by Ronald Rivest (of RSA fame)
used in various RSADSI products
can vary key size / data size / no rounds
very clean and simple design
easy implementation on various CPUs
yet still regarded as secure
RC5 Ciphers
RC5 is a family of ciphers RC5-w/r/b
w = word size in bits (16/32/64) nb data=2w
O r = number of rounds (0..255)
O b = number of bytes in key (0..255)
nominal version is RC5-32/12/16
32-bit words so encrypts 64-bit data blocks
O using 12 rounds
with 16 bytes (128-bit) secret key
RC5 Encryption
split input into two halves A & B
L0 = A + S[0];
R0 = B + S[1];
for i = 1 to r do
Li = ((Li-1 XOR Ri-1) <<< Ri-1) + S[2 x i];
O Ri = ((Ri-1 XOR Li) <<< Li) + S[2 x i + 1];
RC5 Modes
RFC2040 defines 4 modes used by RC5
RC5 Block Cipher, is ECB mode
RC5-CBC, is CBC mode
RC5-CBC-PAD, is CBC with padding by bytes with value being the number of padding bytes
RC5-CTS, a variant of CBC which is the same size as the original message, uses ciphertext stealing
to keep size same as original.
www.BrainKart.com
Public-Key Cryptosystems
Introduction
The concept evolved from an attempt to attack two of the most difficult problems associated with
symmetric encryption
O Key Distribution
O The Digital Signatures
Called as Asymmetric Cryptography
Asymmetric algorithms make use of one key for encryption, another for decryption
Characteristics of Asymmetric algorithms
It is computationally infeasible to determine the decryption key given only knowledge of the
cryptographic algorithm and the encryption key
Either of the two related keys can be used for encryption, with the other used for decryption
Public-Key Cryptography
Six Ingredients
Plaintext: This is the readable message or data that is fed into the algorithm as input.
Encryption algorithm: The encryption algorithm performs various transformations on the plaintext.
Public and private keys: This is a pair of keys that have been selected so that if one is used for
encryption, the other is used for decryption. The exact transformations performed by the algorithm
depend on the public or private key that is provided as input.
Ciphertext: This is the scrambled message produced as output. It depends on the plaintext and the
key. For a given message, two different keys will produce two different ciphertexts.
Decryption algorithm: This algorithm accepts the ciphertext and the matching key and produces
the original plaintext.
Encryption
www.BrainKart.com
Authentication
Digital signature
The sender "signs" a message with its private key. Signing is achieved by a cryptographic algorithm applied
to the message or to a small block of data that is a function of the message.
Key exchange
Two sides cooperate to exchange a session key. Several different approaches are possible, involving
the private key(s) of one or both parties.
www.BrainKart.com
original message, M.
The two keys can be applied in either order: M = D[PUb, E(PRb, M)] = D[PRb, E(PUb, M)]
Public-Key Cryptanalysis
Three types of attacks
Brute force
Deducing the private key
Probale message attack
Brute force
find some way to compute the private key given the public key
So far, not been mathematically proven that this is infeasible for a particular public-key algorithm
Not been successful till date
Probale message attack
Encryption
Decryption
www.BrainKart.com
Encryption
Decryption
Brute force
This involves trying all possible private keys.
www.BrainKart.com
Timing attacks
These depend on the running time of the decryption algorithm.
Mathematical Attacks
Three approaches to attacking RSA mathematically:
To avoid values of n that may be factored more easily, the algorithm’s inventors
suggest the following constraints on p and q.
1/4
if e < n and d < n , then d can be easily determined
Timing Attack
This attack is alarming for two reasons:
O It comes from a completely unexpected direction
O it is a ciphertext-only attack
A timing attack is somewhat analogous to a burglar guessing the combination of a safe by observing
how long it takes for someone to turn the dial from number to number.
We can explain the attack using the modular exponentiation algorithm
modular exponentiation is accomplished bit by bit, with one modular multiplication performed at
each iteration and an additional modular multiplication performed for each 1 bit
Working of this attack
Ensure that all exponentiations take the same amount of time before returning a result.
This is a simple fix but does degrade performance
www.BrainKart.com
Random delay
Better performance could be achieved by adding a random delay to the exponentiation algorithm to confuse the
timing attack.
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 essential to the timing attack
www.BrainKart.com
Cryptography and
Network Security
Dr. B. Shanthini
Prof. & Head, IT Department
St. Peter’s College of Engineering & Technology
1
wwwwww..–..comcom
Unit 3 Outline
Authentication requirement
Authentication functions
MAC
Hash function
Security of hash function and MAC
MD5 and SHA
HMAC and CMAC
Digital signature and authentication
protocols
DSS – EI Gamal – Schnorr
www.BrainKart.com
Message Authentication
Message authentication is
concerned with:
– protecting the integrity of a message
– validating identity of originator
– non-repudiation of origin (dispute
resolution)
Will consider the security
requirements
Three functions used:
– Message Encryption
– Message Authentication Code (MAC)
– Hash Function
www.BrainKart.com
Security Requirements
Disclosure
Traffic analysis
Masquerade
Content modification
Sequence modification
Timing modification
Source repudiation
Destination repudiation
www.BrainKart.com
Message Encryption
Message encryption by itself also
provides a measure of
authentication
If symmetric encryption is used then:
– receiver knows sender must have
created it
since only sender and receiver know key
used
– knows content is not been altered
– if message has suitable structure,
redundancy or a checksum to detect any
changes
www.BrainKart.com
Message Encryption
Symmetric encryption: Confidentiality &
Authentication
Source A Destination B
M E D M
EK(M) K
K
www.BrainKart.com
Message Encryption
Message Encryption
Public-key encryption :
Confidentiality
Source A Destination B
M E D M
E (M)
KUb KUb KRb
www.BrainKart.com
Message Encryption
Public-key encryption : Authentication &
Signature
Source A Destination B
M E D M
E (M)
KRa KRa KUa
www.BrainKart.com
Message Encryption
Public-key encryption : Confidentiality, Authentication
& Signature
M E D D M
E
EKUb[EKRa(M)]
EKRa(M)
EKRa(M) KUa
KRa KUb KRb
www.BrainKart.com
Message Authentication
Code
www.BrainKart.com
Message Authentication
Codes
As shown the MAC provides authentication
Can also use encryption for secrecy
– generally use separate keys for each
– can compute MAC either before or after encryption
– is generally regarded as better done before
If only sender and receiver only knows secret
key and if MAC is matched then,
– Receiver is assured that the message has not been
altered
– Receiver is assured that the message is from the
alleged sender
– If message includes Sequence no. then the
receiver can be assured of the proper
sequence
www.BrainKart.com
Message Authentication
Codes
Message Authentication:
M K ||
Compare
C K
CK(M)
www.BrainKart.com
D
M K1 || E M C
Compare
C
K2 K2 K1
E [M || C (M)] CK1(M)
K2 K1
www.BrainKart.com
Message Authentication
Codes
EK2(M)
E D
K1 M
M || C
K2 C Compare K2
K1
CK1[EK2(M)]
www.BrainKart.com
Hash Functions
Condenses arbitrary message to fixed size
Hash code h = H(M)
Also called Message digest or Hash value
The hash function is public and not keyed (MAC
is keyed)
Hash code is a function of all bits of the
message
Change to any bit or bits in the message
results in a change to the Hash code
Most often to create a digital signature
Can use in various ways with message
www.BrainKart.com
Birthday Attacks
Might think a 64-bit hash is secure
But by Birthday Paradox is not
The birthday paradox can be stated as
follows:
– What is the minimum value of k such that the
probability is greater than 0.5 that at least two
people in a group of
k people have the same birthday?
– It turns out that the answer is 23 which
is quite a surprising result.
– In other words if there are 23 people in a
room, the probability that two of them have
the same birthday is
approximately 0.5.
– If there is 100 people (i.e. k=100) then the
probability is
.9999997, i.e. you are almost guaranteed
that there will be a duplicate.
www.BrainKart.com
Birthday Attacks
Digital signatures can be susceptible to a
birthday attack.
A message is typically signed by first computing ,
where is a cryptographic hash function, and
then using some secret key to sign .
• Suppose Mallory wants to trick Bob into signing
a fraudulent contract.
Mallory prepares a fair contract and a fraudulent
one .
She then finds a number of positions where can
be changed without changing the meaning,
such as inserting commas, empty lines, one
versus two spaces after a sentence, replacing
synonyms, etc.
www.BrainKart.com
Birthday Attacks
By combining these changes, she can create a
huge number of variations on which are all fair
contracts.
In a similar manner, Mallory also creates a huge
number of variations on the fraudulent
contract .
She then applies the hash function to all these
variations until she finds a version of the fair
contract and a version of the fraudulent
contract which have the same hash value, .
She presents the fair version to Bob for signing.
After Bob has signed, Mallory takes the signature
and attaches it to the fraudulent contract.
This signature then "proves" that Bob signed the
fraudulent contract.
www.BrainKart.com
Birthday Attacks
Might think a 64-bit hash is secure
But by Birthday Paradox is not
Birthday attack works thus:
m/
– opponent generates 2 2 variations of a valid
message all with essentially the same meaning
m/
– opponent also generates 2 2 variations
of a desired fraudulent message
– two sets of messages are compared to find
pair with same hash (probability > 0.5 by
birthday paradox)
– user sign the valid message, then substitute
the forgery which will have a valid signature
Conclusion is that need to use larger
MAC/hash
www.BrainKart.com
MD5 Overview
www.BrainKart.com
MD5 Overview
Append Padding Bits:
0 Pad message so its length is 448 mod
512
ie the length of padded message is 64 bits
less than an integer multiple of 512 bits.
0 Padding is always added
1 For eg. If the message is 448 bits long, it
is padded by 512 bits to a length of 960
bits
2 The number of padding bits is in the
range of 1-512
3 Padding consists of single 1-bit followed
by the necessary no of 0-bits
www.BrainKart.com
MD5 Overview
Append Length:
A 64-bit length value of original
message is appended to the result
of step 1.
If64
the original message is greater than
2 then only the lower order 64 bits of
the length are used.
Thus the field contains length of
the original message
MD5 Overview
Process message in 512-bit (16-word) blocks:
(Compression
Function)
– Using 4 rounds of 16 bit operations on message
block & buffer
– These 4 rounds have similar structures but uses
different logical functions, F, G, H and I
– Each round takes the current 512-bit block (Yq)
and 128-bit buffer value ABCD as input and
updates the contents of the buffer.
– Each round also makes use of the one fourth of a
64-element
ta le T[1…64] o stru ted fro si e fu tio .
th 32
– The i element of T, T[i] = 2 x abs(sin(i)) (i is in
radians)
– The output of the fourth round is added to the input
to the first round (CVq) to produce CVq+1.
32
– This addition is done using addition modulo 2 .
www.BrainKart.com
MD5 Overview
Output:
After all L 512-bit blocks have been processed, the
th
output from the L stage is the 128-bit message
digest.
Behavior of MD5 can be
summarized: CV0 = IV
CVq+1 = SUM32[CVq, RFI(Yq, RFH(Yq,RFG(Yq,
RFF(Yq, CVq))))] where
IV = Initial value of ABCD buffer
Yq = qth 512-bit block of the
message L = No. of blocks in
the message
CVq = Chaining Variable processed with qth block
RFx = Round Function using primitive legal fn x
MD = Final message digest
32
SUM32 = Addition modulo 2
www.BrainKart.com
MD5 Compression
Function
Each round has 16 steps of the form:
b = b+((a + g(b,c,d)+ X[k]+T[i])<<< s)
Where
a,b,c,d = the 4 words of the buffer
g = one of the primitive fn F, G, H, I
<<<s = circular left shift of the 32-bit argument by
s Bits
X[k] = M[q x 16 + k] = kth 32-bit word in the qth 512-
bit block of the message
X[i] = In the first round – used in their
original order p2[i] = (1 + 5i)
mod 16
p3[i] = (5 + 3i) mod 16
p4[i] = 7i mod 16
T[i] = ith 32-bit word in matrix T + = Addition modulo
32
2
www.BrainKart.com
MD5 Compression
Function
www.BrainKart.com
Functions F, G, H and I
G(b, c,
Round Primitive Fn. g d)
(bc)(~b
1 F(b,c,d) d)
(b d) (c
2 G(b,c,d) ~ d)
bc
3 H(b,c,d) d
c(b
4 I(b,c,d) ~d)
www.BrainKart.com
SHA-512 Overview
www.BrainKart.com
SHA-512 Overview
Append Padding Bits:
Pad message so its length is congruent to 1024
necessary no of 0-bits
Append Length:
A 128-bit length value of original
Thus the field contains length of
the original message
www.BrainKart.com
SHA-512
512 bit message digest (secure against brute force
attack)
– Block size: 1024 bits
RotShift i-j-k
Right rotation j bits
Left shift k bits
(adding 0’s to end)
0 0 0 0 0
47
www.BrainKart.com
SHA-512 Compression
Function
80 rounds
– Each creates new
ter ediate
message digest
Final stage is sum
64
(mod 2 ) of:
– Initial round digest
– Final round digest
49
www.BrainKart.com
SHA-512 Compression
Function
Each round
i function
of:
Previous
message
digest
Word Wi
Rou d ke Ki
created from
fractional parts
of square root
of first 80 prime
numbers (like
initial message
digest values)
50
www.BrainKart.com
SHA-512 Round
Function
www.BrainKart.com
Dr. B. Shanthini
www.BrainKart.com
HMAC
Uses a MAC derived from a
cryptographic hash code, such
as SHA-1.
Motivations:
–Cryptographic hash functions
executes faster in software than
encryptoin algorithms such as
DES
–Library code for cryptographic
hash functions is widely available
–No export restrictions from
the US 55
www.BrainKart.com
HMAC Overview
+ +
HMACK = H[(K opad)||H[(K ipad)||M]]
H = hash function
M = Message
Yi = ith block of M, 0 ≤ i ≤ L-1
L = no. of blocks in M
b = no. of bits in a block (based on chosen
n
hash f )
n = length of hash code
K = secret key
+
K = K padded with zeros on the left so
that the length is b bits
ipad = 00110110(0x36) repeated b/8 times
opad = 01011010(0x5C) repeated b/8 times
Dr. B. Shanthini
www.BrainKart.com
HMAC Advantages
Existing hash function can be implemented in HMAC
Easy to replace with more secure or updated hash
algorithm
HMAC is proven more secure than hash algorithms
HMAC Security
Proved security of HMAC relates to that of the
underlying hash algorithm
Attacking HMAC requires either:
– brute force attack on key used
– birthday attack (but since keyed would need to
observe a very large number of messages)
Choose hash function used based on speed verses
security
constraints
Dr. B. Shanthini
www.BrainKart.com
CMAC (Cipher-based
MAC)
Hashless MAC
– Uses an encryption algorithm (DES,
AES, etc.) to generate MAC
– Based on same idea as cipher
block chaining
Compresses result to size of single
block (unlike encryption
www.BrainKart.com
CMAC Overview
CMAC Facts
Advantages:
– Can use existing encryption functions
– Encryption functions have properties that
resist pre-image and collision attacks
• Cipher te t desig ed to appear like
ra do
oise
– good approximation of random oracle
model
0Most exhibit strong avalanche effect –
minor change in message gives great
change in resulting
MAC
Disadvantage:
– Encryption algorithms (particularly when
chained) can
be much slower than hash
algorithms 60
www.BrainKart.com
Cryptography amd
Network Security
Dr. B. Shanthini
Prof. & Head, IT Department
St. Peter’s College of Engineering & Technology
1
wwwwww..–..comcom
Unit 3 Outline
Authentication requirement
Authentication functions
MAC
Hash function
Security of hash function and MAC
MD5 and SHA
HMAC and CMAC
Digital signature and authentication
protocols
DSS – EI Gamal – Schnorr
www.BrainKart.com
Authentication
Protocols
Replay Attacks
Examples of replay attacks:
– simple replay (copies message and replays)
– repetition that can be logged (within time
frame)
– repetition that cannot be detected
(Actual msg suppressed)
– backward replay without modification (to
sender)
Countermeasures include
– use of sequence numbers (generally
impractical)
– timestamps (needs synchronized clocks)
– challenge/response (using unique nonce)
Dr. B. Shanthini
www.BrainKart.com
Mutual Authentication
Using Symmetric
Encryption
A two-level hierarchy of keys are used.
Usually with a trusted Key Distribution
Center (KDC)
– each party shares own master key with KDC
– KDC generates session keys used for
connections between parties
– master keys used to distribute the session
keys to them
Dr. B. Shanthini
www.BrainKart.com
Needham-Schroeder
Protocol
Original third-party key distribution
protocol
For session between A and B mediated
by KDC
Protocol overview is:
1
. A→KDC : IDA || IDB || N1
: EKa[Ks || IDB || N1 || EKB[KS||
2. KDC→A IDA] ]
3
. A→B : EKB[KS||IDA]
4. B→A : EKS[N2]
5
. A→B : EKS[f(N2)]
Dr. B. Shanthini
www.BrainKart.com
Needham-Schroeder
Protocol
Mutual Authentication
Using Public-Key
Encryption
Denning AS Protocol
Denning presented the following:
A→AS : IDA || IDB
AS→A : EKRas[IDA||KUA||T] ||
EKRas[IDB||KUB||T]
3. A→B : EKRas[IDA||KUA||T] ||
EKRas[IDB||KUB||T] ||
EKUb[EKRa[KS||T]]
Note session key is chosen by A, hence AS
need not be trusted to protect it
Timestamps prevent replay but
require synchronized clocks
Dr. B. Shanthini
www.BrainKart.com
One-Way
Authentication
Using Symmetric
Encryption
• Can refine use of KDC ut an’t
have final
exchange of nonces, vis:
1
. A→KDC : IDA || IDB || N1
2. : EKa[Ks || IDB || N1
KDC→A ||
EKB[KS||IDA] ]
3 A→B : EKB[KS||IDA] ||
. EKs[M]
Does not protect against replays
– could rely on timestamp in message,
though email delays make this
problematic
Dr. B. Shanthini
www.BrainKart.com
Public-Key
Approaches
Dr. B. Shanthini
www.BrainKart.com
Digital Signatures
Inclusion: A conventional signature is included in
the document; it is part of the document.
But when we sign a document digitally, we send the
signature as a separate document.
Verification: For a CS, when the recipient receives a
document, she compares the signature on the
document with the signature on file.
For a DS, the recipient receives the message and the
signature. The recipient needs to apply a verification
technique to the combination of the message and the
signature to verify the authenticity.
13.13
www.BrainKart.com
Digital Signatures
Relationship: For a CS, there is normally a one-
to-many relationship between a signature and
documents.
For a DS, there is a one-to-one relationship between
a signature and a message.
Duplicity: In CS, a copy of the signed document
can be distinguished from the original one on file.
In DS, there is no such distinction unless there is a
factor of time on the document.
www.BrainKart.com
www.BrainKart.com
www.BrainKart.com
Digital Signature
Properties
Key-
only
attac
k
Known
messa
ge
attac
k
Generi
c
chosen
messa
ge
attack
Directe
d
chosen
messa
ge
attack
www.Brai
nKart.co
m
C is given access to a set of messages
At and their signatures
C chooses a list of messages before
ta attempting to
ck break A’s signature scheme,
independent of A’s
s public key; C then obtains from A valid
signatures for the chosen messages
Similar to the generic attack, except that
C the list of messages to be signed is
only chosen after C knows A’s
public key but before any signatures are
know seen
s A’s
publi C may request from A signatures of
messages that depend on previously
c key obtained message- signature pairs
www.BrainKart.com
Forgeries
Universal
forgery Selective Existential
forgery forgery
Total break
C finds an
C • C forges
determines efficient • C forges a a
A’s signature
private signing signature for for
key at least
algorithm a particular one
message;
that provides message C
an equivalent chosen by C has no
control
way of over
constructing the
message
signatures on
arbitrary
messages
www.BrainKart.com
Digital Signature
Requirements
The signature must be a bit pattern that depends on the message
being signed
The signature must use some information unique to the sender
to prevent both forgery and denial
It must be relatively easy to produce the digital signature
It must be relatively easy to recognize and verify the digital
signature
It must be computationally infeasible to forge a digital
signature, either by constructing a new message for an existing
digital signature or by constructing a fraudulent digital signature
for a given message
It must be practical to retain a copy of the digital signature in
storage
www.BrainKart.com
ELGamal Cryptosystem
The ElGamal Algorithm provides an alternative to
the RSA for public key encryption.
Security of the RSA depends on the difficulty
of factoring large integers.
Security of the ElGamal depends on the
difficulty of computing discrete logs
in a large prime modulus.
ElGamal has the disadvantage that the cipher
text is twice as long as the plaintext.
It has the advantage the same plaintext gives a
different cipher text (with near certainty) each
time it is encrypted.
Dr. B. Shanthini 21
www.BrainKart.com
ELGamal
Cryptosystem
Dr. B. Shanthini 22
www.BrainKart.com
ELGamal
Cryptosystem
Dr. B. Shanthini 23
www.BrainKart.com
ELGamal
Cryptosystem
Dr. B. Shanthini 24
www.BrainKart.com
ELGamal
Cryptosystem
Dr. B. Shanthini 25
www.BrainKart.com
ElGamal Example
pA=11 and ᵅA=2
Alice computes her key:
– chooses dA=5 & computes ᵝA=25 mod 11 = 10
– Public Key = (11, 2, 10)
– Private Key = (5)
Bob send message m=1 as (9,1) by
– chosing random k=6
– computing r = ᵅ Ak mod pA = 26 mod 11 = 9
– computing t = ᵝ Ak.m mod pA = 106.1 mod 11 = 1
Alice recovers original message by
computing:
– m = tr-dA mod pA = 1.910-5 mod 11 = 1
Dr. B. Shanthini 26
www.BrainKart.com
ElGamal Example
pA=19 and ᵅA=10
Alice computes her key:
– A chooses dA=5 & computes ᵝA=105 mod 19 = 3
– Public Key = (19, 10, 3)
– Private Key = (5)
Bob send message m=17 as (11,5) by
– chosing random k=6
– computing r = ᵅ Ak mod pA = 106 mod 19 = 11
– computing t = ᵝ Ak.m mod pA = 36 . 17 mod 19 = 5
Alice recovers original message by
computing:
– m = tr-dA mod pA = 5.1118-5 mod 19 = 17
Dr. B. Shanthini 27
www.BrainKart.com
Schnorr Digital
Signature
Scheme is based on discrete logarithms
Minimizes the message-dependent amount of
computation required to generate a signature
Multiplying a 2N-bit integer with an N-bit integer
•Main work can be done during the idle time of the
processor
•Based on using a prime modulus P, with P – 1 having
a prime factor Q of appropriate size
Typically P is a 1024-bit number, and Q is a 160-bit
number
www.BrainKart.com
Schnorr Digital
Signature
Generation of Private-Public Key Pair:
Choose prime p and q, such that q is a prime
factor of p-1.
q
Choose an integer a, such that a =1 mod p. (a,
p and q are the global public keys
and common to all users of a group)
Choose a random integer s with 0<s<q.
(This ‘s’ is user’s private key)
-s
Calculate v=a mod p.
(This ‘v’ is user’s public key)
www.BrainKart.com
Schnorr Digital
Signature
Generation of signature with Private-
Public Key Pair (s-v):
Choose a random integer r with 0<r<q and
r
compute x = a mod p.
Concatenate the message M with x and hash the
result to compute the value e = H(M||x)
Compute y = (r+se) mod q.
Schnorr Digital
Signature
Signature verification by any other user:
y e
Compute x’ = a v mod p.
Verify that e = H(M||x’)
To Prove this:
y e y -se y-se r
x’ = a v = a a =a = a = x (mod p)
Cryptography and
Network Security
Dr. B. Shanthini
Prof. & Head
St. Peter’s College of Engineering & Technology 1
www.BrainKart.com
Unit 4 – Outline
Authentication applications:
– Kerberos SET for E-Commerce
Transactions
– X.509
Intruder
Authentication services
Intrusion detection
Internet Firewalls for system
Trusted System: Virus and related threats
– Roles of Firewalls
Countermeasures
– Firewall related terminology Trusted systems
– Types of Firewalls Practical implementation of
– Firewall designs cryptography and security.
Security Concerns
• Key concerns are confidentiality and
timeliness
To provide confidentiality must encrypt
identification and session key info
Which requires the use of previously shared
private or public keys
Need timeliness to prevent replay attacks
Provided by using sequence numbers or
timestamps or challenge/response
www.BrainKart.com
KERBEROS
KERBEROS
Users wish to access services on servers.
Three threats exist:
– User pretends to be another user.
– User alter the network address of a workstation.
– User eavesdrop on exchanges and use a replay
attack.
www.BrainKart.com
Kerboros
Provides a centralized authentication server
to authenticate users to servers and servers
to users.
Relies on conventional encryption, making
no use of public-key encryption
Two versions: version 4 and 5
Version 4 makes use of DES
www.BrainKart.com
Kerberos
Motivation: 3 Approaches
Rely on each individual client to assure the
identity of the user to enforce security
policy based on user identification.
Require that client systems
authenticate themselves to servers
Require that the user to prove his or her
identity for each service invoked
www.BrainKart.com
Kerberos
Motivation: Requirements
– Secure: Eavesdropper should not be able to
obtain the necessary info. to impersonate a user.
– Reliable: Should be highly reliable and should
employ a distributed server architecture with
one system able to back up another.
– Transparent: User should not be aware that
authentication is taking place beyond the
requirement to enter the password.
– Scalable: System should be capable of supporting
large numbers of clients and servers.
www.BrainKart.com
Kerberos Version 4
Terms:
– C = Client
– AS = authentication server
– V = server
– IDc = identifier of user on C
– IDv = identifier of V
– Pc = password of user on C
– ADc = network address of C
– Kv = secret encryption key shared by AS an V
– TS = timestamp
– || = concatenation
www.BrainKart.com
Problems:
– User would need a new ticket for every
different service.
– Since the plaintext transmission of the
password is involved, an eavesdropper could
capture the pw and use any accessible service.
Lifetime associated with the ticket-granting ticket
If too short repeatedly asked for password
If too long greater opportunity to replay
www.
www.
Problems:
Lifetime associated with the ticket-granting ticket
0 If too short repeatedly asked for password
1 If too long greater opportunity to replay
There may be a requirement for servers
to authenticate themselves to users.
www.BrainKart.com
Overview of Kerberos
www.BrainKart.com
Kerberos Exchanges
www.BrainKart.com
X.509 Formats
www.BrainKart.com
X.509 CA Hierarchy
www.BrainKart.com
Revocation of Certificates
Reasons for revocation:
– The users secret key is assumed to be
compromised.
– The user is no longer certified by this CA.
– The CA’s certificate is assumed to
be compromised.
www.BrainKart.com
Authentication Procedures
www.BrainKart.com
Firewalls
www.BrainKart.com
Firewall
www.BrainKart.com
Characteristics of Firewalls
Service control: Determines the types of Internet services that
can be accessed, inbound or outbound. The firewall may filter
traffic on the basis of IP address, protocol, or port number.
Direction control: Determines the direction in which particular
service requests may be initiated and allowed to flow through
the firewall.
User control: Controls access to a service according to which
user is attempting to access it.
Behavior control: Controls how particular services are used.
For example, the firewall may filter e-mail to eliminate spam,
or it may enable external access to only a portion of the
information on a local Web server.
www.BrainKart.com
Capabilities of Firewalls
A firewall defines a single choke point that keeps
unauthorized users out of the protected network,
prohibits potentially vulnerable services from entering
or leaving the network, and provides protection from
various kinds of IP spoofing and routing attacks.
A firewall provides a location for monitoring security-
related events like auditing and alarms.
A firewall is a convenient platform for several Internet
functions that are not security related like network
address translator and network mgmt. function.
A firewall can serve as the platform for IPSec and
virtual private networks.
www.BrainKart.com
Limitations of Firewalls
The firewall cannot protect against attacks that
bypass the firewall.
The firewall may not protect fully against internal
threats, such as a disgruntled employee or an
employee who unwittingly cooperates with an
external attacker.
An improperly secured wireless LAN may be
accessed from outside the organization.
A laptop, PDA, or portable storage device may be
used and infected outside the corporate network,
and then attached and used internally.
www.BrainKart.com
Types of Firewalls
Packet Filtering Firewall
A firewall may act as a packet filter.
It can operate as a positive filter, allowing to pass
only packets that meet specific criteria, or as a
negative filter, rejecting any packet that meets
certain criteria.
A packet filtering firewall applies a set of rules to
each incoming and outgoing IP packet and then
forwards or discards the packet.
The firewall is typically configured to filter packets
going in both directions.
www.BrainKart.com
Packet Filtering Firewall
The packet filter is typically set up as a list of rules
based on matches to fields in the IP or TCP header.
If there is a match to one of the rules, that rule is
invoked to forward or discard the packet.
If there is no match to any rule, then a default action
is taken.
Two default policies are possible:
– Default = discard: That which is not expressly permitted
is prohibited.
– Default = forward: That which is not expressly
prohibited is permitted.
www.BrainKart.com
Packet Filtering Firewall
Stateful Inspection Firewall
A packet filtering firewall permit inbound network
traffic on all high-numbered ports for TCP-based
traffic to occur.
This creates a vulnerability that can be exploited by
unauthorized users.
A stateful inspection packet firewall tightens up the
rules for TCP traffic by creating a directory of
currently established outbound TCP connections
The packet filter will now allow incoming traffic to
high-numbered ports only for those packets that fit the
profile of one of the entries in this directory.
www.BrainKart.com
Stateful Inspection Firewall
A stateful packet inspection firewall reviews the same
packet information as a packet filtering firewall, but
also records information about TCP connections.
Some stateful firewalls also keep track of TCP
sequence numbers to prevent attacks that depend on
the sequence number, such as session hijacking.
Some even inspect limited amounts of application
data for some well-known protocols like FTP, IM and
SIP commands, in order to identify and track related
connections.
www.BrainKart.com
Application Level Gateway
If the gateway does not implement the proxy
code for a specific application, the service is
not supported and cannot be forwarded across
the firewall.
Further, the gateway can be configured to
support only specific features of an
application that the network administrator
considers acceptable while denying all other
features.
www.BrainKart.com
Application Level Gateway
Application Level Gateway
Circuit Level Gateway
A fourth type of firewall is the circuit-level gateway or
circuit-level proxy.
This can be a stand-alone system or it can be a
specialized function performed by an application-
level gateway.
As with an application gateway, a circuit-level
gateway does not permit an end-to-end TCP
connection.
Rather, the gateway sets up two TCP connections,
one between itself and a TCP user on an inner host and
one between itself and a TCP user on an outside host.
www.BrainKart.com
Circuit Level Gateway
Once the two connections are established, the
gateway typically relays TCP segments from
one connection to the other without examining
the contents.
The security function consists of determining
which connections will be allowed.
A typical use of circuit-level gateways is a
situation in which the system administrator
trusts the internal users.
www.BrainKart.com
Circuit Level Gateway
SET
www.BrainKart.com
SET Services
SET Overview
SET Participants
Card Holder: Authorized holder of a payment card that has been
issued by an issuer.
Merchant: Person or organization that has goods or services to sell to
the cardholder.
Issuer: Financial institution (bank) that provides the cardholder with
the payment card.
Acquirer: Financial institution that establishes an account with a
merchant and processes payment card authorizations and payments.
Dual Signature
Payment processing
Purchase Request
– Initiate Request – customer to merchant
– Initiate Response – merchant’s certificate and PG’s certificate
– Purchase Request – shown in the next slide
– Purchase Response - acknowledgement
Payment Authorization:
– Authorization Request – merchant to PG
– Authorization Response – PG to the merchant
Payment Capture:
– Capture Request – merchant to PG
– Capture Response – PG to merchant (acquirer)
www.
Payment processing
www. .com
Payment processing
Intruders
www.BrainKart.com
Intruders
Three classes of intruders (hackers or crackers):
– Masquerader-an individual who is not authorized to use
the computer and who penerates a system’s access
controls to exploit a legitimate user’s account
– Misfeasor-a legitimate user who accesses data, programs
or resources for which such access is not authorized
– Clandestine user-an individual who seizes supervisory
control of the system and uses this control to evade
auditing and access controls or to suppress audit collection
70
www.BrainKart.com
Intrusion Techniques
System maintain a file that associates a
password with each authorized user.
Password file can be protected with:
– One-way encryption
– Access Control
71
www.BrainKart.com
Intrusion Techniques
Techniques for guessing passwords:
Try default passwords.
Try all short words, 1 to 3 characters long.
Try all the words in an electronic dictionary(60,000).
Collect information about the user’s hobbies, family
names, birthday, etc.
Try user’s phone number, social security number,
street address, etc.
Try all license plate numbers (MUP103).
Use a Trojan horse
Tap the line between a remote user and the host
system.
Prevention: Enforce good password selection (Ij4Gf4Se%f#)
72
www.BrainKart.com
74
www.BrainKart.com
75
www.BrainKart.com
Definitions
A “Bacteria” replicates until it fills all disk space, or
CPU cycles.
Worm - a program that replicates itself across the
network (usually riding on email messages or
attached documents (e.g., macro viruses).
Virus - code that copies itself into other programs.
Payload - harmful things the malicious program does,
after it has had time to spread.
76
www.BrainKart.com
Definitions
Trojan Horse - instructions in an otherwise good program
that cause bad things to happen (sending your data or
password to an attacker over the net).
Logic Bomb - malicious code that activates on an event
(e.g., date).
Trap Door (or Back Door) - undocumented entry point
written into code for debugging that can allow unwanted
users.
Easter Egg - extraneous code that does something “cool.”
A way for programmers to show that they control the
product.
77
www.BrainKart.com
Virus Phases
Dormant phase - the virus is idle, will be
activated by some events like date
Propagation phase - the virus places an identical
copy of itself into other programs
Triggering phase – the virus is activated to
perform the function for which it was intended
Execution phase – the function is performed
78
www.BrainKart.com
Virus Protection
Have a well-known virus protection program, configured to
scan disks and downloads automatically for known viruses.
programs, if possible.
79
www.BrainKart.com
Virus Structure
Henric Johnson 80
www.BrainKart.com
A Compression Virus
81
www.BrainKart.com
Types of Viruses
Parasitic Virus - attaches itself to executable files as part of their
code and replicates. Runs whenever the host program runs.
Boot Sector Virus - infects the boot sector of a disk, and spreads
when the operating system boots up (DOS viruses).
Macro Viruses
Microsoft Office applications allow “macros”
to be part of the document. The macro could run
whenever the document is opened, or when a
certain command is selected (Save File).
Platform independent.
Infect documents, delete files, generate email and
edit letters.
Easily spread, common method is emails
83
www.BrainKart.com
Email Viruses
84
www.BrainKart.com
Antivirus Approaches
Goals: Detection
Identification
Removal
1st Generation, Scanners: searched files for any of a library of known
virus “signatures.” Checked executable files for length changes.
3rd Generation, Activity Traps: stay resident in memory and look for
certain patterns of software behavior (e.g., scanning files).
4th Generation, Full Featured: combine the best of the techniques above.
85
www.BrainKart.com
86
www.BrainKart.com
87
www.BrainKart.com
Trusted Systems
www.BrainKart.com
Multi-Level Systems
Is validated for handling subjects and objects with
different rights and levels of security
simultaneously
Major features of such systems include:
0user identification and authentication
1resource access control and object labelling
2audit trails of all security relevant events
3external validation of the systems security
www.BrainKart.com
Network Security
Dr. B. Shanthini
Professor and Head
St. Peter’s College of Engineering & Technology 1
www.BrainKart.com
Unit 5 - Outline
E-mail Security: Security Services for E-mail-
attacks possible through E-mail - establishing
keys privacy-authentication of the source-
Message Integrity-Non-repudiation-Pretty
Good Privacy-S/MIME.
IPSecurity: Overview of IPSec - IP and IPv6-
Authentication Header-ESP-Internet Key
Exchange (Phases of IKE, ISAKMP/IKE
Encoding).
Web Security: SSL/TLS Basic Protocol-
computing the keys- client authentication-PKI
as deployed by SSL Attacks fixed in v3-
Exportability-Encoding-
Secure Electronic Transaction (SET). 2
www.BrainKart.com
Email Security
www.BrainKart.com
PGP Operation
Consists of 5 services:
Authentication
Confidentiality
Compression
E-mail Compatibility
Segmentation
www.BrainKart.com
Authentication Only
www.BrainKart.com
Confidentiality Only
www.BrainKart.com
Authentication
www.BrainKart.com
www.BrainKart.com
E-mail Compatibility
The scheme used is radix-64 conversion
The use of radix-64 expands the message
by 33%.
www.www.
–
(Secure/Multipurpose Internet
Mail Extensions)
Security enhancement to MIME email
– Original Internet RFC822 email was text only
– MIME provided support for varying content
types & multi-part messages with encoding of
binary data to textual form
– S/MIME adds security enhancements
Have S/MIME support in many mail agents
– eg MS Outlook, Mozilla, Mac Mail etc
www.BrainKart.com
RFC 822
Defines the format for the text messages that are
sent through e-mail
In RFC 822 messages have envelope and contents
Envelope contains information needed to accomplish
transmission and delivery
Contents compose the object to be delivered to
the recipient
Message contains some header lines followed by
unrestricted text
Header is separated by the body by a blank line
Header line consists of a keyword, followed by a
colon, followed by the keyword’s arguments
Frequently used keywords are From, To, Subject and
Date
Ex. From : “William Stallings” <[email protected]>
MIME
www.www .
MIME Overview
Audio Basic
Application Post Script
Octet Stream
www.BrainKart.com
S/MIME Functions
Enveloped data
– Encrypted content and associated keys
Signed data
– Encoded message + signed digest
Clear-signed data
– Clear text message + encoded signed digest
Signed & enveloped data
– Nesting of signed & encrypted entities
www.BrainKart.com
Enveloped Data
Steps for preparing an Enveloped Data:
Generate a pseudorandom session key for a particular
symmetric encryption algorithm (RC2/40 or Triple
DES)
For each recipient, encrypt the session key with the
recipient’s public RSA key and share it with them.
For each recipient, prepare a block RecipientInfo that
contains an identifier of the recipient’s public-key
certificate, an identifier of the algorithm used to
encrypt the session key and the encrypted session
key.
Encrypt the message content with the session key.
www.BrainKart.com
Signed Data
Steps for preparing an Signed Data:
Select a message digest algorithm (SHA or MD5)
Compute the message digest, or hash function of the
content to be signed.
Encrypt the message digest with the signer’s
private key.
Prepare a block, SignerInfo that contains the
signer’s public-key certificate, an identifier of
the message digest algorithm, an identifier of the
algorithm used to encrypt the message digest and
the encrypted message digest.
www.BrainKart.com
Registration Request
An application or user will apply to a
certification authority for a public-key
certificate.
A Certification Request including
certificationRequestInfo block, an
identifier of the public-key encryption
algorithm, the signature of the
certificationRequestInfo block, a name of
the certificate subject and the user’s public
key is sent using application/pkcs10.
www.BrainKart.com
Certificates-only Message
Certificate Authorities
Have several well-known CA’s
Verisign one of most widely used
Verisign issues several types of Digital IDs
increasing levels of checks & hence trust
Class Identity Checks Usage
1 name/email check web browsing/email
2 + enroll/addr check email, subs, s/w validate
3 + ID documents e-banking/service access
www.BrainKart.com
IP Security
www.BrainKart.com
Outline
TCP/IP Example
www.BrainKart.com
IPv4 Header
www.BrainKart.com
IPv6 Header
www.BrainKart.com
IP Security Overview
IP Security Overview
Applications of IPSec
– Secure branch office connectivity
over the Internet
– Secure remote access over the Internet
– Establishing extranet and intranet
connectivity with partners
– Enhancing electronic commerce security
www.BrainKart.com
IP Security Scenario
www.BrainKart.com
IP Security Overview
Benefits of IPSec
– Transparent to applications (below transport
layer (TCP, UDP)
– Provide security for individual users
IPSec can assure that:
– A router or neighbor advertisement comes from
an authorized router
– A redirect message comes from the router to
which the initial packet was sent
– A routing update is not forged
www.BrainKart.com
IP Security Architecture
IPSec documents:
– RFC 2401: An overview of
security architecture
– RFC 2402: Description of a packet
encryption extension to IPv4 and IPv6
– RFC 2406: Description of authentication
extension to IPv4 and IPv6
– RFC 2408: Specification of
key managament capabilities
www.BrainKart.com
IPSec Services
Access Control
Connectionless integrity
Data origin authentication
Rejection of replayed packets
Confidentiality (encryption)
Limited traffic flow confidentiallity
www.BrainKart.com
IPSec Services
www.BrainKart.com
SA Parameterswww.
Transport Mode
•Transport mode provides protection primarily for upper-layer protocols.
•Examples include a TCP or UDP segment or an ICMP packet, all of
which operate directly above IP in a host protocol stack.
•Used for end-to-end communication between two hosts •When a host
runs AH or ESP over IPv4, the payload is the data that normally follow
the IP header.
•For IPv6, the payload is the data that normally follow both the IP
header and any IPv6 extensions headers that are present, with the
possible exception of the destination options header.
•ESP in transport mode encrypts and optionally authenticates the IP
payload but not the IP header.
•AH in transport mode authenticates the IP payload and selected
portions of the IP header.
www.BrainKart.com
Tunnel Mode
•Tunnel mode provides protection to the entire IP packet.
•To achieve this, after the AH or ESP fields are added to the IP packet,
the entire packet plus security fields is treated as the payload of new
"outer" IP packet with a new outer IP header.
•The entire original, or inner, packet travels through a "tunnel" from
one point of an IP network to another.
•Because the original packet is encapsulated, the new, larger packet
may have totally different source and destination addresses, adding to
the security.
•Tunnel mode is used when one or both ends of an SA are a security
gateway, such as a firewall or router that implements IPSec.
www.BrainKart.com
Before applying AH
www.BrainKart.com
Transport Mode
(AH Authentication)
www.BrainKart.com
Tunnel Mode
(AH Authentication)
www.BrainKart.com
Authentication Header
Provides support for data integrity and
authentication (MAC code) of IP packets.
Guards against replay attacks.
www.BrainKart.com
Encryption and
Authentication Algorithms
Encryption:
– Three-key triple DES
– RC5
– IDEA
– Three-key triple IDEA
– CAST
– Blowfish
Authentication:
– HMAC-MD5-96
– HMAC-SHA-1-96
www.BrainKart.com
associations
www.BrainKart.com
Combinations of Security
Associations
www.BrainKart.com
Combinations of Security
Associations
www.BrainKart.com
Combinations of Security
Associations
www.BrainKart.com
Key Management
Two types:
– Manual
– Automated
0 Oakley Key Determination Protocol
1 Internet Security Association and Key
Management Protocol (ISAKMP)
www.BrainKart.com
WEB Security
www.BrainKart.com
Outline
Web Security Considerations
Secure Socket Layer (SSL) and
Transport Layer Security (TLS)
Secure Electronic Transaction (SET)
www.BrainKart.com
SSL Architecture
www.BrainKart.com
Handshake Protocol
The most complex part of SSL.
Allows the server and client to
authenticate each other.
Negotiate encryption, MAC algorithm
and cryptographic keys.
Used before any application data are
transmitted.
www.BrainKart.com
Message Types
Code Description
0 HelloRequest
1 ClientHello
2 ServerHello
11 Certificate
12 ServerKeyExchange
13 CertificateRequest
14 ServerHelloDone
15 CertificateVerify
16 ClientKeyExchange
20 Finished
www.BrainKart.com