public class PushService
extends java.lang.Object
| Constructor and Description |
|---|
PushService() |
| Modifier and Type | Method and Description |
|---|---|
static Encrypted |
encrypt(byte[] buffer,
java.security.PublicKey userPublicKey,
byte[] userAuth,
int padSize)
Encrypt the payload using the user's public key using Elliptic Curve
Diffie Hellman cryptography over the prime256v1 curve.
|
org.apache.http.HttpResponse |
send(Notification notification)
Send a notification
|
PushService |
setGcmApiKey(java.lang.String gcmApiKey)
Set the Google Cloud Messaging (GCM) API key
|
PushService |
setPrivateKey(java.security.PrivateKey privateKey)
Set the private key (for VAPID)
|
PushService |
setPublicKey(java.security.PublicKey publicKey)
Set the public key (for VAPID)
|
PushService |
setSubject(java.lang.String subject)
Set the JWT subject (for VAPID)
|
protected boolean |
vapidEnabled()
Check if VAPID is enabled
|
public static Encrypted encrypt(byte[] buffer, java.security.PublicKey userPublicKey, byte[] userAuth, int padSize) throws java.security.NoSuchProviderException, java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException, javax.crypto.NoSuchPaddingException, javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, java.security.spec.InvalidKeySpecException, java.io.IOException
java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidAlgorithmParameterExceptionjava.security.InvalidKeyExceptionjavax.crypto.NoSuchPaddingExceptionjavax.crypto.BadPaddingExceptionjavax.crypto.IllegalBlockSizeExceptionjava.security.spec.InvalidKeySpecExceptionjava.io.IOExceptionpublic org.apache.http.HttpResponse send(Notification notification) throws javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.NoSuchProviderException, java.security.InvalidAlgorithmParameterException, java.io.IOException, java.security.spec.InvalidKeySpecException, org.jose4j.lang.JoseException
javax.crypto.NoSuchPaddingExceptionjava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidAlgorithmParameterExceptionjava.io.IOExceptionjava.security.spec.InvalidKeySpecExceptionorg.jose4j.lang.JoseExceptionpublic PushService setGcmApiKey(java.lang.String gcmApiKey)
gcmApiKey - public PushService setSubject(java.lang.String subject)
subject - public PushService setPublicKey(java.security.PublicKey publicKey)
publicKey - public PushService setPrivateKey(java.security.PrivateKey privateKey)
privateKey - protected boolean vapidEnabled()