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

BASE64URL is not compliant with rfc4648 #30854

Open
JeromeA opened this issue Sep 21, 2017 · 3 comments
Open

BASE64URL is not compliant with rfc4648 #30854

JeromeA opened this issue Sep 21, 2017 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert type-enhancement A request for a change that isn't a bug

Comments

@JeromeA
Copy link

JeromeA commented Sep 21, 2017

RFC4648, chapter 5, states in the description of Base64Url that the padding can be skipped.

BASE64URL.decode('AA') raises an exception ("FormatException: Invalid length, must be multiple of four (at character 3)"), when it should return [0], as the padding in 'AA==' is optional.

This could either be fixed in the code (my preference), or in the comments, by saying that contrary to the rfc specifications, this implementation requires padding, and that the user should call the normalize() method before decode() if the padding can be missing.

@lrhn
Copy link
Member

lrhn commented Sep 25, 2017

Sadly, normalize doesn't work for data URIs (maybe it should, but currently it doesn't).

As I read RFC 4648, padding can be omitted when the data length is known, and I guess that's always the case for data URIs, so it seems like a reasonable feature to have.

@JeromeA
Copy link
Author

JeromeA commented Sep 25, 2017

Why do you mean be "normalize doesn't work"?

BASE64URL.decode(BASE64URL.normalize('AA')) correctly returns [0].

@lrhn
Copy link
Member

lrhn commented Sep 25, 2017

Ah, my bad, I was confusing it with Uri.normalize.

@vsmenon vsmenon added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert labels Sep 25, 2017
@lrhn lrhn added the type-enhancement A request for a change that isn't a bug label Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants