The MAC algortihm which is used along with a secret key to generate a MAC tag on the sender end ,is it same at the receiver end also who again uses a MAC algorithm to generate a tag?

If yes, then how is the MAC algorithm generated. Is it just a function(a mathematical function to compute)??

If no, then how does the tag get matched to preserve the data integrity??

Is the MAC algorithm, is present as a layer inside of SSL????


Yes, the MAC algorithm works the same way on both sides. It is a mathematical function that computes the tag from the key and the message. On the sender side, the message is processed as follows:

  1. Calculate T = MAC(key, raw_message).
  2. Send the raw_message and the tag value T. Many communication protocols append them in this order but anything will do as long as the receiver agrees on the format.

On the receiver side, the processing goes as follows:

  1. Parse the received data is parsed as a raw message and a tag value.
  2. Calculate T' = MAC(key, received_raw_message).
  3. Compare T' with received_T. If the values are equal then the message is authentic, otherwise it is not.

SSL does use a MAC to verify data integrity. Strictly speaking, the MAC itself only ensures authenticity, not integrity: a MAC alone does not protect against replay attacks, whereby an adversary repeats a legitimate message. To protect against replay attacks, protocols such as SSL include a nonce in the authenticated message: if the message is genuine and contains the expected nonce, then it hasn't been modified or switched in transit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.