public class SslUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SslUtils.TrustAllX509TrustManager
Trust all
X509Certificate. |
| Modifier and Type | Method and Description |
|---|---|
static SSLContext |
getSslContext(String keyStore,
String keyStorePassword,
String trustStore,
String trustStorePassword)
Build an
SSLContext with the given trust store and key store. |
static SSLSocketFactory |
getSSLSocketFactory(String keyStore,
String keyStorePassword,
String trustStore,
String trustStorePassword)
Build an
SSLSocketFactory with the given trust store and key store. |
static SSLSocketFactory |
getTrustAllSSLSocketFactory()
Build an
SSLSocketFactory that trusts all the X509 certificates. |
@Nonnull public static SSLSocketFactory getSSLSocketFactory(@Nullable String keyStore, @Nullable String keyStorePassword, @Nullable String trustStore, @Nullable String trustStorePassword)
SSLSocketFactory with the given trust store and key store.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 storeSSLSocketFactory@Nonnull public static SSLContext getSslContext(@Nullable String keyStore, @Nullable String keyStorePassword, @Nullable String trustStore, @Nullable String trustStorePassword)
SSLContext with the given trust store and key store.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 storeSSLContext@Nonnull public static SSLSocketFactory getTrustAllSSLSocketFactory()
SSLSocketFactory that trusts all the X509 certificates.SSLSocketFactoryCopyright © 2015. All Rights Reserved.