Message Authentication Code (MAC):
Purpose: A MAC is used to ensure the integrity and authenticity of a message, ensuring that the message has not been tampered with and that it comes from a legitimate source.
Key-based: The MAC is generated using a secret key shared between the sender and the receiver.
Integrity: It ensures the integrity of the message but does not guarantee non-repudiation, since both the sender and receiver share the same key. Either party could have generated the MAC, so the sender can deny having sent the message.
Digital Signature (DS):
Purpose: A digital signature is used to ensure authenticity, integrity, and non-repudiation. It provides evidence that the message originated from a specific sender and that the message has not been altered.
Public/Private key-based: The digital signature is generated using the sender’s private key, and the receiver can verify it using the sender’s public key.
Non-repudiation: A key difference is that a digital signature provides non-repudiation, meaning the sender cannot deny having signed the message, since only the sender holds the private key used for signing.