Hi,

I want to send web push notification with encrypted data payload 
<https://developers.google.com/web/updates/2016/03/web-push-encryption> 
from appengine (Java, Standard Environment - I'm sure it will work in the 
Flexible Environment, but it's still beta, not recommended for production 
use, only hosted in US and I reside in Germany/Europe where we have strict 
laws when it comes to storage of customer data). 

My current approach was to adopt the web-push library 
<https://github.com/MartijnDwars/web-push>. I backported it to Java7 (here 
<https://github.com/mpoehler/web-push/tree/javaversion17>), and I'm still 
able to send encrypted push notifications to my browser from the testcase. 
The URLFetchService must be used instead of *org.apache.http.**client*, of 
course.

Sadly, web-push uses *javax.crypto.spec.**GCMParameterSpec* which is not 
whitelisted <https://cloud.google.com/appengine/docs/java/jrewhitelist> and 
I get the following error: 

java.lang.NoClassDefFoundError: *javax.crypto.spec.GCMParameterSpec is a 
restricted class.* Please see the Google  App Engine developer's guide for 
more details.
at 
com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:52)
        at nl.martijndwars.webpush.HttpEce.encrypt(HttpEce.java:176)

The encryption to use for Web Push is "AES/GCM/NoPadding" as described in 
detail here 
<https://developers.google.com/web/updates/2016/03/web-push-encryption>, so 
I think this class, which describes the parameters for the GCM algorithm 
<http://www.dict.cc/?s=algorithm> is mandatory to get this working. 

The following snippet shows how GCMParameterSpec is used in web-push:

Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", "BC");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key_, "AES"), new 
*GCMParameterSpec*(16 * 8, nonce_));
cipher.update(new byte[padSize]);


Is there another way to encode data on appengine in a web-push compatible way?


cheers,


Marco



 


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3081998a-309c-4131-96da-05f3d7208e4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to