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

What is the reason behind stripping the = in base64 encoding? #54

Closed
dmitrinesterenko opened this issue Feb 2, 2015 · 2 comments
Closed

Comments

@dmitrinesterenko
Copy link

Hi All,

Curious what's the reason behind stripping the = padding that results in base64 encoding? https://github.com/progrium/ruby-jwt/blob/85c7c8813e064ecf3d07ac799cc478eb413c4e48/lib/jwt.rb#L46

@excpt
Copy link
Member

excpt commented Feb 2, 2015

It's defined that way in the JOSE specifications to be compatible with different systems.

'=' just fills up blank space in the base64 strings to match a certain length. If you cut them off you lose some payload size. You can add them back on the server or client side if needed by checking the base64 string length.

@dmitrinesterenko
Copy link
Author

Ok thank you for the explanation, was surprised to not see '=' as it seems like a slight redefinition of base64encoding.

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

No branches or pull requests

2 participants