Class SslUtils
java.lang.Object
org.jmxtrans.embedded.util.net.ssl.SslUtils
public class SslUtils extends Object
- Author:
- Cyrille Le Clerc
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSslUtils.TrustAllX509TrustManagerTrust allX509Certificate. -
Method Summary
Modifier and Type Method Description static SSLContextgetSslContext(String keyStore, String keyStorePassword, String trustStore, String trustStorePassword)Build anSSLContextwith the given trust store and key store.static SSLSocketFactorygetSSLSocketFactory(String keyStore, String keyStorePassword, String trustStore, String trustStorePassword)Build anSSLSocketFactorywith the given trust store and key store.static SSLSocketFactorygetTrustAllSSLSocketFactory()Build anSSLSocketFactorythat trusts all the X509 certificates.
-
Method Details
-
getSSLSocketFactory
@Nonnull public static SSLSocketFactory getSSLSocketFactory(@Nullable String keyStore, @Nullable String keyStorePassword, @Nullable String trustStore, @Nullable String trustStorePassword)Build anSSLSocketFactorywith the given trust store and key store.- Parameters:
keyStore- path to the given JKS key store. Can be a classpath resource ("classpath:com/example/keystore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.keyStorePassword- password to open the key storetrustStore- path to the given JKS trust store. Can be a classpath resource ("classpath:com/example/keystore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.trustStorePassword- password to open the trust store- Returns:
- the
SSLSocketFactory
-
getSslContext
@Nonnull public static SSLContext getSslContext(@Nullable String keyStore, @Nullable String keyStorePassword, @Nullable String trustStore, @Nullable String trustStorePassword)Build anSSLContextwith the given trust store and key store.- Parameters:
keyStore- path to the given JKS key store. Can be a classpath resource ("classpath:com/example/keystore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.keyStorePassword- password to open the key storetrustStore- path to the given JKS trust store. Can be a classpath resource ("classpath:com/example/truststore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.trustStorePassword- password to open the trust store- Returns:
- the
SSLContext
-
getTrustAllSSLSocketFactory
Build anSSLSocketFactorythat trusts all the X509 certificates.- Returns:
- the created
SSLSocketFactory
-