public final class SslUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static javax.net.ssl.KeyManagerFactory |
getDefaultKeyManagerFactory()
Returns the default key manager factory.
|
static javax.net.ssl.TrustManagerFactory |
getDefaultTrustManagerFactory()
Returns the default trust manager factory.
|
static javax.net.ssl.KeyManagerFactory |
getPkixKeyManagerFactory()
Returns the PKIX key manager factory.
|
static javax.net.ssl.TrustManagerFactory |
getPkixTrustManagerFactory()
Returns the PKIX trust manager factory.
|
static javax.net.ssl.SSLContext |
getSslContext()
Returns the SSL context for "SSL" algorithm.
|
static javax.net.ssl.SSLContext |
getTlsSslContext()
Returns the SSL context for "TLS" algorithm.
|
static javax.net.ssl.SSLContext |
initSslContext(javax.net.ssl.SSLContext sslContext,
java.security.KeyStore trustStore,
javax.net.ssl.TrustManagerFactory trustManagerFactory)
Initializes the SSL context to the trust managers supplied by the trust manager factory for the
given trust store.
|
static javax.net.ssl.HostnameVerifier |
trustAllHostnameVerifier()
Beta Returns a verifier that trusts all host names. |
static javax.net.ssl.SSLContext |
trustAllSSLContext()
Beta Returns an SSL context in which all X.509 certificates are trusted. |
public static javax.net.ssl.SSLContext getSslContext() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.SSLContext getTlsSslContext() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.TrustManagerFactory getDefaultTrustManagerFactory() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.TrustManagerFactory getPkixTrustManagerFactory() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.KeyManagerFactory getDefaultKeyManagerFactory() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.KeyManagerFactory getPkixKeyManagerFactory() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static javax.net.ssl.SSLContext initSslContext(javax.net.ssl.SSLContext sslContext, java.security.KeyStore trustStore, javax.net.ssl.TrustManagerFactory trustManagerFactory) throws java.security.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()
)java.security.GeneralSecurityException
@Beta public static javax.net.ssl.SSLContext trustAllSSLContext() throws java.security.GeneralSecurityException
Beta
Be careful! Disabling SSL certificate validation is dangerous and should only be done in testing environments.
java.security.GeneralSecurityException
Copyright © 2011-2018 Google. All Rights Reserved.