question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add RS512, PS256, and PS512 support

See original GitHub issue

With new release of god_crypto v1.4.7, you can now add support for the following algorithms: RS512, PS256, and PS512.

RS512

await rsa.sign(message, { algorithm: "rsassa-pkcs1-v1_5", hash: "sha512" })
await rsa.verify(signature, message,  { algorithm: "rsassa-pkcs1-v1_5", hash: "sha512" });

PS256

await rsa.sign(message, { algorithm: "rsassa-pss", hash: "sha256" });
await rsa.verify(signature, message, { algorithm: "rsassa-pss", hash: "sha256" });

PS512

await rsa.sign(message, { algorithm: "rsassa-pss", hash: "sha512" });
await rsa.verify(signature, message, { algorithm: "rsassa-pss", hash: "sha512" });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
invisalcommented, Dec 15, 2020

Thank. I have checked the problems and I found the problem in my implementation:

  • For RS512, the encryption is right, except that I write the wrong oid (using sha256 oid). I use verify code to test the sign code and my verify code does not include checking oid. I will update more test case for this one.
  • For PS256, there is small error in my code as well and add more test cases.

The test method for testing PS256 in your code is also wrong. PS256 and PS512 include random salt. That’s mean that it always produce different signature for same message.

I will patch the fix this week and I will update back to you on this issue.

0reactions
timonsoncommented, Dec 22, 2020

The tests pass now.

I would love to get a code review before I merge these changes: https://github.com/timonson/djwt/pull/44

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Nimbus JOSE+JWT library adds PS256, PS384 and ...
Release 2.20 of the Nimbus JOSE+JWT library adds support for the JWS PS256, PS384 and PS512 signature algorithms, which are a form of...
Read more >
Unsupported JWS algorithm PS256, must be RS256, RS384 ...
For generating JWS, I am using PS256 algorithm, but getting the error Unsupported JWS algorithm PS256, must be RS256, RS384, RS512, PS256, PS384 ......
Read more >
jsjws: pure JavaScript JSON Web Signature library (now a part ...
Release 2.0 is now available to support PS{256,512} (i.e. SHA256/512withRSAPSS) signature algorithm. 2012-May-21: Release 1.2 is now available to add JWS-JS ...
Read more >
Enhancements coming soon in JWT Policies
You can use the same RSA keys with PS256, PS384, and PS512 that you ... The JWS policies support all the same key...
Read more >
Generate JWT - IBM
For algorithm types RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384, PS512 the cryptographic objects referenced must be a Crypto Key (private key)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found