Skip to main content
2 of 2
added 2 characters in body
CipherX
  • 381
  • 3
  • 12

AES-GCM Encryption and Replay Attacks

I have a doubt about AES-GCM on how can I avoid replay attacks. We have 2 users (Alice and Bob). After that the entities negotiate crypto parameters and generate a symmetric key, they'll exchange encrypted message.

The possible encryption algorithms are two: AES-128-GCM and AES-128-CBC. By using AES-128-GCM, Alice and Bob choose the following parameters:

  • $IV=nonce$ where $nonce$ is a pseudorandom number
  • $AAD="static-data"$
  • $K$, a 128 bit key
  • $D$, the plaintext

Now we suppose that in order to avoid replay attacks, I want to use a timestamp $t$. Is it correct that Alice sends the ciphertext $CT=E_K(IV,AAD,D)$ to Bob together a timestamp $t$ like $CT||t$ or encrypt the timestamp in the ciphertext (and in this case the plaintext $D$ becomes $D||t$) in order to avoid replay attacks ?

CipherX
  • 381
  • 3
  • 12