public final class SslUtils
SSL utilities.
Static Methods
getDefaultKeyManagerFactory()
public static KeyManagerFactory getDefaultKeyManagerFactory()
Returns the default key manager factory.
Type | Description |
KeyManagerFactory |
Type | Description |
NoSuchAlgorithmException |
getDefaultTrustManagerFactory()
public static TrustManagerFactory getDefaultTrustManagerFactory()
Returns the default trust manager factory.
Type | Description |
TrustManagerFactory |
Type | Description |
NoSuchAlgorithmException |
getPkixKeyManagerFactory()
public static KeyManagerFactory getPkixKeyManagerFactory()
Returns the PKIX key manager factory.
Type | Description |
KeyManagerFactory |
Type | Description |
NoSuchAlgorithmException |
getPkixTrustManagerFactory()
public static TrustManagerFactory getPkixTrustManagerFactory()
Returns the PKIX trust manager factory.
Type | Description |
TrustManagerFactory |
Type | Description |
NoSuchAlgorithmException |
getSslContext()
public static SSLContext getSslContext()
Returns the SSL context for "SSL" algorithm.
Type | Description |
SSLContext |
Type | Description |
NoSuchAlgorithmException |
getTlsSslContext()
public static SSLContext getTlsSslContext()
Returns the SSL context for "TLS" algorithm.
Type | Description |
SSLContext |
Type | Description |
NoSuchAlgorithmException |
initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory)
public static SSLContext initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory)
Initializes the SSL context to the trust managers supplied by the trust manager factory for the given trust store.
Name | Description |
sslContext | SSLContext SSL context (for example SSLContext#getInstance) |
trustStore | KeyStore key store for certificates to trust (for example SecurityUtils#getJavaKeyStore()) |
trustManagerFactory | TrustManagerFactory trust manager factory (for example #getPkixTrustManagerFactory()) |
Type | Description |
SSLContext |
Type | Description |
GeneralSecurityException |
initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory, KeyStore mtlsKeyStore, String mtlsKeyStorePassword, KeyManagerFactory keyManagerFactory)
public static SSLContext initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory, KeyStore mtlsKeyStore, String mtlsKeyStorePassword, KeyManagerFactory keyManagerFactory)
Beta
Initializes the SSL context to the trust managers supplied by the trust manager factory for the
given trust store, and to the key managers supplied by the key manager factory for the given
key store.
Name | Description |
sslContext | SSLContext SSL context (for example SSLContext#getInstance) |
trustStore | KeyStore key store for certificates to trust (for example SecurityUtils#getJavaKeyStore()) |
trustManagerFactory | TrustManagerFactory trust manager factory (for example #getPkixTrustManagerFactory()) |
mtlsKeyStore | KeyStore key store for client certificate and key to establish mutual TLS |
mtlsKeyStorePassword | String password for mtlsKeyStore parameter |
keyManagerFactory | KeyManagerFactory key manager factory (for example #getDefaultKeyManagerFactory()) |
Type | Description |
SSLContext |
Type | Description |
GeneralSecurityException |
trustAllHostnameVerifier()
public static HostnameVerifier trustAllHostnameVerifier()
Beta
Returns a verifier that trusts all host names.
Be careful! Disabling host name verification is dangerous and should only be done in testing environments.
Type | Description |
HostnameVerifier |
trustAllSSLContext()
public static SSLContext trustAllSSLContext()
Beta
Returns an SSL context in which all X.509 certificates are trusted.
Be careful! Disabling SSL certificate validation is dangerous and should only be done in testing environments.
Type | Description |
SSLContext |
Type | Description |
GeneralSecurityException |