-
-
Notifications
You must be signed in to change notification settings - Fork 688
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 JWK support for HMAC and RSA keys #202
Conversation
de2d6af
to
7e1193e
Compare
3466f90
to
41c24b2
Compare
@mark-adams let me know if there's anything I can help with. |
22b5e39
to
12b24be
Compare
@jpadilla Mind taking a look at this? |
dad9ba4
to
bfa24f3
Compare
'kty': 'RSA', | ||
'use': 'sig', | ||
'key_ops': ['verify'], | ||
'n': force_unicode(to_base64url_uint(numbers.n)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot find specific documentation on encoding RSA keys, but the examples I have seen include modulus (n) and public exponent (e) values in both the private and public keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. That was an oversight on my part. I missed the text that says:
In addition to the members used to represent RSA public keys, the
following members are used to represent RSA private keys.
This looks good to go once the comments are addressed. Thanks, @mark-adams! |
- JWKs for RSA and HMAC can be encoded / decoded using the .to_jwk() and .from_jwk() methods on their respective jwt.algorithms instances - Replaced tests.utils ensure_unicode and ensure_bytes with jwt.utils versions
1786120
to
42b0114
Compare
@jpadilla Does this look good to you? |
@mark-adams yup, all yours! |
This adds support for JWK serialization to HMAC and RSA keys.
Looking something like this:
and also