Package com.google.api.client.util
Class SslUtils
java.lang.Object
com.google.api.client.util.SslUtils
SSL utilities.
- Since:
- 1.13
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyManagerFactory
Returns the default key manager factory.static TrustManagerFactory
Returns the default trust manager factory.static KeyManagerFactory
Returns the PKIX key manager factory.static TrustManagerFactory
Returns the PKIX trust manager factory.static SSLContext
Returns the SSL context for "SSL" algorithm.static SSLContext
Returns the SSL context for "TLS" algorithm.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.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.static HostnameVerifier
Beta
Returns a verifier that trusts all host names.static SSLContext
Beta
Returns an SSL context in which all X.509 certificates are trusted.
-
Constructor Details
-
SslUtils
private SslUtils()
-
-
Method Details
-
getSslContext
Returns the SSL context for "SSL" algorithm.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
getTlsSslContext
Returns the SSL context for "TLS" algorithm.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
getDefaultTrustManagerFactory
Returns the default trust manager factory.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
getPkixTrustManagerFactory
Returns the PKIX trust manager factory.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
getDefaultKeyManagerFactory
Returns the default key manager factory.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
getPkixKeyManagerFactory
Returns the PKIX key manager factory.- Throws:
NoSuchAlgorithmException
- Since:
- 1.14
-
initSslContext
@CanIgnoreReturnValue public static SSLContext initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory) throws GeneralSecurityException Initializes the SSL context to the trust managers supplied by the trust manager factory for the given trust store.- Parameters:
sslContext
- SSL context (for exampleSSLContext.getInstance(java.lang.String)
)trustStore
- key store for certificates to trust (for exampleSecurityUtils.getJavaKeyStore()
)trustManagerFactory
- trust manager factory (for examplegetPkixTrustManagerFactory()
)- Throws:
GeneralSecurityException
- Since:
- 1.14
-
initSslContext
@Beta public static SSLContext initSslContext(SSLContext sslContext, KeyStore trustStore, TrustManagerFactory trustManagerFactory, KeyStore mtlsKeyStore, String mtlsKeyStorePassword, KeyManagerFactory keyManagerFactory) throws GeneralSecurityException 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.- Parameters:
sslContext
- SSL context (for exampleSSLContext.getInstance(java.lang.String)
)trustStore
- key store for certificates to trust (for exampleSecurityUtils.getJavaKeyStore()
)trustManagerFactory
- trust manager factory (for examplegetPkixTrustManagerFactory()
)mtlsKeyStore
- key store for client certificate and key to establish mutual TLSmtlsKeyStorePassword
- password for mtlsKeyStore parameterkeyManagerFactory
- key manager factory (for examplegetDefaultKeyManagerFactory()
)- Throws:
GeneralSecurityException
- Since:
- 1.38
-
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.
- Throws:
GeneralSecurityException
-
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.
-