Whenever we encode using base64 urlsafe, there is a '=' sign at the end. I am aware that I can remove it using re, strip() commands, I am curious to know whether is a 'no padding' option available for the Base64 URLsafe ? Google search is not helpful.
Asked
Active
Viewed 1,427 times
0
-
why wouldnt you want it padded? ... afaik every base64 outthere uses padding – Joran Beasley Aug 21 '14 at 20:39
-
@JoranBeasley According to [RFC4648](http://tools.ietf.org/html/rfc4648#page-4) padding is *not* mandatory. At least that's how I understand: _"Implementations MUST include appropriate pad characters at the end of encoded data **unless** the specification referring to this document explicitly states otherwise."_ I would recommend its use though. – Sylvain Leroux Aug 21 '14 at 20:44
-
I dont want the padding because it messes with my JWS signature. I have a JWS signature where in the header, payload and the signature are encoded with base 64 url safe. But the server rejects it because of the padding. – AshKsh Aug 21 '14 at 20:44
-
May I eloquently say... RTFM? Seriously though, that or reading the source code for the module is the only way to know if you can or not. You can try googling for 'python base64 no padding', but I doubt you'll get much. Padding is good. – Logan Aug 21 '14 at 20:44
-
1If you do strip the padding, and you use it elsewhere, there is a good chance another interpreter will fail because using padding has become a sort of de facto standard. Most people writing these interpreters would not even guess that they were optional. – allen1 Aug 21 '14 at 20:54