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 support for signature verification #16

Merged
merged 2 commits into from
Nov 24, 2014
Merged

Conversation

jdreed
Copy link
Contributor

@jdreed jdreed commented Nov 24, 2014

In working on expanding our documentation for our OIDC deployment at MIT, I noticed that none of the PHP libraries out there seem to verify signatures. This adds preliminary support for verifying signatures (RSA only), using phpseclib.

It also ensures that the base64urlencoded data is decoded correctly, by implementing base64 url decoding as described in RFC4648 section 5, "Base 64 Encoding with URL and Filename Safe Alphabet"

JWT data is "Base64 URL encoded", which is RFC4648, section 5
"Base 64 Encoding with URL and Filename Safe Alphabet".  This
differs from regular Base64 in characters 62 and 63, and
any trailing padding characters are omitted.

Add a helper function to perform the transformation and restore
padding before passing it to PHP's base64_decode.
This adds support for verifying RSA signatures on JWTs.  It
uses phpseclib's crypto implementation.  If phpseclib is
unavailable, it will print a warning, and will not attempt
to verify signatures.
jumbojett added a commit that referenced this pull request Nov 24, 2014
Add support for signature verification
@jumbojett jumbojett merged commit f7647ba into jumbojett:master Nov 24, 2014
@jumbojett
Copy link
Owner

Thank you @jdreed

@brunopenso brunopenso mentioned this pull request Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants