// Path: src/main/java/javapns/communication/exceptions/InvalidKeystoreFormatException.java
// public class InvalidKeystoreFormatException extends KeystoreException {
// 
//   private static final long serialVersionUID = 8822634206752412121L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystoreFormatException() {
//     super("Invalid keystore format!  Make sure it is PKCS12...");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystoreFormatException(final String message) {
//     super(message);
//   }
// 
// }
// 
// Path: src/main/java/javapns/communication/exceptions/InvalidKeystorePasswordException.java
// public class InvalidKeystorePasswordException extends KeystoreException {
// 
//   private static final long serialVersionUID = 5973743951334025887L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystorePasswordException() {
//     super("Invalid keystore password!  Verify settings for connecting to Apple...");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystorePasswordException(final String message) {
//     super(message);
//   }
// 
// }
// 
// Path: src/main/java/javapns/communication/exceptions/InvalidKeystoreReferenceException.java
// public class InvalidKeystoreReferenceException extends KeystoreException {
// 
//   private static final long serialVersionUID = 3144387163593035745L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystoreReferenceException() {
//     super("Invalid keystore parameter.  Must be InputStream, File, String (as a file path), or byte[].");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param keystore
//    */
//   public InvalidKeystoreReferenceException(final Object keystore) {
//     super("Invalid keystore parameter (" + keystore + ").  Must be InputStream, File, String (as a file path), or byte[].");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystoreReferenceException(final String message) {
//     super(message);
//   }
// }
// 
// Path: src/main/java/javapns/communication/exceptions/KeystoreException.java
// public class KeystoreException extends Exception {
// 
//   private static final long serialVersionUID = 2549063865160633139L;
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public KeystoreException(final String message) {
//     super(message);
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public KeystoreException(final String message, final Exception cause) {
//     super(message, cause);
//   }
// 
// }


import javapns.communication.exceptions.InvalidKeystoreFormatException;
import javapns.communication.exceptions.InvalidKeystorePasswordException;
import javapns.communication.exceptions.InvalidKeystoreReferenceException;
import javapns.communication.exceptions.KeystoreException;
import java.io.*;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
package javapns.communication;



/**
 * Class responsible for dealing with keystores.
 *
 * @author Sylvain Pedneault
 */
public class KeystoreManager {
  private static final String REVIEW_MESSAGE = " Please review the procedure for generating a keystore for JavaPNS.";

  private KeystoreManager() {}

  /**
   * Loads a keystore.
   *
   * @param server The server the keystore is intended for
   * @return A loaded keystore
   * @throws KeystoreException
   */
// Path: src/main/java/javapns/communication/exceptions/InvalidKeystoreFormatException.java
// public class InvalidKeystoreFormatException extends KeystoreException {
// 
//   private static final long serialVersionUID = 8822634206752412121L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystoreFormatException() {
//     super("Invalid keystore format!  Make sure it is PKCS12...");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystoreFormatException(final String message) {
//     super(message);
//   }
// 
// }
// 
// Path: src/main/java/javapns/communication/exceptions/InvalidKeystorePasswordException.java
// public class InvalidKeystorePasswordException extends KeystoreException {
// 
//   private static final long serialVersionUID = 5973743951334025887L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystorePasswordException() {
//     super("Invalid keystore password!  Verify settings for connecting to Apple...");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystorePasswordException(final String message) {
//     super(message);
//   }
// 
// }
// 
// Path: src/main/java/javapns/communication/exceptions/InvalidKeystoreReferenceException.java
// public class InvalidKeystoreReferenceException extends KeystoreException {
// 
//   private static final long serialVersionUID = 3144387163593035745L;
// 
//   /**
//    * Constructor
//    */
//   public InvalidKeystoreReferenceException() {
//     super("Invalid keystore parameter.  Must be InputStream, File, String (as a file path), or byte[].");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param keystore
//    */
//   public InvalidKeystoreReferenceException(final Object keystore) {
//     super("Invalid keystore parameter (" + keystore + ").  Must be InputStream, File, String (as a file path), or byte[].");
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public InvalidKeystoreReferenceException(final String message) {
//     super(message);
//   }
// }
// 
// Path: src/main/java/javapns/communication/exceptions/KeystoreException.java
// public class KeystoreException extends Exception {
// 
//   private static final long serialVersionUID = 2549063865160633139L;
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public KeystoreException(final String message) {
//     super(message);
//   }
// 
//   /**
//    * Constructor with custom message
//    *
//    * @param message
//    */
//   public KeystoreException(final String message, final Exception cause) {
//     super(message, cause);
//   }
// 
// }


// Path: src/main/java/javapns/communication/KeystoreManager.java
import javapns.communication.exceptions.InvalidKeystoreFormatException;
import javapns.communication.exceptions.InvalidKeystorePasswordException;
import javapns.communication.exceptions.InvalidKeystoreReferenceException;
import javapns.communication.exceptions.KeystoreException;
import java.io.*;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import java.util.Enumeration;

package javapns.communication;



/**
 * Class responsible for dealing with keystores.
 *
 * @author Sylvain Pedneault
 */
public class KeystoreManager {
  private static final String REVIEW_MESSAGE = " Please review the procedure for generating a keystore for JavaPNS.";

  private KeystoreManager() {}

  /**
   * Loads a keystore.
   *
   * @param server The server the keystore is intended for
   * @return A loaded keystore
   * @throws KeystoreException
   */
  static KeyStore loadKeystore(final AppleServer server) throws KeystoreException {