Unit Iii
Unit Iii
Authentication 4.
requirements
8.
5.
7. 6.
Authentication Functions
• Two levels of functionality.
Lower Level
A value to be used to authenticate a message.
Higher Level
A receiver to verify the authenticity of a message.
Types of functions
1) Message encryption
2) Hash function
3) Message authentication code (MAC)
Authentication Functions
• Two levels of functionality.
A value to be used to authenticate a message.
Higher Level
Types of functions
1)
2)
3)
Message encryption
Message encryption by itself can provide a measure of authentication.
The analysis differs for symmetric and public-key encryption schemes.
Symmetric
Symmetric Encryption provides the confidentiality and authentication.
But this is not say that the received message are exactly sent from sender.
One solution append error detecting code or Frame Check Sequence (FCS).
When a hash function is used to provide message authentication, the hash function
value is often referred to as a message digest.
The sender computes a hash value as a function of the bits in the message and
transmits both the hash value and the message.
The receiver performs the same hash calculation on the message bits and compares
this value with the incoming hash value.
If there is a mismatch, the receiver knows that the has been altered.
SHA
SHA Stands for Secure Hash Algorithm.
The first version of SHA is SHA0. The revised version of SHA is SHA1 in
1995.
The Actual Standards are
SHA-1 SHA-224 SHA-256 SHA-384 SHA-512
where
CVq - chaining variable processed with the qth block of the message
SUM32 - addition modulo 232 performed separately on each word of the pair of
inputs
MD5 Compression Function
33
MD5 Compression Function
Each round has 16 steps of the form:
a = b+((a+g(b,c,d)+X[k]+T[i])<<<s)
a,b,c,d refer to the 4 words of the buffer, but used in varying permutations
note this updates 1 word only of the buffer
after 16 steps each word is updated 4 times
where
g(b,c,d) - different nonlinear function in each round (F,G,H,I)
T[i] - ith entry in the matrix of constants T
<<<s - Circular left shift
+ - addition modulo
34
ROUND Primitive Function G(b.c.d)
1. F(b,c,d) (b˄c)˅(b˄d)
2. G(b,c,d) (c˄d)˅(c˄d)
3. H(b,c,d) b⊕c⊕d
4. I(b,c,d) c⊕(b˄d)
MD5 VS SHA
Brute force attack is harder (160 vs 128 bits for MD5)
Not vulnerable to any known attacks (compared to
MD4/5)
A little slower than MD5 (80 vs 64 steps)
Both designed as simple and compact
Optimised for big endian CPU's (vs MD5 which is
optimised for little endian CPU’s)
MAC Based Hash Function : HMAC
HMAC Design Objectives
To use, without modifications, available hash functions which are free in use.
HMAC adds three executions of the hash compression function (for Si, So, and the block
produced from the inner hash).
+
⊕
HMAC Algorithm
H = embedded hash function (e.g., MD5, SHA-1, RIPEMD-160)
IV = initial value input to hash function
M = message input to HMAC (including the padding specified in the
embedded hash function)
Yi = i th block of M, 0 ≤ i ≤ (L - 1)
L = number of blocks in M
b = number of bits in a block
n = length of hash code produced by embedded hash function
K = secret key; recommended length is Ú n; if key length is greater than b,
the key is input to the hash function to produce an n-bit key
K+ = K padded with zeros on the left so that the result is b bits in length
ipad = 00110110 (36 in hexadecimal) repeated b/8 times
opad = 01011100 (5C in hexadecimal) repeated b/8 times
Algorithm Expression
HMAC(K, M) = H[(K + ⊕ opad) || H[(K + ⊕ ipad) || M]]
Algorithm Description
1. Append zeros to the left end of K to create a b-bit string K+ (e.g., if K is of
length 160 bits and b = 512, then K will be appended with 44 zeroes).
2. XOR (bitwise exclusive-OR) K + with ipad to produce the b-bit block Si.
3. Append M to Si.
4. Apply H to the stream generated in step 3.
5. XOR K + with opad to produce the b-bit block So.
6. Append the hash result from step 4 to So.
7. Apply H to the stream generated in step 6 and output the result.
Algorithm Compression
A more efficient implementation is possible,
f(IV, (K+ ⊕ ipad))
f(IV, (K+ ⊕ opad))
Security of HMAC
An attack on this hash function requires either a brute-force attack on the key.
The attacker is looking for two messages M and M′ that produce the same
⊕
Cipher-Based Message Authentication Code
(CMAC)
Messages of one fixed length of mn bits are processed, where n is the cipher
block size and m is a fixed positive integer.
Three keys are used :
One key K of length k to be used at each step of the cipher block chaining
Two keys of length b, where b is the cipher block length.
The operation of CMAC when the message is an integer multiple n of the
cipher block length b.
The message is divided into n blocks (M1, M2, …, Mn).
The algorithm makes use of a k-bit encryption key K and a b-bit constant, K1.
CMAC is calculated as follows
C1 = E(K, M1)
C2 = E(K, [M2⊕ C1])
C3 = E(K, [M3⊕ C2])
.
.
.
Cn = E(K, [Mn⊕ Cn-1 ⊕ K1])
T = MSBTlen (Cn)
Where
T = Message authentication code also referred as Tag
Tlen = Bit length of T
MSB(x) = The s leftmost bits of the bit string
If the message is not an integer multiple of the cipher block length, then the
final block is padded to the right (least significant bits) with a 1 and as many 0s
as necessary so that the final block is also of length b.
The CMAC operation then proceeds as before, except that a different b-bit key
K2.
The two b-bit keys are derived from the k-bit encryption key as follows.
L = E(K, 0b )
K1 = L . x
K2 = L . x2 = (L . x) . x
where multiplication ( . ) is done in the finite field GF(2b ) and x and x2 are first
and second-order polynomials that are elements of GF(2b).
(b) Message length is not integer multiple of block size
DIGITAL SIGNATURE
Digital signatures are the public-key primitives of message authentication.
A digital signature is a technique that binds a person/entity to the digital data
This binding can be independently verified by receiver as well as any third
party.
Digital signature is a cryptographic value that is calculated from the data and a
secret key known only by the signer.
PROPERTIES
It must verify the author and the date and time of the signature.
It must authenticate the contents at the time of the signature.
It must be verifiable by third parties, to resolve disputes.
Destination
Destination BB
a
(b)