I'm implementing AES-GCM in a simple chat. Since there is no problem in the nonce being public and I need to change it in every message, can I send the message nonce unencrypted with the message itself?
An example:
There is a function like this:
AESGCM(nonce, key, data_to_encrypt, unencrypted_data)
And I use this way:
message = AESGCM(nonce, key, data, nonce)
Then, the encrypted message will look like this:
unencrypted_nonce | encrypted_data | authentication_tag