Top Description Inners Fields Constructors Methods
org.apache.http.conn.ssl

public Class SSLContextBuilder

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.net.Socket, java.security.KeyManagementException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .Principal, .PrivateKey, .SecureRandom, .UnrecoverableKeyException, java.security.cert.CertificateException, .X509Certificate, java.util.Collections, .HashMap, .LinkedHashSet, .Map, .Set, javax.net.ssl.KeyManager, .KeyManagerFactory, .SSLContext, .TrustManager, .TrustManagerFactory, .X509KeyManager, .X509TrustManager

Deprecated

(4.4) use org.apache.http.ssl.SSLContextBuilder.

Builder for SSLContext instances.
Since
4.3

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 final Set<KeyManager>
private String
private SecureRandom
pack-priv static final String
pack-priv static final String
private final Set<TrustManager>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SSLContext
public SSLContextBuilder
loadKeyMaterial(final KeyStore keystore, final char[] keyPassword)

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
loadKeyMaterial(final KeyStore keystore, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy)

Deprecated as a consequence of PrivateKeyStrategy and SSLContextBuilder being deprecated.
public SSLContextBuilder
loadTrustMaterial(final KeyStore truststore, final TrustStrategy trustStrategy)

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
loadTrustMaterial(final KeyStore truststore)

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
setSecureRandom(final SecureRandom secureRandom)

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
useProtocol(final String protocol)

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
useSSL()

Deprecated as a consequence of SSLContextBuilder being deprecated.
public SSLContextBuilder
useTLS()

Deprecated as a consequence of SSLContextBuilder being deprecated.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keymanagersback to summary
private final Set<KeyManager> keymanagers
protocolback to summary
private String protocol
secureRandomback to summary
private SecureRandom secureRandom
SSLback to summary
pack-priv static final String SSL
TLSback to summary
pack-priv static final String TLS
trustmanagersback to summary
private final Set<TrustManager> trustmanagers

Constructor Detail

SSLContextBuilderback to summary
public SSLContextBuilder()

Method Detail

buildback to summary
public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final KeyStore keystore, final char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final KeyStore keystore, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException

Deprecated

as a consequence of PrivateKeyStrategy and SSLContextBuilder being deprecated. See corresponding docs for further information.

loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final KeyStore truststore, final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final KeyStore truststore) throws NoSuchAlgorithmException, KeyStoreException

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

setSecureRandomback to summary
public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom)

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

useProtocolback to summary
public SSLContextBuilder useProtocol(final String protocol)

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

useSSLback to summary
public SSLContextBuilder useSSL()

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

useTLSback to summary
public SSLContextBuilder useTLS()

Deprecated

as a consequence of SSLContextBuilder being deprecated. See corresponding docs for further information.

org.apache.http.conn.ssl back to summary

pack-priv Class SSLContextBuilder.KeyManagerDelegate

extends Object
implements X509KeyManager
Class Inheritance
  • java.lang.Object
  • org.apache.http.conn.ssl.SSLContextBuilder.KeyManagerDelegate
All Implemented Interfaces
javax.net.ssl.X509KeyManager, javax.net.ssl.KeyManager

Field Summary

Modifier and TypeField and Description
private final PrivateKeyStrategy
aliasStrategy

Deprecated as a consequence of PrivateKeyStrategy being deprecated.
private final X509KeyManager

Constructor Summary

AccessConstructor and Description
pack-priv
KeyManagerDelegate(final X509KeyManager keyManager, final PrivateKeyStrategy aliasStrategy)

Deprecated as a consequence of PrivateKeyStrategy being deprecated.

Method Summary

Modifier and TypeMethod and Description
public String
chooseClientAlias(final String[]
the key algorithm type name(s), ordered with the most-preferred key type first.
keyTypes
,
final Principal[]
the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
issuers
,
final Socket
the socket to be used for this connection. This parameter can be null, which indicates that implementations are free to select an alias applicable to any socket.
socket
)

Implements javax.net.ssl.X509KeyManager.chooseClientAlias.

Choose an alias to authenticate the client side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
public String
chooseServerAlias(final String
the key algorithm type name.
keyType
,
final Principal[]
the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
issuers
,
final Socket
the socket to be used for this connection. This parameter can be null, which indicates that implementations are free to select an alias applicable to any socket.
socket
)

