public class CompositeX509TrustManager extends Object implements X509TrustManager
X509TrustManager
s with additive trust.
If any one of the composed managers trusts a certificate chain, then it is
trusted by the composite manager.
This is necessary because of the fine-print on SSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)
: Only
the first instance of a particular key and/or trust manager implementation
type in the array is used. (For example, only the first
javax.net.ssl.X509KeyManager in the array will be used.)
see StackOverflow
Constructor and Description |
---|
CompositeX509TrustManager(List<X509TrustManager> trustManagers)
Initializes the composite trust manager, copying all of the non-null
entries in the given
trustManagers list into its own
internal list. |
Modifier and Type | Method and Description |
---|---|
void |
checkClientTrusted(X509Certificate[] chain,
String authType) |
void |
checkServerTrusted(X509Certificate[] chain,
String authType) |
X509Certificate[] |
getAcceptedIssuers() |
public CompositeX509TrustManager(List<X509TrustManager> trustManagers)
trustManagers
list into its own
internal list.trustManagers
- A list of (potentially null) trust managers.public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkClientTrusted
in interface X509TrustManager
CertificateException
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkServerTrusted
in interface X509TrustManager
CertificateException
public X509Certificate[] getAcceptedIssuers()
getAcceptedIssuers
in interface X509TrustManager
Copyright © 2004-2017. All Rights Reserved.