C# server PUSHing an encrypted message to Firefox 44 example RRS feed

  • Question

  • User629660332 posted

    With Firefox 44+ now supporting the Push API (and, more importantly, that Edge developers have also committed to supporting it) does someone have some example C# code that would be able to encrypt then push a payload-bearing message to my Firefox Web App?

    If you are unfamiliar with what is required then basically, once your Javascript client has registered its Service Worker it can then register with the PushManager flagging its willingness to accept Notifications. You then (Firefox only at the moment Chrome is fixing a bug) call getKey() on your subscription object and send the result along with your subscription .endpoint to your server so that your server logic knows that you have subscribed. (E.g. https://github.com/chrisdavidmills/push-api-demo/blob/gh-pages/main.js#L19 )

    Ok, that's all on the browser and not particularly relevant to the C# code. What I'mm looking for is C# that will take the public key DH 'p256dh' and use it to encrypt the response message (avec payload)  that will be POSTed back to the browser. 

    The only server example I have is Javascript NODE.js etc stuff: - https://github.com/marco-c/web-push/blob/master/index.js if you look at the encrypt() function or, for a complete picture the sendNotification() function, you will see the encryption and the pushRequest I'm looking for.

    Is there a class(es) that handles this for us in .NET C# 

    Friday, February 5, 2016 8:07 AM

All replies