Implements javax.net.ssl.X509KeyManager.chooseServerAlias.

Choose an alias to authenticate the server side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
public X509Certificate[]
getCertificateChain(final String
the alias name
alias
)

Implements javax.net.ssl.X509KeyManager.getCertificateChain.

Returns the certificate chain associated with the given alias.
public String[]
getClientAliases(final String
the key algorithm type name
keyType
,
final Principal[]
the list of acceptable CA issuer subject names, or null if it does not matter which issuers are used.
issuers
)

Implements javax.net.ssl.X509KeyManager.getClientAliases.

Get the matching aliases for authenticating the client side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
public PrivateKey
getPrivateKey(final String
the alias name
alias
)

Implements javax.net.ssl.X509KeyManager.getPrivateKey.

Returns the key associated with the given alias.
public String[]
getServerAliases(final String
the key algorithm type name
keyType
,
final Principal[]
the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
issuers
)

Implements javax.net.ssl.X509KeyManager.getServerAliases.

Get the matching aliases for authenticating the server side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasStrategyback to summary
private final PrivateKeyStrategy aliasStrategy

Deprecated

as a consequence of PrivateKeyStrategy being deprecated. See corresponding docs for further information.

keyManagerback to summary
private final X509KeyManager keyManager

Constructor Detail

KeyManagerDelegateback to summary
pack-priv KeyManagerDelegate(final X509KeyManager keyManager, final PrivateKeyStrategy aliasStrategy)

Deprecated

as a consequence of PrivateKeyStrategy being deprecated. See corresponding docs for further information.

Method Detail

chooseClientAliasback to summary
public String chooseClientAlias(final String[] keyTypes, final Principal[] issuers, final Socket socket)

Implements javax.net.ssl.X509KeyManager.chooseClientAlias.

Doc from javax.net.ssl.X509KeyManager.chooseClientAlias.

Choose an alias to authenticate the client side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).

Parameters
keyTypes:String[]

the key algorithm type name(s), ordered with the most-preferred key type first.

issuers:Principal[]

the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.

socket:Socket

the socket to be used for this connection. This parameter can be null, which indicates that implementations are free to select an alias applicable to any socket.

Returns:String

the alias name for the desired key, or null if there are no matches.

Annotations
@Override
chooseServerAliasback to summary
public String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket)

Implements javax.net.ssl.X509KeyManager.chooseServerAlias.

Doc from javax.net.ssl.X509KeyManager.chooseServerAlias.

Choose an alias to authenticate the server side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).

Parameters
keyType:String

the key algorithm type name.

issuers:Principal[]

the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.

socket:Socket

the socket to be used for this connection. This parameter can be null, which indicates that implementations are free to select an alias applicable to any socket.

Returns:String

the alias name for the desired key, or null if there are no matches.

Annotations
@Override
getCertificateChainback to summary
public X509Certificate[] getCertificateChain(final String alias)

Implements javax.net.ssl.X509KeyManager.getCertificateChain.

Doc from javax.net.ssl.X509KeyManager.getCertificateChain.

Returns the certificate chain associated with the given alias.

Parameters
alias:String

the alias name

Returns:X509Certificate[]

the certificate chain (ordered with the user's certificate first and the root certificate authority last), or null if the alias can't be found.

Annotations
@Override
getClientAliasesback to summary
public String[] getClientAliases(final String keyType, final Principal[] issuers)

Implements javax.net.ssl.X509KeyManager.getClientAliases.

Doc from javax.net.ssl.X509KeyManager.getClientAliases.

Get the matching aliases for authenticating the client side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).

Parameters
keyType:String

the key algorithm type name

issuers:Principal[]

the list of acceptable CA issuer subject names, or null if it does not matter which issuers are used.

Returns:String[]

an array of the matching alias names, or null if there were no matches.

Annotations
@Override
getPrivateKeyback to summary
public PrivateKey getPrivateKey(final String alias)

Implements javax.net.ssl.X509KeyManager.getPrivateKey.

Doc from javax.net.ssl.X509KeyManager.getPrivateKey.

Returns the key associated with the given alias.

Parameters
alias:String

the alias name

Returns:PrivateKey

