Top Description Inners Fields Constructors Methods
org.apache.hc.core5.ssl

public Class SSLContextBuilder

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.net.Socket, .URL, java.nio.file.Files, .OpenOption, .Path, java.security.KeyManagementException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .NoSuchProviderException, .Principal, .PrivateKey, .Provider, .SecureRandom, .Security, .UnrecoverableKeyException, java.security.cert.CertificateException, .X509Certificate, java.util.Collection, .Collections, .HashMap, .LinkedHashSet, .Map, .Set, javax.net.ssl.KeyManager, .KeyManagerFactory, .SSLContext, .SSLEngine, .SSLSocket, .TrustManager, .TrustManagerFactory, .X509ExtendedKeyManager, .X509TrustManager, org.apache.hc.core5.util.Args

Builder for javax.net.ssl.SSLContext instances.

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

Since
4.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final KeyManager[]
EMPTY_KEY_MANAGER_ARRAY

An empty immutable KeyManager array.

private static final TrustManager[]
EMPTY_TRUST_MANAGER_ARRAY

An empty immutable TrustManager array.

private String
private final Set<KeyManager>
private String
private Provider
private String
private Provider
private SecureRandom
pack-priv static final String
private String
private final Set<TrustManager>
private Provider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SSLContext
public static SSLContextBuilder
protected void
initSSLContext(final SSLContext sslContext, final Collection<KeyManager> keyManagers, final Collection<TrustManager> trustManagers, final SecureRandom secureRandom)

public SSLContextBuilder
loadKeyMaterial(final KeyStore keyStore, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy)

public SSLContextBuilder
loadKeyMaterial(final Path file, final char[] storePassword, final char[] keyPassword, final OpenOption... openOptions)

public SSLContextBuilder
loadKeyMaterial(final Path file, final char[] storePassword, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy, final OpenOption... openOptions)

public SSLContextBuilder
loadKeyMaterial(final KeyStore keyStore, final char[] keyPassword)

public SSLContextBuilder
loadKeyMaterial(final File file, final char[] storePassword, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy)

public SSLContextBuilder
loadKeyMaterial(final File file, final char[] storePassword, final char[] keyPassword)

public SSLContextBuilder
loadKeyMaterial(final URL url, final char[] storePassword, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy)

public SSLContextBuilder
loadKeyMaterial(final URL url, final char[] storePassword, final char[] keyPassword)

private KeyStore
loadKeyStore(final Path file, final char[] password, final OpenOption... openOptions)

private KeyStore
loadKeyStore(final URL url, final char[] password)

public SSLContextBuilder
loadTrustMaterial(final KeyStore trustStore, final TrustStrategy
custom trust strategy to use; can be null in which case only the default trust managers will be used
trustStrategy
)

public SSLContextBuilder
loadTrustMaterial(final Path file)

public SSLContextBuilder
loadTrustMaterial(final Path file, final char[] storePassword)

public SSLContextBuilder
loadTrustMaterial(final Path file, final char[] storePassword, final TrustStrategy trustStrategy, final OpenOption... openOptions)

public SSLContextBuilder
loadTrustMaterial(final TrustStrategy trustStrategy)

public SSLContextBuilder
loadTrustMaterial(final File file, final char[] storePassword, final TrustStrategy trustStrategy)

public SSLContextBuilder
loadTrustMaterial(final File file, final char[] storePassword)

public SSLContextBuilder
loadTrustMaterial(final File file)

public SSLContextBuilder
loadTrustMaterial(final URL url, final char[] storePassword, final TrustStrategy trustStrategy)

public SSLContextBuilder
loadTrustMaterial(final URL url, final char[] storePassword)

private Provider
public SSLContextBuilder

Returns:

this builder
setKeyManagerFactoryAlgorithm
(final String
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.
keyManagerFactoryAlgorithm
)

Sets the key manager factory algorithm name.

public SSLContextBuilder

Returns:

this builder
setKeyStoreProvider
(final Provider
provider to use for creating key stores.
provider
)

Sets the JCA provider to use for creating key stores.

public SSLContextBuilder

Returns:

this builder
setKeyStoreProvider
(final String
Name of the provider to use for creating key stores, the provider must be registered with the JCA.
name
)

Sets the JCA provider name to use for creating key stores.

public SSLContextBuilder

Returns:

this builder
setKeyStoreType
(final String
the SSLkey store type. See the KeyStore section in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information.
keyStoreType
)

Sets the key store type.

public SSLContextBuilder

Returns:

this builder
setProtocol
(final String
the SSLContext algorithm name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information.
protocol
)

Sets the SSLContext algorithm name.

public SSLContextBuilder
setProvider(final Provider provider)

public SSLContextBuilder
setProvider(final String name)

public SSLContextBuilder
setSecureRandom(final SecureRandom secureRandom)

public SSLContextBuilder

Returns:

this builder
setTrustManagerFactoryAlgorithm
(final String
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.
trustManagerFactoryAlgorithm
)

Sets the trust manager factory algorithm name.

public SSLContextBuilder

Returns:

this builder
setTrustStoreProvider
(final Provider
provider to use for creating trust stores.
provider
)

Sets the JCA provider to use for creating trust stores.

public SSLContextBuilder

Returns:

this builder
setTrustStoreProvider
(final String
Name of the provider to use for creating trust stores, the provider must be registered with the JCA.
name
)

Sets the JCA provider name to use for creating trust stores.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait