public class ApnsVerificationKey extends ApnsKey implements ECPublicKey
A public key used to verify authentication tokens. Signing keys are associated with a developer team (in Apple's parlance), and can be used to sign authentication tokens for any topic associated with that team.
Callers generally won't need to use this class outside of the context of integration tests. In almost all cases,
callers will want to use an ApnsSigningKey
to provide signing credentials to an
ApnsClient
.
APNS_SIGNATURE_ALGORITHM
Constructor and Description |
---|
ApnsVerificationKey(String keyId,
String teamId,
ECPublicKey key)
Constructs a new verification key with the given key identifier, team identifier, and elliptic curve private key.
|
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm() |
byte[] |
getEncoded() |
String |
getFormat() |
ECPublicKey |
getKey()
Returns the underlying elliptic curve key for this key.
|
ECPoint |
getW() |
static ApnsVerificationKey |
loadFromInputStream(InputStream inputStream,
String teamId,
String keyId)
Loads a verification key from the given input stream.
|
static ApnsVerificationKey |
loadFromPkcs8File(File pkcs8File,
String teamId,
String keyId)
Loads a verification key from the given PKCS#8 file.
|
public ApnsVerificationKey(String keyId, String teamId, ECPublicKey key) throws NoSuchAlgorithmException, InvalidKeyException
keyId
- the ten-character, Apple-issued identifier for the key itselfteamId
- the ten-character, Apple-issued identifier for the team to which the key belongskey
- the elliptic curve private key underpinning this signing keyNoSuchAlgorithmException
- if the algorith is not supported by the JVMInvalidKeyException
- if the given elliptic curve private key is invalid for any reasonpublic ECPublicKey getKey()
ApnsKey
public String getAlgorithm()
getAlgorithm
in interface Key
public byte[] getEncoded()
getEncoded
in interface Key
public ECPoint getW()
getW
in interface ECPublicKey
public static ApnsVerificationKey loadFromPkcs8File(File pkcs8File, String teamId, String keyId) throws IOException, NoSuchAlgorithmException, InvalidKeyException
pkcs8File
- the file from which to load the keyteamId
- the ten-character, Apple-issued identifier for the team to which the key belongskeyId
- the ten-character, Apple-issued identitifier for the key itselfIOException
- if a key could not be loaded from the given file for any reasonNoSuchAlgorithmException
- if the JVM does not support elliptic curve keysInvalidKeyException
- if the loaded key is invalid for any reasonpublic static ApnsVerificationKey loadFromInputStream(InputStream inputStream, String teamId, String keyId) throws IOException, NoSuchAlgorithmException, InvalidKeyException
inputStream
- the input stream from which to load the keyteamId
- the ten-character, Apple-issued identifier for the team to which the key belongskeyId
- the ten-character, Apple-issued identitifier for the key itselfIOException
- if a key could not be loaded from the given file for any reasonNoSuchAlgorithmException
- if the JVM does not support elliptic curve keysInvalidKeyException
- if the loaded key is invalid for any reasonCopyright © 2013–2018 Turo. All rights reserved.