Search in sources :

Example 1 with EmptyX509TrustManager

use of gnu.inet.util.EmptyX509TrustManager in project ats-framework by Axway.

the class InetSmtpConnection method getSSLSocketFactory.

/**
     * Returns a configured SSLSocketFactory to use in creating new SSL
     * sockets.
     * @param tm an optional trust manager to use
     */
protected SSLSocketFactory getSSLSocketFactory(TrustManager tm) throws GeneralSecurityException {
    if (tm == null) {
        tm = new EmptyX509TrustManager();
    }
    SSLContext context = SSLContext.getInstance("TLS");
    TrustManager[] trust = new TrustManager[] { tm };
    context.init(null, trust, null);
    return context.getSocketFactory();
}
Also used : EmptyX509TrustManager(gnu.inet.util.EmptyX509TrustManager) SSLContext(javax.net.ssl.SSLContext) TrustManager(javax.net.ssl.TrustManager) EmptyX509TrustManager(gnu.inet.util.EmptyX509TrustManager)

Aggregations

EmptyX509TrustManager (gnu.inet.util.EmptyX509TrustManager)1 SSLContext (javax.net.ssl.SSLContext)1 TrustManager (javax.net.ssl.TrustManager)1