You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Convert AeadParameters to KeyTemplate and vice versa #22
Is your feature request related to a problem?
We are using the Aead Evenlope encryption. We are planning to store the DEK KeyTemplate with the encrypted data so that we know which template to use for decryption.
What is the intended way to come from an KeyTemplate to the related Parameters?
I know this is more verbose, but it tells you a few things:
For new DEKs we will use the above parameter set.
For old DEKs, we will assume that they are AES GCM keys.
Note that in order for things to work properly they need to fit, but it also is clear that you cannot easily change this.
More generally, it is always possible to convert a com.google.crypto.tink.proto.KeyTemplate into a parameters with TinkProtoParametersFormat.parse(t.toByteArray());
Activity
tholenst commentedon Jan 25, 2024
Thanks for the report.
There are several ways, in your particular case I would directly create the corresponding parameters object.
I know this is more verbose, but it tells you a few things:
Note that in order for things to work properly they need to fit, but it also is clear that you cannot easily change this.
More generally, it is always possible to convert a com.google.crypto.tink.proto.KeyTemplate into a parameters with
TinkProtoParametersFormat.parse(t.toByteArray());beatrausch commentedon Jan 29, 2024
Thx, for the feedback. We will check which approach fits better for us. Probably a piece of documentation would help?