Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply RFC7516 Standard to Response #48

Merged
merged 3 commits into from
Dec 10, 2024
Merged

Conversation

Xynnn007
Copy link
Contributor

@Xynnn007 Xynnn007 commented Dec 2, 2024

This patch is a fix up to previous commits to update the Response struct to follow RFC7516.

The work included in the commit

  1. Make both serialization and deserialization of ProtectedHeader use base64-url-nopadding encoding. This means that the whole ProtectedHeader will be serialized into a base64 string, rather than a struct.
  2. Make encrypted_key, aad, iv, ciphertext, tag to base64-url-nopadding encoded string when serializing.
  3. Automatical deseralization logic when parsing Response from a flattened JSON JWE Serialization.
  4. Add generate_aad() function to ProtectedHeader

Close #47

src/lib.rs Outdated Show resolved Hide resolved
@Xynnn007 Xynnn007 requested a review from tylerfanelli December 4, 2024 09:33
@Xynnn007 Xynnn007 force-pushed the fix-pub branch 3 times, most recently from b8d56d9 to e19170d Compare December 9, 2024 09:43
@Xynnn007
Copy link
Contributor Author

@tylerfanelli Just took a rebase to follow #49, #50, #51

@tylerfanelli
Copy link
Member

@Xynnn007 thanks, please push the rebased branch again so the tests can re-run.

This patch is a fix up to previous commits to update the Response struct
to follow RFC7516.

The work included in the commit
1. Make both serialization and deserialization of `ProtectedHeader`
use base64-url-nopadding encoding. This means that the whole
ProtectedHeader will be serialized into a base64 string, rather than a
struct.
2. Make `encrypted_key`, `aad`, `iv`, `ciphertext`, `tag` to
base64-url-nopadding encoded string when serializing.
3. Automatical deseralization logic when parsing Response from a
flattened JSON JWE Serialization.

Signed-off-by: Xynnn007 <[email protected]>
Due to RFC7516, aad used in AEAD is derived from ProtectedHeader. This
function does this.

Signed-off-by: Xynnn007 <[email protected]>
This commit adds error handling for the crate using thiserror crate.
Also, based on the error handling, making serialization of `AAD`
eleganttly be handled with result mechanism.

Signed-off-by: Xynnn007 <[email protected]>
Copy link
Member

@tylerfanelli tylerfanelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@tylerfanelli tylerfanelli merged commit a704036 into virtee:main Dec 10, 2024
3 checks passed
@Xynnn007 Xynnn007 deleted the fix-pub branch December 10, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply the RFC7516 standard to the Response structure
3 participants