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

Support JWE with aws-lc #414

Open
gilgameshoo opened this issue Jan 28, 2025 · 12 comments
Open

Support JWE with aws-lc #414

gilgameshoo opened this issue Jan 28, 2025 · 12 comments

Comments

@gilgameshoo
Copy link

Hi, I'm working on adding JWE support in jsonwebtoken-aws-lc since this crate only currently supports JWS. Can I contribute my code to this crate? I've implemented JWE decryption with aescbc algorithm and continually added new algorithms. I'm currently focusing on the decryption part because that's what my project needed, but I will add the encryption feature to it later.
Do you guys have any plans to support JWE?

@Keats
Copy link
Owner

Keats commented Jan 29, 2025

I'm not opposed to it but I would wait on #410 before doing any work

@gilgameshoo
Copy link
Author

@Keats Thanks, let me clean up my code and create a PR first. Right now I only cover the dir for CEK and I'm working on adding rsa algorithm.

@gilgameshoo
Copy link
Author

@Keats, am I allowed to add more dependencies? I'm merging my jwe validate code to a fork of jsonwebtoken-aws-lc and noticed that it doesn't have the regex crate which I need to use to parse the pem format certificate.

@Keats
Copy link
Owner

Keats commented Feb 4, 2025

Why do you need the regex crate?

@rimutaka
Copy link

rimutaka commented Feb 4, 2025 via email

@gilgameshoo
Copy link
Author

@Keats I'm using that crate to create a helper function that converts pem format to der format. Just a general question, the company I'm working for is trying to make this feature available asap, so are you interested in making JWE validate code available without the encryption? I can continue to contribute and maintain that part of the code.

@Keats
Copy link
Owner

Keats commented Feb 4, 2025

Just a general question, the company I'm working for is trying to make this feature available asap, so are you interested in making JWE validate code available without the encryption? I can continue to contribute and maintain that part of the code.

Since you need jsonwebtoken-aws-lc I wouldn't really bother with a PR for now since #410 needs to be finished before adding aws-lc support

@gilgameshoo
Copy link
Author

@rimutaka I don't see any wasm32 related configurations in the jsonwebtoken-aws-lc code base. Do I need to set the wasm32 target and configure it?

@rimutaka
Copy link

rimutaka commented Feb 4, 2025

@gilgameshoo , pls ignore. I misunderstood your request. jsonwebtoken-aws-lc states it doesn't have wasm32 support to begin with.

@gilgameshoo
Copy link
Author

@Keats I have a question about the error messages in errors.rs. Many errors don't have any detailed messages, such as InvalidKeyFormat error. Looking into your examples in the main function, you are setting the error message from there. I feel it would be more convenient if I could make those error types accept a String as the error message, do you have any concern if I make that change?

@Keats
Copy link
Owner

Keats commented Feb 9, 2025

What kind of message do you want to add? I feel like a comment above the enum entry would be enough

@gilgameshoo
Copy link
Author

gilgameshoo commented Feb 10, 2025

@Keats For example, when checking the jwk, I have the custom error messages for each different parameter, something like this:

Err(new_error(ErrorKind::CustomError(format!(
                            "The JWK {} parameter is required.",
                            key
                        ))))?

I added a new enum in errors.rs called CustomError, it basically accepts any String as the error message returned and printed. I also use it to return key format errors with detailed error messages.

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

3 participants