ietf
[Top] [All Lists]

Re: Opsdir last call review of draft-ietf-webpush-vapid-03

2017-07-03 19:20:52
base64 classic seems to need padding and reacts differently on different 
versions when that is missing.

(I’d like to meet someone who can explain what they were thinking when they 
invented padding.)

Grüße, Carsten


On Jul 4, 2017, at 02:14, Martin Thomson 
<martin(_dot_)thomson(_at_)gmail(_dot_)com> wrote:

On 4 July 2017 at 03:31, Adam Roach <adam(_at_)nostrum(_dot_)com> wrote:
# echo
eyJhdWQiOiJodHRwczovL3B1c2guZXhhbXBsZS5uZXQiLCJleHAiOjE0NTM1MjM3NjgsInN1YiI6Im1haWx0bzpwdXNoQGV4YW1wbGUuY29tIn0
| base64 --decode

{"aud":"https://push.example.net","exp":1453523768,"sub":"mailto:push(_at_)example(_dot_)com

I get this:

$ echo 
eyJhdWQiOiJodHRwczovL3B1c2guZXhhbXBsZS5uZXQiLCJleHAiOjE0NTM1MjM3NjgsInN1YiI6Im1haWx0bzpwdXNoQGV4YW1wbGUuY29tIn0
| base64 --decode
{"aud":"https://push.example.net","exp":1453523768,"sub":"mailto:push(_at_)example(_dot_)com"}base64:
invalid input

Which fills me with confidence in the base64 tool.  You'll note that
the trailing quote and curly brace are present here, but there is an
inexplicable error that adding the -i option doesn't remove.

I built this using my own implementation and verified it, but you will
see that this works too:

$ npm install base64url;node -e
'console.log(require("base64url").decode("eyJhdWQiOiJodHRwczovL3B1c2guZXhhbXBsZS5uZXQiLCJleHAiOjE0NTM1MjM3NjgsInN1YiI6Im1haWx0bzpwdXNoQGV4YW1wbGUuY29tIn0"))'
{"aud":"https://push.example.net","exp":1453523768,"sub":"mailto:push(_at_)example(_dot_)com"}

(note that running this leaves a node_modules lying around).

https://www.base64decode.org/ also agrees.