Package org.apache.http.ssl
Class SSLContextBuilder
java.lang.Object
org.apache.http.ssl.SSLContextBuilder
Builder for
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.
- Since:
- 4.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
static SSLContextBuilder
create()
loadKeyMaterial
(File file, char[] storePassword, char[] keyPassword) loadKeyMaterial
(File file, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) loadKeyMaterial
(URL url, char[] storePassword, char[] keyPassword) loadKeyMaterial
(URL url, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) loadKeyMaterial
(KeyStore keystore, char[] keyPassword) loadKeyMaterial
(KeyStore keystore, char[] keyPassword, PrivateKeyStrategy aliasStrategy) loadTrustMaterial
(File file) loadTrustMaterial
(File file, char[] storePassword) loadTrustMaterial
(File file, char[] storePassword, TrustStrategy trustStrategy) loadTrustMaterial
(URL url, char[] storePassword) loadTrustMaterial
(URL url, char[] storePassword, TrustStrategy trustStrategy) loadTrustMaterial
(KeyStore truststore, TrustStrategy trustStrategy) loadTrustMaterial
(TrustStrategy trustStrategy) setKeyManagerFactoryAlgorithm
(String keyManagerFactoryAlgorithm) Sets the key manager factory algorithm name.setKeyStoreType
(String keyStoreType) Sets the key store type.setProtocol
(String protocol) Sets the SSLContext protocol algorithm name.setProvider
(String name) setProvider
(Provider provider) setSecureRandom
(SecureRandom secureRandom) setTrustManagerFactoryAlgorithm
(String trustManagerFactoryAlgorithm) Sets the trust manager factory algorithm name.toString()
useProtocol
(String protocol) Deprecated.
-
Constructor Details
-
SSLContextBuilder
public SSLContextBuilder()
-
-
Method Details
-
create
-
useProtocol
Deprecated.UsesetProtocol(String)
.Sets the SSLContext protocol algorithm name.- Parameters:
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.- Returns:
- this builder
- See Also:
-
setProtocol
Sets the SSLContext protocol algorithm name.- Parameters:
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.- Returns:
- this builder
- Since:
- 4.4.7
- See Also:
-
setSecureRandom
-
setProvider
-
setProvider
-
setKeyStoreType
Sets the key store type.- Parameters:
keyStoreType
- the SSLkey store type. See the KeyStore section in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information.- Returns:
- this builder
- Since:
- 4.4.7
- See Also:
-
setKeyManagerFactoryAlgorithm
Sets the key manager factory algorithm name.- Parameters:
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.- Returns:
- this builder
- Since:
- 4.4.7
- See Also:
-
setTrustManagerFactoryAlgorithm
Sets the trust manager factory algorithm name.- Parameters:
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.- Returns:
- this builder
- Since:
- 4.4.7
- See Also:
-
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(KeyStore truststore, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(File file, char[] storePassword, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(File file, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(File file) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(URL url, char[] storePassword, TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException -
loadTrustMaterial
public SSLContextBuilder loadTrustMaterial(URL url, char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(File file, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(File file, char[] storePassword, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(URL url, char[] storePassword, char[] keyPassword, PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException -
loadKeyMaterial
public SSLContextBuilder loadKeyMaterial(URL url, char[] storePassword, char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException -
build
-
toString
-
setProtocol(String)
.