java.lang.Object
org.newsclub.net.unix.ssl.FilterX509TrustManager
org.newsclub.net.unix.ssl.ValidatingX509TrustManager
- All Implemented Interfaces:
TrustManager,X509TrustManager
A wrapping
X509TrustManager that verifies each individual certificate in a chain, in
addition to the successful validation by the wrapped X509TrustManager.
This could be useful in some scenarios where self-signed certificates are being used, or where
the upstream TrustManager can't be fully trusted.
- Author:
- Christian Kohlschütter
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aValidatingX509TrustManagerinstance that wraps the givenX509TrustManager. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonCertificateException(boolean checkClient, CertificateException e, X509Certificate[] chain, String authType) Called whenever the wrappedX509TrustManagerthrows an exception when checking client or server certificate chains.protected voidonCertificateTrusted(boolean checkClient, X509Certificate[] chain, String authType) Called whenever the wrappedX509TrustManagertrusted a given client or server certificate chains.Methods inherited from class org.newsclub.net.unix.ssl.FilterX509TrustManager
checkClientTrusted, checkServerTrusted, getAcceptedIssuers
-
Constructor Details
-
ValidatingX509TrustManager
Constructs aValidatingX509TrustManagerinstance that wraps the givenX509TrustManager.- Parameters:
wrapped- The wrapped trust manager.
-
-
Method Details
-
onCertificateException
protected void onCertificateException(boolean checkClient, CertificateException e, X509Certificate[] chain, String authType) throws CertificateException Description copied from class:FilterX509TrustManagerCalled whenever the wrappedX509TrustManagerthrows an exception when checking client or server certificate chains.- Specified by:
onCertificateExceptionin classFilterX509TrustManager- Parameters:
checkClient- Iftrue, we're checking a client certificate chain, iffalsea server's.e- The caught exceptionchain- The (potentially partial) certificate chainauthType- The authType.- Throws:
CertificateException- if desired.
-
onCertificateTrusted
protected void onCertificateTrusted(boolean checkClient, X509Certificate[] chain, String authType) throws CertificateException Description copied from class:FilterX509TrustManagerCalled whenever the wrappedX509TrustManagertrusted a given client or server certificate chains.- Specified by:
onCertificateTrustedin classFilterX509TrustManager- Parameters:
checkClient- Iftrue, we're checking a client certificate chain, iffalsea server's.chain- The (potentially partial) certificate chainauthType- The authType.- Throws:
CertificateException- if desired.
-