-
Notifications
You must be signed in to change notification settings - Fork 61
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 JWT VC support for RSA keys; enable ZKP tests #24
Conversation
Re: #3 - Pass jwt tests in vc-test-suite - Added RSA key for testing - Convert RSA key to DER for use with jsonwebtoken/ring - Consolidate OneOrMany enums - Add Error type
Thank you for your work! The tests pass, and we are even closer to finishing the test suite--good job. We are getting from 0 to 1, so testing isn't the focus right now, but I wanted to make an issue to make sure this gets addressed prior to release: #25 Still walking through the code and will likely approve today or ask for minor changes. |
@wyc I hope you don't mind I pushed another commit to this branch, as it is relatively minor and depends on these changes. It is to enable passing the remaining vc-test-suite tests - the |
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.
great work. minor comments but happy to merge as-is. feel free to do either or both.
Thanks @wyc |
Thanks for adding the DER tags. LGTM |
#3
This adds the ability to encode a VC as a JWT (without or without signing) and decode a JWT as a VC (with or without signature verification). It also adds the ability to encode and sign a VP as a JWT. This uses the jsonwebtoken library, which uses the crypto library ring.
This implementation is focused on passing the jwt tests in vc-test-suite. The interface could probably be improved for library users that are not vc-test-suite.
For JWS algorithms, currently only RSA (RS256) is supported. Next should probably be HS256 and ES256 (Required, and Recommended+, respectively, by RFC 7518); and/or ES256K/secp256k1 ("P-256K"), which is the other one besides RS256 that is supported by vc-test-suite.
The implementation includes encoding JWK parameters into DER/ASN.1 format, since jsonwebtoken/ring doesn't yet support creating a RSA private key from components (briansmith/ring#699), only from DER or PEM.
Other code changes are also included in the single squashed commit: most notably, the various OneOrMany enums are consolidated into a single type, with helper functions; and we now have an Error type to contain the various errors from our modules and wrapping errors from the external libraries.
For tests, I added an RSA private key that I generated locally with openssl.