Apparently there is no mandatory method to transport AES-GCM parameters. I only read that the initialization vector often will be prefixed to the ciphertext. So, regarding the other parameters too, I could send a string like this
my_string = ':'.join([
'a_unique_iv', # initialization vector
'128', # the tag size in bits
'id-1234', # associated_data
'the_cipher' # cyphertext (converted to string)
])
to a REST API endpoint that stores the data. Or another example (that I would prefer because I already use json objects): Add all parameters as json fields:
my_json = {
'field_a': 'value b',
'field_c': 'value_d',
...
'aes_gcm_parameters_and_data': {
'nonce': 'a_unique_iv' ,
'tagBits': 128,
'associated_data': 'id-1234',
'cyphertext': 'the_cipher' // converted to string
])
Regarding best practices: Are both approaches fine? Is there a better way? Thx.