/** * <p>Registers a private signing key for the given topics. Clears any topics and keys previously associated with * the given team.</p> * * <p>Callers using token-based authentication <em>must</em> register signing keys for all topics to which they * intend to send notifications. Callers <em>must not</em> attempt to register signing keys when using TLS-based * client authentication. Tokens may be registered at any time in a client's life-cycle.</p> * * @param signingKeyInputStream an input stream that provides a PEM-encoded, PKCS#8-formatted elliptic-curve private * key with which to sign authentication tokens * @param teamId the Apple-issued, ten-character identifier for the team to which the given private key belongs * @param keyId the Apple-issued, ten-character identifier for the given private key * @param topics the topics to which the given signing key is applicable * * @throws IllegalStateException if this client uses TLS-based authentication instead of token-based authentication * @throws InvalidKeyException if the given key is invalid for any reason * @throws NoSuchAlgorithmException if the JRE does not support the required token-signing algorithm * @throws IOException if a private key could not be loaded from the given input stream for any reason * * @since 0.9 */ public void registerSigningKey(final InputStream signingKeyInputStream, final String teamId, final String keyId, final Collection<String> topics) throws InvalidKeyException, NoSuchAlgorithmException, IOException { this.registerSigningKey(signingKeyInputStream, teamId, keyId, topics.toArray(new String[0])); }
/** * <p>Registers a private signing key for the given topics. Clears any topics and keys previously associated with * the given team.</p> * * <p>Callers using token-based authentication <em>must</em> register signing keys for all topics to which they * intend to send notifications. Callers <em>must not</em> attempt to register signing keys when using TLS-based * client authentication. Tokens may be registered at any time in a client's life-cycle.</p> * * @param signingKeyPemFile a PEM file that contains a PKCS#8-formatted elliptic-curve private key with which to * sign authentication tokens * @param teamId the Apple-issued, ten-character identifier for the team to which the given private key belongs * @param keyId the Apple-issued, ten-character identifier for the given private key * @param topics the topics to which the given signing key is applicable * * @throws IllegalStateException if this client uses TLS-based authentication instead of token-based authentication * @throws InvalidKeyException if the given key is invalid for any reason * @throws NoSuchAlgorithmException if the JRE does not support the required token-signing algorithm * @throws IOException if a private key could not be loaded from the given file for any reason * * @since 0.9 */ public void registerSigningKey(final File signingKeyPemFile, final String teamId, final String keyId, final Collection<String> topics) throws InvalidKeyException, NoSuchAlgorithmException, IOException { this.registerSigningKey(signingKeyPemFile, teamId, keyId, topics.toArray(new String[0])); }
/** * <p>Registers a private signing key for the given topics. Clears any topics and keys previously associated with * the given team.</p> * * <p>Callers using token-based authentication <em>must</em> register signing keys for all topics to which they * intend to send notifications. Callers <em>must not</em> attempt to register signing keys when using TLS-based * client authentication. Tokens may be registered at any time in a client's life-cycle.</p> * * @param signingKeyPemFile a PEM file that contains a PKCS#8-formatted elliptic-curve private key with which to * sign authentication tokens * @param teamId the Apple-issued, ten-character identifier for the team to which the given private key belongs * @param keyId the Apple-issued, ten-character identifier for the given private key * @param topics the topics to which the given signing key is applicable * * @throws IllegalStateException if this client uses TLS-based authentication instead of token-based authentication * @throws InvalidKeyException if the given key is invalid for any reason * @throws NoSuchAlgorithmException if the JRE does not support the required token-signing algorithm * @throws IOException if a private key could not be loaded from the given file for any reason * * @since 0.9 */ public void registerSigningKey(final File signingKeyPemFile, final String teamId, final String keyId, final String... topics) throws InvalidKeyException, NoSuchAlgorithmException, IOException { try (final FileInputStream signingKeyInputStream = new FileInputStream(signingKeyPemFile)) { this.registerSigningKey(signingKeyInputStream, teamId, keyId, topics); } }
/** * <p>Registers a private signing key for the given topics. Clears any topics and keys previously associated with * the given team.</p> * * <p>Callers using token-based authentication <em>must</em> register signing keys for all topics to which they * intend to send notifications. Callers <em>must not</em> attempt to register signing keys when using TLS-based * client authentication. Tokens may be registered at any time in a client's life-cycle.</p> * * @param signingKey the private key with which to sign authentication tokens * @param teamId the Apple-issued, ten-character identifier for the team to which the given private key belongs * @param keyId the Apple-issued, ten-character identifier for the given private key * @param topics the topics to which the given signing key is applicable * * @throws IllegalStateException if this client uses TLS-based authentication instead of token-based authentication * @throws InvalidKeyException if the given key is invalid for any reason * @throws NoSuchAlgorithmException if the JRE does not support the required token-signing algorithm * * @since 0.9 */ public void registerSigningKey(final ECPrivateKey signingKey, final String teamId, final String keyId, final Collection<String> topics) throws InvalidKeyException, NoSuchAlgorithmException { this.registerSigningKey(signingKey, teamId, keyId, topics.toArray(new String[0])); }
this.registerSigningKey(signingKey, teamId, keyId, topics);