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
As I'm going through the code, I also realized that there can be a problem with the sequence of encryption and serialization.
If there is only one recipient, and both protected and unprotected headers are given, then the compact serialization must join the headers into common headers, and use that as protected header values. However, JSON serialization must maintain the headers separately. Since the protected headers are used as part of the AAD, we can't decide which actual keys to authenticate, if it's not known what serialization is to be used. There are few solutions here, please let me know which one you would rather have:
Serialization type must be known at the time of encryption
Encryption must produce artifacts that can be used for both JSON and Compact (AFAIU, that means double the cipher text, because GCM blocks will be different if AAD is different)
Shift actual encryption to the serialization phase. Re-encrypt on repeat calls, if serialization changes. The serialization can already fail, so the caller must check the return values anyway, I don't see this breaking compatibility.
Thank you.
The text was updated successfully, but these errors were encountered:
As I'm going through the code, I also realized that there can be a problem with the sequence of encryption and serialization.
If there is only one recipient, and both protected and unprotected headers are given, then the compact serialization must join the headers into common headers, and use that as protected header values. However, JSON serialization must maintain the headers separately. Since the protected headers are used as part of the AAD, we can't decide which actual keys to authenticate, if it's not known what serialization is to be used. There are few solutions here, please let me know which one you would rather have:
Thank you.
The text was updated successfully, but these errors were encountered: