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

Support for RS512 algorithm #7

Closed
rbkumar88 opened this issue Oct 4, 2018 · 4 comments
Closed

Support for RS512 algorithm #7

rbkumar88 opened this issue Oct 4, 2018 · 4 comments

Comments

@rbkumar88
Copy link

Hi,

When I tried to decode a token signed using RS512, I get the following error.

terminate called after throwing an instance of 'std::runtime_error'
  what():  Invalid input
Abort trap: 6

Does it support that.? I could see this library is marked as RS512 supported in jwt.io

@Thalhammer
Copy link
Owner

Yes RS512 is supported.

The exception you are seeing does not look like one thrown by jwt-cpp. If you can it might help if you share some source code.
I added same test cases for rs512 to guide you with implementation.
Also you can try your token here to make sure it is actually a valid token.

@Thalhammer
Copy link
Owner

Thalhammer commented Oct 7, 2018

I took a look at it today and this exception gets thrown when there is invalid base64 input (a jwt token is basically a series of base64 encoded JSON strings).
To be precise the error is thrown in the following cases:

  • There are more than 2 padding characters
  • The number of characters (including fill) does not add up to multiples of 4
  • The base64 string contains invalid characters

Personally, I suspect your error is caused by the last one, but I can only be sure if I get a sample token.
Make sure your token only contains

  • lowercase ASCII chars
  • uppercase ASCII chars
  • numbers
  • underscore and minus symbols
  • (and exactly 2 dots separating the three parts)

@Thalhammer
Copy link
Owner

Is this still relevant ?

@Thalhammer
Copy link
Owner

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants