public class SslContextFactory
extends java.lang.Object
The following snippet shows how to create a SSL context for a client:
X509Certificate certificate = CertificatesHelper.getCertificate(CERTIFICATE_PATH); X509TrustManager trustManager = SslContextFactory.createTrustManager(certificate); SSLContext sslContext = SslContextFactory.createSslContext(SslProtocols.TLS, trustManager);
| Modifier and Type | Method and Description |
|---|---|
static javax.net.ssl.X509KeyManager |
createKeyManager(byte[] key,
char[] keyPassword,
java.security.cert.X509Certificate... certificateChain)
Creates a key manager that stores the given key and its associated certificate chain.
|
static javax.net.ssl.SSLContext |
createSslContext(java.lang.String protocol,
javax.net.ssl.TrustManager trustManager,
javax.net.ssl.KeyManager... keyManagers)
Creates a SSL context.
|
static javax.net.ssl.X509TrustManager |
createTrustManager(java.security.cert.X509Certificate... certificates)
Creates a trust manager that stores the given certificates.
|
public static javax.net.ssl.SSLContext createSslContext(java.lang.String protocol,
javax.net.ssl.TrustManager trustManager,
javax.net.ssl.KeyManager... keyManagers)
The createTrustManager(java.security.cert.X509Certificate...) and createKeyManager(byte[], char[], java.security.cert.X509Certificate...) methods can be used to create the trust manager and
the key managers easily.
protocol - the protocol (see SslProtocols).trustManager - the trust manager.keyManagers - the key managers.public static javax.net.ssl.X509TrustManager createTrustManager(java.security.cert.X509Certificate... certificates)
certificates - the trusted certificates.public static javax.net.ssl.X509KeyManager createKeyManager(byte[] key,
char[] keyPassword,
java.security.cert.X509Certificate... certificateChain)
key - the key.keyPassword - the password to decrypt the key.certificateChain - the certificate chain.