Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have written some code to do AES in GCM. I currently manually append the tag property to the ciphertext, is this the proper way to communicate the authentication tag?

share|improve this question
I made some major edits to your post. If you disagree with them, feel free to roll them back. The reason for making these changes is that I felt your actual question was hidden in a lot of extraneous information. Also, for the record, Crypto.SE is not a good place for posting code and asking for code reviews. Check out some of the other SE sites where that might be more appropriate. – mikeazo Jul 14 '12 at 2:33
Alright thanks for the answer and letting me know about the code – crawfish Jul 16 '12 at 14:13
up vote 4 down vote accepted

I currently manually append the "tag" property to the ciphertext, is this the correct method of authentication?

That is a perfectly acceptable method. In the end, there needs to be some protocol which tells the other party where the ciphertext is and where the authentication tag is. In your case, the other party knows that the last 128 bits of the message contains the authentication tag.

share|improve this answer
Perhaps more future-proof is to prepend the tag, since it's of a fixed width. I generally prefer to keep fixed-width fields in front, protocol-wise, if there's a variable length field. – Stephen Touset Mar 11 '13 at 21:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.