3
$\begingroup$

We know that MAC algorithm and key are used in both sender and receiver side to get the matching MAC tages to prove that the data is authentic.

Now in HMAC we know that, it makes use of crytographic hash function which is irreversible, so when we use HMAC from the sender side to encypt a message using the HMAC formula, then at the sender side how will the receiver decrypt the message (hash function is irreversible), so how is the message at the receiver end, integrity is preserved and validated? Please explain.

$\endgroup$

1 Answer 1

3
$\begingroup$

Actually the HMAC value is not decrypted at all. The recipient takes all the needed input and she computes the HMAC on her own side and check if the result she got it is equal to the value on the message she got.

You can roughly see the HMAC algorithm as an symmetric key signature. You cannot decrypt an HMAC, you only check that the value is correct.

$\endgroup$
8
  • $\begingroup$ YOu said that the receipient takes all the necessary input. What does that mean?The message sent by the sender is not know to the receiver,the sender sends the data using HMAC. Now the receiver needs to have the message to check the value whether its correct or not,from where will the receiver get the message to check the value??? In mac we have mac tag appended into the message, the message is separated from the senders tag and put into the MAC algortihm along with the shared secret key to compute the MAC tag at receiver end.Explain to me on HMAC side ,how does it happen?? $\endgroup$ Commented Sep 3, 2014 at 5:46
  • $\begingroup$ In the Encrypt-then-(H)MAC context the HMAC is computed on the ciphertext, so the recipient take the ciphertext she got, the hmac key (that is already know or derived from a know and preshared key) and compute the HMAC on her side, finally she check her result with the one sent with the ciphertext. if the HMAC is computed on the plaintext, she has to decrypt the ciphertext and compute the HMAC on the plaintext, if values are equal the decryption is accepted, rejected otherwise. $\endgroup$
    – ddddavidee
    Commented Sep 3, 2014 at 6:03
  • $\begingroup$ Actually it is the same process of checking an hash value. How do you check if your download is not corrupted? You compute the hash value of the file and check the computed value against the one written on the website. $\endgroup$
    – ddddavidee
    Commented Sep 3, 2014 at 6:08
  • $\begingroup$ exactly, like the MD5checksum which we can use.correct??? $\endgroup$ Commented Sep 3, 2014 at 6:09
  • $\begingroup$ Yes, but for the hmac you must give the authentication key as input as well. $\endgroup$
    – ddddavidee
    Commented Sep 3, 2014 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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