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 base64url with no padding #18

Closed
dcoutts opened this issue Aug 18, 2015 · 4 comments
Closed

Add support for base64url with no padding #18

dcoutts opened this issue Aug 18, 2015 · 4 comments

Comments

@dcoutts
Copy link

dcoutts commented Aug 18, 2015

RFC4648 Section 3.2:

Padding of Encoded Data

In some circumstances, the use of padding ("=") in base-encoded data
is not required or used. In the general case, when assumptions about
the size of transported data cannot be made, padding is required to
yield correct decoded data.

Implementations MUST include appropriate pad characters at the end of
encoded data unless the specification referring to this document
explicitly states otherwise.

As an example of such a specification is RFC7049 (section 2.4.4.2) which has this little snippet:

These three tag types suggest conversions to three of the base data
encodings defined in [RFC4648]. For base64url encoding, padding is
not used (see Section 3.2 of RFC 4648); that is, all trailing equals
signs ("=") are removed from the base64url-encoded string.

So to support such specifications it would be convenient for the Base64.URL modules to provide variants of encode and decode that produce and expect no padding. It's actually especially useful to have the decoder variant since working around the lack of direct support on the encode side is easy, but adding back the correct amount of padding is more involved and expensive.

@andrewthad
Copy link

This would also be a useful feature for my purposes as well.

@cartazio
Copy link

@23Skidoo
Copy link
Member

23Skidoo commented Dec 5, 2018

PRs welcome.

@23Skidoo
Copy link
Member

23Skidoo commented Feb 7, 2020

Fixed by #26.

@23Skidoo 23Skidoo closed this as completed Feb 7, 2020
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

4 participants