javapns.communication
Class KeystoreManager

java.lang.Object
  extended by javapns.communication.KeystoreManager

public class KeystoreManager
extends Object

Class responsible for dealing with keystores.

Author:
Sylvain Pedneault

Constructor Summary
KeystoreManager()
           
 
Method Summary
static KeyStore loadKeystore(AppleServer server, Object keystore, boolean verifyKeystore)
          Loads a keystore.
static void validateKeystoreParameter(Object keystore)
          Ensures that a keystore parameter is actually supported by the KeystoreManager.
static void verifyKeystoreContent(AppleServer server, Object keystore)
          Perform basic tests on a keystore to detect common user mistakes.
static void verifyKeystoreContent(KeyStore keystore)
          Perform basic tests on a keystore to detect common user mistakes (experimental).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeystoreManager

public KeystoreManager()
Method Detail

loadKeystore

public static KeyStore loadKeystore(AppleServer server,
                                    Object keystore,
                                    boolean verifyKeystore)
                             throws KeystoreException
Loads a keystore.

Parameters:
server - the server the keystore is intended for
keystore - a keystore containing your private key and the certificate signed by Apple (File, InputStream, byte[], KeyStore or String for a file path)
verifyKeystore - whether or not to perform basic verifications on the keystore to detect common mistakes.
Returns:
a loaded keystore
Throws:
KeystoreException

verifyKeystoreContent

public static void verifyKeystoreContent(AppleServer server,
                                         Object keystore)
                                  throws KeystoreException
Perform basic tests on a keystore to detect common user mistakes. If a problem is found, a KeystoreException is thrown. If no problem is found, this method simply returns without exceptions.

Parameters:
server - the server the keystore is intended for
keystore - a keystore containing your private key and the certificate signed by Apple (File, InputStream, byte[], KeyStore or String for a file path)
Throws:
KeystoreException

verifyKeystoreContent

public static void verifyKeystoreContent(KeyStore keystore)
                                  throws KeystoreException
Perform basic tests on a keystore to detect common user mistakes (experimental). If a problem is found, a KeystoreException is thrown. If no problem is found, this method simply returns without exceptions.

Parameters:
keystore - a keystore to verify
Throws:
KeystoreException - thrown if a problem was detected

validateKeystoreParameter

public static void validateKeystoreParameter(Object keystore)
                                      throws InvalidKeystoreReferenceException
Ensures that a keystore parameter is actually supported by the KeystoreManager.

Parameters:
keystore - a keystore containing your private key and the certificate signed by Apple (File, InputStream, byte[], KeyStore or String for a file path)
Throws:
InvalidKeystoreReferenceException - thrown if the provided keystore parameter is not supported