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

aes128gcm content encoding / MS Edge support #53

Closed
ghys opened this issue May 3, 2018 · 10 comments
Closed

aes128gcm content encoding / MS Edge support #53

ghys opened this issue May 3, 2018 · 10 comments
Assignees
Labels

Comments

@ghys
Copy link

ghys commented May 3, 2018

Hi,
I tested sending a notification to MS Edge - already working in Chrome and Firefox - without success: the push server (https://db5.notify.windows.com/w/?token=...) returns 400 Bad Request with no body.

After a quick check and according to https://github.com/web-push-libs/web-push-php/releases/tag/v4.0.0 it appears to be because it requires the aes128gcm content encoding, aesgcm won't work (I have not confirmed this).

Are there any plans to add support for aes128gcm? Thanks!

@martijndwars
Copy link
Member

There were no plans, but I'd be happy to port this to the Java version once I find some time.

@ghys
Copy link
Author

ghys commented May 3, 2018

After some further investigation, I managed to make Edge receive notifications. The Microsoft push server does in fact support aesgcm,

I'll leave my troubleshooting steps here for reference:

  • the 400 Bad Request was my fault (I had replaced Apache HTTP Client by JAX-RS and was sending headers wrong, but not wrong enough to make Chrome and Firefox fail ;)), after fixing this there was a 401 Unauthorized error. The detailed error description can actually be found in the push response's header (WWW-Authenticate: Bearer error="invalid_request",error_description="Malformed Crypto-Key Value")
  • the trick was to remove the keyid=p256dh; part from the Encryption and Crypto-Key headers:
    headers.put("Encryption", "keyid=p256dh;salt=" + base64url.omitPadding().encode(salt));
    headers.put("Crypto-Key", "keyid=p256dh;dh=" + base64url.encode(dh));

Not sure if I should close this issue, supporting aes128gcm is still desirable since aesgcm will eventually be deprecated (see https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/SX9_nZ1NHy8). I'll leave it up to you :)

Thanks.

@martijndwars
Copy link
Member

Let's leave the issue open, aes128gcm should be supported at some point.

the trick was to remove the keyid=p256dh; part from the Encryption and Crypto-Key headers:

Are you saying Edge supports aesgcm, but only when you remove keyid=p256dh;? This sounds like something that needs fixing as well..

The detailed error description can actually be found in the push response's header (WWW-Authenticate: Bearer error="invalid_request",error_description="Malformed Crypto-Key Value")

This is new to me, but sounds super useful. Thanks for sharing!

@ghys
Copy link
Author

ghys commented May 3, 2018

Are you saying Edge supports aesgcm, but only when you remove keyid=p256dh;?

Correct. I found out the notifications sent by the node library didn't include those and worked, and it was the only difference. I have also confirmed Google and Mozilla's servers are fine without it as well.

@fatjoem
Copy link

fatjoem commented May 30, 2018

We noticed a sudden increase of this 401 Unauthorized error from microsoft endpoints yesterday. I assume that something changed that made the webpush feature available to a wider range of Edge users.

@martijndwars martijndwars self-assigned this May 30, 2018
@fatjoem
Copy link

fatjoem commented Jun 13, 2018

Is there any update on fixing this problem?

@martijndwars
Copy link
Member

martijndwars commented Jun 13, 2018

Not from my side, sorry. I haven't had time to look into this yet.

@fatjoem
Copy link

fatjoem commented Jun 19, 2018

Is there a known downside to the fix described by @ghys ?

@oxc
Copy link
Contributor

oxc commented Jul 3, 2018

See web-push-libs/web-push#234 for removal from the Node.js library.

@maxpiepenbrink
Copy link

Thanks for this, I ran into this today and this Github link is what saved me. I wish we had a better explanation as to why microsoft's endpoint seems to care about this value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants