gov.nasa.pds.registry.common.connection.SSLUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of registry-common Show documentation
Show all versions of registry-common Show documentation
Common code used by Harvest and Registry Manager.
package gov.nasa.pds.registry.common.connection;
import java.security.SecureRandom;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
/**
* TLS/SSL utility methods.
*
* @author karpenko
*/
class SSLUtils
{
/**
* Create "trust all" SSL context to support self-signed certificates.
* @return SSL context object
* @throws Exception an exception
*/
public static SSLContext createTrustAllContext() throws Exception
{
TrustManager[] trustManagers = new TrustManager[1];
trustManagers[0] = new TrustAllManager();
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustManagers, new SecureRandom());
return sc;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy