Reputation: 93
have a question about this library and GCM in general.
I understand GCM mode can both encrypt and authenticate data, or merely just authenticate it. With the javax library, if I want to authenticate a message only I can do:
cipher.updateAAD(AAD)
My question is, when I compute
cipher.doFinal(buffer)
What does buffer become? Is it merely the ciphertext blocks + the GCM auth tag? Or is AAD itself actually included in buffer now?
It's really not clear to me from the docs: https://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html
Thanks!
Upvotes: 0
Views: 659
Reputation: 81
Do you have a specific reason you are trying to use AAD values?
Not sure your experience level or specific use case, but here is a blog article I wrote about AE if you have any questions.
Upvotes: 0
Reputation: 12075
If you will use the AES/GCM/NoPadding
, the doFinal
method produces ciphertext + tag
when encrypting. The same is expected when decrypting the AES/GCM mode.
If you updateAAD
, the MAC (tag) is updated, but the AAD itself value is not included (that would even break the purpose of extra AAD).
Upvotes: 1