GCM: use the same key:IV pair to encrypt file and filename Using Java, I wrote a piece of code that encrypts a given file with AES in GCM mode of operation. So far nothing uncommon.

Now I would also like to encrypt the filename, in the following way:

encrypted filename &lt;- AES(key, IV, original filename).


In order to avoid having multiple key:IV pairs, I also encrypt data with the same key and nonce, like so:

encrypted file &lt;- AES(key, IV, original file)


I know that reusing a key:IV pair is strictly forbidden when dealing with stream ciphers, but since the filename and the file are both in the same set of data, my guess is that it should be fine. However, I am not sure.

Anyone can confirm this ?

tl;dr is it OK to encrypt both a file and the filename with the same key:IV pair with GCM ?
This is terrible. In GCM, if you use the same nonce, then the authenticator is completely broken (for all messages in the future). You should never assume that the attacker doesn't know the filename either. You MUST use different IVs.