I know the definitions of both but can't specifically tell how they are different and if one is better than the other. Please help.
-
1$\begingroup$ possible duplicate of Is MAC better than digital signature? $\endgroup$– archieNov 1, 2013 at 1:49
-
$\begingroup$ @archie: It is indeed a dupe, although I really think that this one is the better question of the two. On the other hand, poncho's answer over there is good, so... dunno. Maybe we could close that question as a dupe of this one, and have a mod merge the answers? $\endgroup$– Ilmari KaronenOct 27, 2015 at 15:54
-
$\begingroup$ ...and then there's also What are the differences between a digital signature, a MAC and a hash? $\endgroup$– Ilmari KaronenOct 27, 2015 at 15:55
2 Answers
They are used in completely different contexts. In public key encryption there is the notion of signature that protects sender authenticity. The secret key is used as the signing key and everybody can verify its correctness. On the other hand in symmetric encryption there is the notion of MAC that protects the integrity of the message with an agreed MAC key between the sender and the receiver.
-
$\begingroup$ So MAC can be used to protect sender authenticity like public-key encryption? $\endgroup$– ShailyNov 1, 2013 at 1:07
-
$\begingroup$ no MAC is for message integrity.That is nobody has tampered with your message. Put it simpler an attacker cannot provide valid ciphertexts. $\endgroup$– curiousNov 1, 2013 at 1:08
-
1$\begingroup$ So simply speaking, MAC cannot be used to verify sender authentication because it only protects the message integrity. Alright, thank you so much. $\endgroup$– ShailyNov 1, 2013 at 1:11
-
1$\begingroup$ Explain the negative vote in order to improve :) $\endgroup$– curiousNov 1, 2013 at 11:07
-
1$\begingroup$ @Shaily That is not correct. A MAC can be used for authentication. $\endgroup$– matMay 7, 2017 at 20:56
The main functional difference is that anyone able to verify a Message Authentication Code is also able to forge one, because the same key is used for both tasks; whereas someone with the public key can verify a digital signature, but can't forge one.
Contrary to a MAC, digital signature is thus usable in contexts where the verifier is not trusted, which is of tremendous practical value. There's a price to pay for that: a digital signature is significantly larger, and slower to generate and/or verify, than a MAC is.
-
2$\begingroup$ +1; also, the deniability of MACs may sometimes be considered a desirable property, e.g. for encrypted private communications where you may not wish to leave the other party with a permanent proof of what you said to them. $\endgroup$ Oct 27, 2015 at 16:01