3

I want to use AES GCM to encrypt data at rest. When retrieving the data, I want to make sure that the key is valid and the data has not been tempered with. Can I store the nonce/iv along with the ciphertext in the database?

1
  • i thought GCM was authenticated anyway; if you can decrypt it, it hasn't been tampered with...
    – dandavis
    Commented May 30, 2016 at 6:35

1 Answer 1

5

Absolutely. There is no risk from appending the nounce/iv to encrypted text.

4
  • @machete It's funny that you pointed out a spelling error when you wrote "tempered" instead of "tampered"!
    – CJ Dennis
    Commented Mar 29, 2018 at 1:48
  • @cj-dennis what is really funny is you picking on a two year old question with a senseless comment like that. There is a huge difference between „no“ and „known“ security vulnerability (in case you didn’t notice). Obviously it’s important to sort that out, which happened. Thank you for your contribution though...
    – machete
    Commented Mar 29, 2018 at 12:31
  • 1
    @machete It doesn't matter how old the question is. I had the same question today, which is how I found yours. Two other people have already found your question useful and who knows how many people might visit this question in the future. If I don't know what "nonce" means, I might think that there is a technical term called "tempering the data". It's best to be clear, as you discovered yourself. ;-)
    – CJ Dennis
    Commented Mar 29, 2018 at 12:49
  • And how about the tag?
    – huang
    Commented Jul 31, 2023 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .