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

Add InvalidSignature exception #315

Closed
MarkusH opened this issue Nov 29, 2017 · 3 comments
Closed

Add InvalidSignature exception #315

MarkusH opened this issue Nov 29, 2017 · 3 comments

Comments

@MarkusH
Copy link
Contributor

MarkusH commented Nov 29, 2017

Right now the jws.decode() method raises a DecodeError when the signature verification failed. I would like to propose adding a dedicated InvalidSignatureError or SignatureVerificationError exception class.

The reasoning behind this: I'd like to implement a key-rotating feature that checks for one key and if the signature verification fails checks for the other key. The claims, algorithm, and whatnot still need to be validated. The only solution I see right now is catching the DecodeError and checking for e.args[0] == 'Signature verification failed' which feels super dirty.

Please let me know what you think about this. I'm happy to provide the corresponding backward compatible patch.

@jpadilla
Copy link
Owner

@MarkusH I'm +1 on raising an InvalidSignatureError there.

@MarkusH
Copy link
Contributor Author

MarkusH commented Nov 29, 2017

Sweet, I'll get on it tomorrow :)

@MarkusH
Copy link
Contributor Author

MarkusH commented Nov 30, 2017

I opened PR #316.

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