public final class SslUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static KeyManagerFactory |
getDefaultKeyManagerFactory()
Returns the default key manager factory.
|
static TrustManagerFactory |
getDefaultTrustManagerFactory()
Returns the default trust manager factory.
|
static KeyManagerFactory |
getPkixKeyManagerFactory()
Returns the PKIX key manager factory.
|
static TrustManagerFactory |
getPkixTrustManagerFactory()
Returns the PKIX trust manager factory.
|
static SSLContext |
getSslContext()
Returns the SSL context for "SSL" algorithm.
|
static SSLContext |
getTlsSslContext()
Returns the SSL context for "TLS" algorithm.
|
static SSLContext |
initSslContext(SSLContext
Initializes the SSL context to the trust managers supplied by the trust manager factory for the given trust store.
|
static HostnameVerifier |
trustAllHostnameVerifier()
Beta
Returns a verifier that trusts all host names. |
static SSLContext |
trustAllSSLContext()
Beta
Returns an SSL context in which all X.509 certificates are trusted. |
public static SSLContextgetSslContext() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static SSLContextgetTlsSslContext() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static TrustManagerFactorygetDefaultTrustManagerFactory() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static TrustManagerFactorygetPkixTrustManagerFactory() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static KeyManagerFactorygetDefaultKeyManagerFactory() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static KeyManagerFactorygetPkixKeyManagerFactory() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static SSLContextinitSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory) throws GeneralSecurityException
sslContext - SSL context (for example
SSLContext.getInstance(java.lang.String) )
trustStore - key store for certificates to trust (for example
SecurityUtils.getJavaKeyStore() )
trustManagerFactory - trust manager factory (for example
getPkixTrustManagerFactory())
GeneralSecurityException
@Beta public static SSLContexttrustAllSSLContext() throws GeneralSecurityException
Beta
Be careful! Disabling SSL certificate validation is dangerous and should only be done in testing environments.
GeneralSecurityException
@Beta public static HostnameVerifiertrustAllHostnameVerifier()
Beta
Be careful! Disabling host name verification is dangerous and should only be done in testing environments.