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

Bind Keys to Purpose #7

Open
paragonie-security opened this issue Aug 5, 2021 · 3 comments
Open

Bind Keys to Purpose #7

paragonie-security opened this issue Aug 5, 2021 · 3 comments

Comments

@paragonie-security
Copy link

const uint8_t key[paseto_v2_LOCAL_KEYBYTES],

const uint8_t key[paseto_v2_LOCAL_KEYBYTES],

See https://github.com/paseto-standard/paseto-spec/blob/master/docs/02-Implementation-Guide/03-Algorithm-Lucidity.md

Right now, byte arrays are accepted by this API. There's no mechanism to prevent a user from using a v2 public key as a v2 local key.

It may also be a good idea to bind keys to a version, in case you want to support v4 tokens too.

@minus7
Copy link
Member

minus7 commented Aug 5, 2021

Ack, although I don't have time to work on this at the moment. Patches welcome.

The simplest implementation would probably be a struct type per key type (local/public/secret) that includes the version or even a type per version. Key loaders can then also implement PASERK formats linked in the guide and do away with the pretty arbitrary formats used now.

Changing this will break the API and thus be something for a 2.0 release.

@paragonie-security
Copy link
Author

Thanks for your timely response. We'll look into sending a PR (the code delta between V2 and V4 isn't significant with libsodium).

@paragonie-security
Copy link
Author

We drafted a PR in #8 that should solve this issue.

If accepted, we intend to follow-up with a PASETO V4 implementation soon after.

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

2 participants