Encrypted content can still be modified. AEAD combines confidentiality with integrity verification and associated-data binding.
Evaluation approach
Use a supported algorithm and library, follow nonce rules and never process plaintext after authentication failure.
Application example
Changing an encrypted document body should produce a controlled error rather than display corrupted content.
Limits and considerations
Strong algorithms do not compensate for unsafe key storage or nonce reuse.
What does associated data do?
It can bind account, format version or record context to ciphertext. It may remain visible, so do not use it for secrets. Test rejection when the context changes.
Technical assessment
Explore the concept in Python
This example uses the cryptography library's AESGCM API to encrypt a short value and verify it during decryption. The key exists in memory only for this run; the snippet is not a production key-storage or file-format design.
import os
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
key = AESGCM.generate_key(bit_length=256)
aead = AESGCM(key)
nonce = os.urandom(12)
context = b"sample-record:v1"
plaintext = b"example data"
ciphertext = aead.encrypt(nonce, plaintext, context)
recovered = aead.decrypt(nonce, ciphertext, context)
assert recovered == plaintextModified associated data or ciphertext should cause authentication failure. A real application must stop processing that data rather than silently trying plaintext or another key. Preventing nonce reuse under a key is a lifecycle responsibility.
This snippet does not establish durable file protection. Storage, authority, format versions, backups and logout require their own design.
Checks and decisions
- Test authentication failures
- Manage nonce lifetime
- Store keys separately
Sources
The primary references above provide the technical basis. Example workflows and evaluation suggestions are this publication’s explanations, not independent test results for a particular product.