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.

question: PS256 signatures fail to validate in jwt.io

See original GitHub issue

Hello, I have come to your library specifically looking to generate signatures with the PS256 alg. I am coming from a different lib that may possibly using the same underlying crypto but as this lib requires node >=11 I was hopeful it would resolve the apparent issue I am facing.

The problem I have is that our recipients are failing verification when we have signed with PS256. I’m using jwt.io as an independent source of verification but I can’t seem to generate a signature that will pass validation. I’m not sure what jwt.io are using on the backend but whatever it is, I am at a loss.

I’ve tried using my own private cert as well as using a generated key with pem extraction

       import { JWK, JWS } from "@panva/jose";
       import moment = require("moment");
       const jwkToPem = require("jwk-to-pem");

       const key = await JWK.generate("RSA", 512, { use: "sig"});
       const payload = { foo: "baz", exp: Math.round(moment.now() / 1000 + 3600) };
       const pPem = jwkToPem(key);

       const sig = JWS.sign(payload, key, {alg: "PS256"});
       // resultant sig does not validate in jwt.io

I respect this may simply be an issue with jwt.io but as my recipient is rejecting my signatures I am wondering if there is a more subtle issue at hand or if I am just doing something completely wrong. Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
panvacommented, Mar 15, 2019

I’ve poked my colleague (@Sambego) to take a look at this, no promises tho.

0reactions
panvacommented, Mar 16, 2019

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android implementation of PS256 gives an error "JWT ...
JWT token is return but token cannot validated by yandex service "JWT signature validation fails". And the same code in IntelliJ is working ......
Read more >
PS256 - is the JWT validation policy working when
JWT Validation is working for PS256 when we generate a signed JWT using the nodes ... IO website the signature validation policy now...
Read more >
JSON Web Token Introduction - jwt.io
The signature is used to verify the message wasn't changed along the way, and, in the case of tokens signed with a private...
Read more >
7 Ways to Avoid JWT Security Pitfalls - 42Crunch
Both APIs expect tokens from the authorization server, so the signature verification step will succeed. However, when these APIs fail to verify ......
Read more >
Generating a JWT in jwt.io, verifying in Apigee Edge (alg ...
Generating a JWT in jwt. io, verifying in Apigee Edge (alg = PS256 ).
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