Nonce That Never Moved
Ten million rows of government IDs are encrypted with this function, all under one key.
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
KEY = load_key_from_kms() # one 256-bit key for the whole table
NONCE = b"\x00" * 12 # "GCM wants 12 bytes, here they are"
def encrypt_id(plaintext: str) -> bytes:
return AESGCM(KEY).encrypt(NONCE, plaintext.encode(), None)
What is the worst consequence of this code, assuming the key itself is never disclosed?
Sign in to answer questions and track your progress
Sign In