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

public Class SSLContextBuilder

extends Object
Class Inheritance
Imports
java.io.File, .FileInputStream, .IOException, .InputStream, java.net.Socket, .URL, java.security.KeyManagementException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .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, .TrustManager, .TrustManagerFactory, .X509ExtendedKeyManager, .X509TrustManager, org.apache.http.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

TODO Specify which Oracle JSSE versions the above has been verified.

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

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 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)

public SSLContextBuilder
loadTrustMaterial(final KeyStore truststore, final TrustStrategy trustStrategy)

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)

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
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 protocol 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 protocol 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 String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public SSLContextBuilder

Returns:

this builder
useProtocol
(final String
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.
protocol
)

Deprecated Use setProtocol(String).
Sets the SSLContext protocol algorithm name.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

keyManagerFactoryAlgorithmback to summary
private String keyManagerFactoryAlgorithm
keyManagersback to summary
private final Set<KeyManager> keyManagers
keyStoreTypeback to summary
private String keyStoreType
protocolback to summary
private String protocol
providerback to summary
private Provider provider
secureRandomback to summary
private SecureRandom secureRandom
TLSback to summary
pack-priv static final String TLS
trustManagerFactoryAlgorithmback to summary
private String trustManagerFactoryAlgorithm
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
createback to summary
public static SSLContextBuilder create()
initSSLContextback to summary
protected void initSSLContext(final SSLContext sslContext, final Collection<KeyManager> keyManagers, final Collection<TrustManager> trustManagers, final SecureRandom secureRandom) throws KeyManagementException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final KeyStore keystore, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final KeyStore keystore, final char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final File file, final char[] storePassword, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final File file, final char[] storePassword, final char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final URL url, final char[] storePassword, final char[] keyPassword, final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
loadKeyMaterialback to summary
public SSLContextBuilder loadKeyMaterial(final URL url, final char[] storePassword, final char[] keyPassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final KeyStore truststore, final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final File file, final char[] storePassword, final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final File file, final char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final File file) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final URL url, final char[] storePassword, final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
loadTrustMaterialback to summary
public SSLContextBuilder loadTrustMaterial(final URL url, final char[] storePassword) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
setKeyManagerFactoryAlgorithmback to summary
public SSLContextBuilder setKeyManagerFactoryAlgorithm(final String keyManagerFactoryAlgorithm)

Sets the key manager factory algorithm name.

Parameters
keyManagerFactoryAlgorithm: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.

Returns:SSLContextBuilder

this builder

Since
4.4.7
See Also
Java Cryptography Architecture Standard Algorithm Name Documentation
setKeyStoreTypeback to summary
public SSLContextBuilder setKeyStoreType(final String keyStoreType)

Sets the key store type.

Parameters
keyStoreType:String

the SSLkey store type. See the KeyStore section in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information.

Returns:SSLContextBuilder

this builder

Since
4.4.7
See Also
Java Cryptography Architecture Standard Algorithm Name Documentation
setProtocolback to summary
public SSLContextBuilder setProtocol(final String protocol)

Sets the SSLContext protocol algorithm name.

Parameters
protocol:String

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:SSLContextBuilder

this builder

Since
4.4.7
See Also
Java Cryptography Architecture Standard Algorithm Name Documentation
setProviderback to summary
public SSLContextBuilder setProvider(final Provider provider)
setProviderback to summary
public SSLContextBuilder setProvider(final String name)
setSecureRandomback to summary
public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom)
setTrustManagerFactoryAlgorithmback to summary
public SSLContextBuilder setTrustManagerFactoryAlgorithm(final String trustManagerFactoryAlgorithm)

Sets the trust manager factory algorithm name.

Parameters
trustManagerFactoryAlgorithm: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.

Returns:SSLContextBuilder

this builder

Since
4.4.7
See Also
Java Cryptography Architecture Standard Algorithm Name Documentation
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
useProtocolback to summary
public SSLContextBuilder useProtocol(final String protocol)

Deprecated

Use setProtocol(String).

Sets the SSLContext protocol algorithm name.

Parameters
protocol:String

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:SSLContextBuilder

this builder

Annotations
@Deprecated
See Also
Java Cryptography Architecture Standard Algorithm Name Documentation
org.apache.http.ssl back to summary

pack-priv Class SSLContextBuilder.KeyManagerDelegate

extends X509ExtendedKeyManager
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final PrivateKeyStrategy
private final X509ExtendedKeyManager

Constructor Summary

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

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
chooseEngineClientAlias(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 SSLEngine
the SSLEngine to be used for this connection. This parameter can be null, which indicates that implementations of this interface are free to select an alias applicable to any engine.
sslEngine
)

Overrides javax.net.ssl.X509ExtendedKeyManager.chooseEngineClientAlias.

Choose an alias to authenticate the client side of an SSLEngine connection given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
public String
chooseEngineServerAlias(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 SSLEngine
the SSLEngine to be used for this connection. This parameter can be null, which indicates that implementations of this interface are free to select an alias applicable to any engine.
sslEngine
)

Overrides javax.net.ssl.X509ExtendedKeyManager.chooseEngineServerAlias.

Choose an alias to authenticate the server side of an SSLEngine connection 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 Map<String, PrivateKeyDetails>
getClientAliasMap(final String[] keyTypes, final Principal[] issuers)

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).
public Map<String, PrivateKeyDetails>
getServerAliasMap(final String keyType, final Principal[] issuers)

Field Detail

aliasStrategyback to summary
private final PrivateKeyStrategy aliasStrategy
keyManagerback to summary
private final X509ExtendedKeyManager keyManager

Constructor Detail

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

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
chooseEngineClientAliasback to summary
public String chooseEngineClientAlias(final String[] keyTypes, final Principal[] issuers, final SSLEngine sslEngine)

Overrides javax.net.ssl.X509ExtendedKeyManager.chooseEngineClientAlias.

Doc from javax.net.ssl.X509ExtendedKeyManager.chooseEngineClientAlias.

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

The default implementation returns null.

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.

sslEngine:SSLEngine

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

Returns:String

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

Annotations
@Override
chooseEngineServerAliasback to summary
public String chooseEngineServerAlias(final String keyType, final Principal[] issuers, final SSLEngine sslEngine)

Overrides javax.net.ssl.X509ExtendedKeyManager.chooseEngineServerAlias.

Doc from javax.net.ssl.X509ExtendedKeyManager.chooseEngineServerAlias.

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

The default implementation returns null.

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.

sslEngine:SSLEngine

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

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
getClientAliasMapback to summary
public Map<String, PrivateKeyDetails> getClientAliasMap(final String[] keyTypes, final Principal[] issuers)
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
getServerAliasMapback to summary
public Map<String, PrivateKeyDetails> getServerAliasMap(final String keyType, final Principal[] issuers)
org.apache.http.ssl back to summary

pack-priv Class SSLContextBuilder.TrustManagerDelegate

extends Object
implements X509TrustManager
Class Inheritance
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