140 likes | 311 Views
MESSAGE AUTHENTICATION CODE MAC. Message Encryption. if public-key encryption is used: encryption provides no confidence of sender since anyone potentially knows public-key however if sender signs message using his private-key then encrypts with recipients public key
E N D
Message Encryption • if public-key encryption is used: • encryption provides no confidence of sender • since anyone potentially knows public-key • however if • sender signs message using his private-key • then encrypts with recipients public key • have both secrecy and authentication • but at cost of two public-key uses on message
Message Authentication Code (MAC) • a small fixed-sized block of data: • depends on both message and a secret key • like encryption though need not be reversible • appended to message as a signature • receiver performs same computation on message and checks it matches the MAC • provides assurance that message is unaltered and comes from sender
HMAC MD= Message Digest M= Input message whose MAC is calculated L= The number of Block in message M b = The no of bits in each block K= Shared symmetric key Ipad= string 00110110 repeated b/8 times Opad = string 01011010 repeated b/8 times
HMAC • STEP – 1 : Make length of K equal to b: • if K < b then add many 0 bits to left of K • if K = b then do not take any action • if K > b then perform Digest function for compress. • STEP – 2 : XOR K with ipad to produce S1 K XOR S1 ipad
HMAC • STEP – 3 : Append M to S1 S1 + Original Message M S1 + Original Message
HMAC • STEP – 4 : Message digest algorithm: • Selected message digest algorithm applied to output of step – 3 : S1 + Original message M Message Digest MD H
HMAC • STEP – 5: XOR K with opad to produce S2: • Now We XOR k with opad to produce variable called S2. K XOR S2 opad
HMAC • STEP – 6 : Append H to S2: S2 + H S1 + H
HMAC • STEP – 7 : Message Digest Algorithm. • Selected message digest (MD5,SHA) IS applied to o/p of step – 6 and finally we find MAC. S1 + H Message Digest MD MAC