public class SSLContextBuilder extends Object
SSLContext instances.
Please note: the default Oracle JSSE implementation of SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
accepts multiple key and trust managers, however only first matching type is ever used.
See for example:
SSLContext.html#init
TODO Specify which Oracle JSSE versions the above has been verified.
| Constructor and Description |
|---|
SSLContextBuilder() |
public static SSLContextBuilder create()
public SSLContextBuilder setProtocol(String protocol)
protocol - the SSLContext protocol algorithm name of the requested protocol. See
the SSLContext section in the Java
Cryptography Architecture Standard Algorithm Name
Documentation for more information.public SSLContextBuilder setSecureRandom(SecureRandom secureRandom)
public SSLContextBuilder setProvider(Provider provider)
public SSLContextBuilder setProvider(String name)
public SSLContextBuilder setKeyStoreType(String keyStoreType)
keyStoreType - the SSLkey store type. See
the KeyStore section in the Java
Cryptography Architecture Standard Algorithm Name
Documentation for more information.public SSLContextBuilder setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
keyManagerFactoryAlgorithm - the key manager factory algorithm name of the requested protocol. See
the KeyManagerFactory section in the Java
Cryptography Architecture Standard Algorithm Name
Documentation for more information.public SSLContextBuilder setTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)
trustManagerFactoryAlgorithm - the trust manager algorithm name of the requested protocol. See
the TrustManagerFactory section in the Java
Cryptography Architecture Standard Algorithm Name
Documentation for more information.public SSLContextBuilder loadTrustMaterial(KeyStore truststore) throws NoSuchAlgorithmException, KeyStoreException
public SSLContextBuilder loadTrustMaterial() throws NoSuchAlgorithmException, KeyStoreException
public SSLContextBuilder loadTrustMaterial(File file, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadTrustMaterial(InputStream instream, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
public SSLContextBuilder loadKeyMaterial(File file, char[] storePassword, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(InputStream instream, char[] storePassword, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
protected void initSSLContext(SSLContext sslContext, Collection<KeyManager> keyManagers, Collection<TrustManager> trustManagers, SecureRandom secureRandom) throws KeyManagementException
KeyManagementExceptionpublic SSLContext build() throws NoSuchAlgorithmException, KeyManagementException
Copyright © 2019. All rights reserved.