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 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()
@Deprecated public SSLContextBuilder useProtocol(String protocol)
setProtocol(String)
.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 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, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException
public SSLContextBuilder loadTrustMaterial(TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException
public SSLContextBuilder loadTrustMaterial(File file, char[] storePassword, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadTrustMaterial(File file, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadTrustMaterial(File file) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadTrustMaterial(URL url, char[] storePassword, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadTrustMaterial(URL url, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
public SSLContextBuilder loadKeyMaterial(File file, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(File file, char[] storePassword, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(URL url, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
public SSLContextBuilder loadKeyMaterial(URL url, 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
KeyManagementException
public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException
Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.