All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javapns.communication.ServerTrustingTrustManager Maven / Gradle / Ivy

The newest version!
package javapns.communication;

import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

/**
 * A trust manager that automatically trusts all servers.
 * Used to avoid having handshake errors with Apple's sandbox servers.
 *
 * @author Sylvain Pedneault
 */
class ServerTrustingTrustManager implements X509TrustManager {
  public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
    throw new CertificateException("Client is not trusted.");
  }

  public void checkServerTrusted(final X509Certificate[] chain, final String authType) {
    // trust all servers
  }

  public X509Certificate[] getAcceptedIssuers() {
    return null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy