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
ConstructorDescriptionConstructs aValidatingX509TrustManager
instance that wraps the givenX509TrustManager
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
onCertificateException
(boolean checkClient, CertificateException e, X509Certificate[] chain, String authType) Called whenever the wrappedX509TrustManager
throws an exception when checking client or server certificate chains.protected void
onCertificateTrusted
(boolean checkClient, X509Certificate[] chain, String authType) Called whenever the wrappedX509TrustManager
trusted a given client or server certificate chains.Methods inherited from class org.newsclub.net.unix.ssl.FilterX509TrustManager
checkClientTrusted, checkServerTrusted, getAcceptedIssuers
-
Constructor Details
-
ValidatingX509TrustManager
Constructs aValidatingX509TrustManager
instance 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:FilterX509TrustManager
Called whenever the wrappedX509TrustManager
throws an exception when checking client or server certificate chains.- Specified by:
onCertificateException
in classFilterX509TrustManager
- Parameters:
checkClient
- Iftrue
, we're checking a client certificate chain, iffalse
a 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:FilterX509TrustManager
Called whenever the wrappedX509TrustManager
trusted a given client or server certificate chains.- Specified by:
onCertificateTrusted
in classFilterX509TrustManager
- Parameters:
checkClient
- Iftrue
, we're checking a client certificate chain, iffalse
a server's.chain
- The (potentially partial) certificate chainauthType
- The authType.- Throws:
CertificateException
- if desired.
-