Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Example of decrypting a JWT? #1002

Closed
anderspitman opened this issue Oct 25, 2023 · 1 comment
Closed

Example of decrypting a JWT? #1002

anderspitman opened this issue Oct 25, 2023 · 1 comment
Assignees

Comments

@anderspitman
Copy link

The docs have a nice example of how to encrypt and sign a JWT. Is there an example anywhere of how to decrypt/parse a JWT that has been encrypted this way?

@lestrrat
Copy link
Collaborator

Use jwe.Decrypt, and then jwt.Parse. Detecting signed JWTs is baked into jwt.Parse because it's almost ubiquitous, but JWE isn't because 1) it's not as common as signed JWTs, and 2) if jwt.Parse allowed detecting signing and encryption, then it would also have to detect nested signed/encrypted messages, which makes the process much harder.

Examples for decryption can be found in the docs and examples directory

@lestrrat-go lestrrat-go locked and limited conversation to collaborators Oct 25, 2023
@lestrrat lestrrat converted this issue into discussion #1003 Oct 25, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants