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

Add support for creating JWTs with x5c certificate headers #104

Closed
Tracked by #107
paularonofskysonos opened this issue Oct 12, 2023 · 4 comments · Fixed by #126
Closed
Tracked by #107

Add support for creating JWTs with x5c certificate headers #104

paularonofskysonos opened this issue Oct 12, 2023 · 4 comments · Fixed by #126
Labels
enhancement New feature or request

Comments

@paularonofskysonos
Copy link

Is your feature request related to a problem? Please describe.
It looks like the library comes equipped with verifying x5c headers, but does not support creating JWTs with x5c headers. Additionally, the documentation describes creating RSA Keys with .private, .public, or .certificate pems. However, when trying to sign a token with anything other than .private, it throws the error privateKeyRequired - see RSASigner.swift.

Describe the solution you'd like
Allow for the creation of JWTs with x5c headers - either to be passed in along with kid param, or parsed from an RSAKey.certificate pem (ensuring RSA private key is included)

Describe alternatives you've considered
Have tried using .certificate RSA Key to sign a token - which throws an error.

Additional context
We are trying to create an authorization grant to be presented with a certificate in exchange for an anonymous access token.

@paularonofskysonos paularonofskysonos added the enhancement New feature or request label Oct 12, 2023
@0xTim
Copy link
Member

0xTim commented Oct 12, 2023

@paularonofskysonos the issue around signing keys with a certificate is being fixed in the next major version, which is currently being worked on.

In terms of x5c headers, we support that for ES256 keys - is there a particular reason you want to use RSA keys still?

@paularonofskysonos
Copy link
Author

I see, thanks! Our team has made the decision to keep using RSA for now, I'll reach out to see why.

@ptoffy
Copy link
Member

ptoffy commented Oct 19, 2023

@paularonofskysonos can I ask why you would want to sign a token with a certificate? Signing is usually done using a private key, do you mean something like .p12 with certificate? (While this file contains both public and private keys, the certificate itself still just contains a public key)

@ptoffy ptoffy linked a pull request Nov 23, 2023 that will close this issue
@ptoffy ptoffy mentioned this issue Nov 23, 2023
Merged
16 tasks
@ptoffy
Copy link
Member

ptoffy commented Mar 15, 2024

Closing this as it is now possible to create JWTs with X5C chains using custom headers. Feel free to reopen or ping on discord about any issues

@ptoffy ptoffy closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants