NOTE

1.5 Message Authentication Code

Purpose, process, limitations, and HMAC.

SecurityUpdated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is a Message Authentication Code

A MAC is a technique for checking message integrity and authenticating a message using a shared secret.

2. MAC Properties

Integrity + authentication.

3. Purpose of a MAC

  • Detect whether data was modified, commonly using a hash or block-cipher-based construction.
  • Authenticate the sender among parties that share the secret key.

4. MAC Process

5. Limitations of a MAC

  • The secret key still has to be distributed securely.
  • It cannot provide public third-party verification.
  • Because both sides know the same secret, it cannot provide non-repudiation between them.

5.1. Solution

Digital signatures solve a different trust problem by using asymmetric keys.

6. How to Implement a MAC

6.1. HMAC

HMAC constructs a MAC from a cryptographic hash function and a secret key.

7. Advanced MAC Usage

A nonce, timestamp, sequence number, or request identifier can be included in authenticated data to help prevent replay attacks.

Loading helpful count