Looking at the description below, it doesn't looks like the AES-GCM mode in Crypto. Cipher library can take in AAD data. Do we need to handle it separately for using this? Can advise if my understanding is correct. How to achieve the AES-GCM encryption with using this library if I have the AAD portion in my content need to be take care?
1 Answer
As Topaco said in comment, use update(). For example:
from Crypto.Cipher import AES
nonce = bytes(12)
data = bytes(0)
ad = bytes(16)
cipher = AES.new(key, AES.MODE_GCM, nonce=nonce)
cipher.update(ad)
ciphertext, tag = cipher.encrypt_and_digest(data)
update()
, s. also this example.