the requested key, or null if the alias can't be found.

Annotations
@Override
getServerAliasesback to summary
public String[] getServerAliases(final String keyType, final Principal[] issuers)

Implements javax.net.ssl.X509KeyManager.getServerAliases.

Doc from javax.net.ssl.X509KeyManager.getServerAliases.

Get the matching aliases for authenticating the server side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).

Parameters
keyType:String

the key algorithm type name

issuers:Principal[]

the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.

Returns:String[]

an array of the matching alias names, or null if there were no matches.

Annotations
@Override
org.apache.http.conn.ssl back to summary

pack-priv Class SSLContextBuilder.TrustManagerDelegate

extends Object
implements X509TrustManager
Class Inheritance
  • java.lang.Object
  • org.apache.http.conn.ssl.SSLContextBuilder.TrustManagerDelegate
All Implemented Interfaces
javax.net.ssl.X509TrustManager, javax.net.ssl.TrustManager

Field Summary

Modifier and TypeField and Description
private final X509TrustManager
private final TrustStrategy

Constructor Summary

AccessConstructor and Description
pack-priv
TrustManagerDelegate(final X509TrustManager trustManager, final TrustStrategy trustStrategy)

Method Summary

Modifier and TypeMethod and Description
public void
checkClientTrusted(final X509Certificate[]
the peer certificate chain
chain
,
final String
the authentication type based on the client certificate
authType
)

Implements javax.net.ssl.X509TrustManager.checkClientTrusted.

Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for client SSL authentication based on the authentication type.
public void
checkServerTrusted(final X509Certificate[]
the peer certificate chain
chain
,
final String
the key exchange algorithm used
authType
)

Implements javax.net.ssl.X509TrustManager.checkServerTrusted.

Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for server SSL authentication based on the authentication type.
public X509Certificate[]
getAcceptedIssuers()

Implements javax.net.ssl.X509TrustManager.getAcceptedIssuers.

Return an array of certificate authority certificates which are trusted for authenticating peers.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

trustManagerback to summary
private final X509TrustManager trustManager
trustStrategyback to summary
private final TrustStrategy trustStrategy

Constructor Detail

TrustManagerDelegateback to summary
pack-priv TrustManagerDelegate(final X509TrustManager trustManager, final TrustStrategy trustStrategy)

Method Detail

checkClientTrustedback to summary
public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException

Implements javax.net.ssl.X509TrustManager.checkClientTrusted.

Doc from javax.net.ssl.X509TrustManager.checkClientTrusted.

Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for client SSL authentication based on the authentication type.

The authentication type is determined by the actual certificate used. For instance, if RSAPublicKey is used, the authType should be "RSA". Checking is case-sensitive.

Parameters
chain:X509Certificate[]

the peer certificate chain

authType:String

the authentication type based on the client certificate

Annotations
@Override
Exceptions
CertificateException:
if the certificate chain is not trusted by this TrustManager.
checkServerTrustedback to summary
public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException

Implements javax.net.ssl.X509TrustManager.checkServerTrusted.

Doc from javax.net.ssl.X509TrustManager.checkServerTrusted.

Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for server SSL authentication based on the authentication type.

The authentication type is the key exchange algorithm portion of the cipher suites represented as a String, such as "RSA", "DHE_DSS".

Note

for some exportable cipher suites, the key exchange algorithm is determined at run time during the handshake. For instance, for TLS_RSA_EXPORT_WITH_RC4_40_MD5, the authType should be RSA_EXPORT when an ephemeral RSA key is used for the key exchange, and RSA when the key from the server certificate is used. Checking is case-sensitive.

Parameters
chain:X509Certificate[]

the peer certificate chain

authType:String

the key exchange algorithm used

Annotations
@Override
Exceptions
CertificateException:
if the certificate chain is not trusted by this TrustManager.
getAcceptedIssuersback to summary
public X509Certificate[] getAcceptedIssuers()

Implements javax.net.ssl.X509TrustManager.getAcceptedIssuers.

Doc from javax.net.ssl.X509TrustManager.getAcceptedIssuers.

Return an array of certificate authority certificates which are trusted for authenticating peers.

Returns:X509Certificate[]

a non-null (possibly empty) array of acceptable CA issuer certificates.

Annotations
@Override