public abstract class AbstractPushService<T extends AbstractPushService<T>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SERVER_KEY_CURVE |
static java.lang.String |
SERVER_KEY_ID |
| Constructor and Description |
|---|
AbstractPushService() |
AbstractPushService(java.security.KeyPair keyPair) |
AbstractPushService(java.security.KeyPair keyPair,
java.lang.String subject) |
AbstractPushService(java.lang.String gcmApiKey) |
AbstractPushService(java.lang.String publicKey,
java.lang.String privateKey) |
AbstractPushService(java.lang.String publicKey,
java.lang.String privateKey,
java.lang.String subject) |
| Modifier and Type | Method and Description |
|---|---|
static Encrypted |
encrypt(byte[] payload,
org.bouncycastle.jce.interfaces.ECPublicKey userPublicKey,
byte[] userAuth,
Encoding encoding)
Encrypt the payload.
|
java.lang.String |
getGcmApiKey() |
java.security.KeyPair |
getKeyPair() |
java.security.PrivateKey |
getPrivateKey() |
java.security.PublicKey |
getPublicKey() |
java.lang.String |
getSubject() |
protected HttpRequest |
prepareRequest(Notification notification,
Encoding encoding) |
T |
setGcmApiKey(java.lang.String gcmApiKey)
Set the Google Cloud Messaging (GCM) API key
|
T |
setKeyPair(java.security.KeyPair keyPair)
Set the public and private key (for VAPID).
|
T |
setPrivateKey(java.security.PrivateKey privateKey)
Set the private key (for VAPID)
|
T |
setPrivateKey(java.lang.String privateKey)
Set the public key using a base64url-encoded string.
|
T |
setPublicKey(java.security.PublicKey publicKey)
Set the public key (for VAPID)
|
T |
setPublicKey(java.lang.String publicKey)
Set the public key using a base64url-encoded string.
|
T |
setSubject(java.lang.String subject)
Set the JWT subject (for VAPID)
|
protected boolean |
vapidEnabled()
Check if VAPID is enabled
|
public static final java.lang.String SERVER_KEY_ID
public static final java.lang.String SERVER_KEY_CURVE
public AbstractPushService()
public AbstractPushService(java.lang.String gcmApiKey)
public AbstractPushService(java.security.KeyPair keyPair)
public AbstractPushService(java.security.KeyPair keyPair,
java.lang.String subject)
public AbstractPushService(java.lang.String publicKey,
java.lang.String privateKey)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic AbstractPushService(java.lang.String publicKey,
java.lang.String privateKey,
java.lang.String subject)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static Encrypted encrypt(byte[] payload, org.bouncycastle.jce.interfaces.ECPublicKey userPublicKey, byte[] userAuth, Encoding encoding) throws java.security.GeneralSecurityException
payload - Payload to encrypt.userPublicKey - The user agent's public key (keys.p256dh).userAuth - The user agent's authentication secret (keys.auth).encoding - java.security.GeneralSecurityExceptionprotected final HttpRequest prepareRequest(Notification notification, Encoding encoding) throws java.security.GeneralSecurityException, java.io.IOException, org.jose4j.lang.JoseException
java.security.GeneralSecurityExceptionjava.io.IOExceptionorg.jose4j.lang.JoseExceptionpublic T setGcmApiKey(java.lang.String gcmApiKey)
gcmApiKey - public java.lang.String getGcmApiKey()
public java.lang.String getSubject()
public T setSubject(java.lang.String subject)
subject - public T setKeyPair(java.security.KeyPair keyPair)
keyPair - public java.security.PublicKey getPublicKey()
public T setPublicKey(java.lang.String publicKey) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.spec.InvalidKeySpecException
publicKey - java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.spec.InvalidKeySpecExceptionpublic java.security.PrivateKey getPrivateKey()
public java.security.KeyPair getKeyPair()
public T setPublicKey(java.security.PublicKey publicKey)
publicKey - public T setPrivateKey(java.lang.String privateKey) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.spec.InvalidKeySpecException
privateKey - java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.spec.InvalidKeySpecExceptionpublic T setPrivateKey(java.security.PrivateKey privateKey)
privateKey - protected boolean vapidEnabled()