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

Ability to extract parts of untrusted tokens #47

Closed
brycx opened this issue Apr 17, 2022 · 1 comment
Closed

Ability to extract parts of untrusted tokens #47

brycx opened this issue Apr 17, 2022 · 1 comment

Comments

@brycx
Copy link
Owner

brycx commented Apr 17, 2022

A user should be able to extract the footer and message part of a untrusted token. We can realize this by introducing two new types: UntrustedToken and TrustedToken.

Previous discussion in #40 stated the use case of not knowing what the footer contains, but still wanting to verify it. So a user should be able to get the untrusted footer value and pass it to verify()/decrypt() in order for it to be validated. Note that the footer is both compared in constant time AND is part of the signature for public tokens and the authenticated additional data for the AAD for local tokens. This means, that even if the footer has been tampered with, the signature/tag validtion should fail. Sufficient warnings should be part of the documentation of the UntrustedToken and it's risks.

let untrsuted_token = UntrsutedToken::try_from(untrsuted_input)
// untrsuted_token.footer() -> returns Option(&'a [ u8])
let verify([..], [..], untrsuted_token.footer())?;

verify()/decrypt() functions could then return a TrustedToken with the ability to return the same individual parts of the verified token.

Based on discussion starting here: #40 (comment)

@brycx
Copy link
Owner Author

brycx commented Apr 26, 2022

Included in the 0.5.0-alpha.4 prerelease.

@brycx brycx closed this as completed Apr 26, 2022
franklx pushed a commit to franklx/pasetors that referenced this issue Dec 26, 2023
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

No branches or pull requests

1 participant