Skip to content

AesGcm tag size?! #101945

Answered by bartonjs
ygoe asked this question in Q&A
May 6, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

I should add a tag size parameter to my AesGcm constructor. Because it seems to be somehow necessary. But unfortunately, I have no idea what that even is and what number I should put there.

if you're doing the encryption, what size buffer are you passing as the tag destination parameter? Assuming it's the same size every time, that's what you pass in the constructor. Then the Encrypt and Decrypt methods just double check that they were supplied values that correspond with your previously registered intent.

So, if what you have already is

AesGcm gcm = new AesGcm(key);
...
byte[] tag = new byte[16];
gcm.Encrypt(nonce, plaintext, ciphertext, tag);

You'd float that 16 into the constructor:

A…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ygoe
Comment options

Answer selected by ygoe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants