Class CertificateCapturingTrustManager
java.lang.Object
de.xima.fc.certificate.provider.internal.CertificateCapturingTrustManager
- All Implemented Interfaces:
TrustManager, X509TrustManager
A TrustManager that captures the certificate chain presented during trust validation.
This class delegates trust checks to a provided X509TrustManager and records the certificate chain for
later inspection. It also tracks whether the validation passed and any exception that occurred during validation.
The captured certificates are available as a List via getCapturedServerCertificates().
- Since:
- 04.06.25
- Author:
- tobias
-
Constructor Summary
ConstructorsConstructorDescriptionCertificateCapturingTrustManager(X509TrustManager trustManager) Constructs a new CertificateCapturingTrustManager with the given trust manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClientTrusted(X509Certificate[] chain, String authType) Captures the client certificate chain and delegates trust validation.voidcheckServerTrusted(X509Certificate[] chain, String authType) Captures the server certificate chain and delegates trust validation.Returns the list of accepted issuers from the underlying trust manager.The most recently captured client certificate chain as a list.The most recently captured server certificate chain as a list.The exception thrown during the last client trust validation, if any.Indicates whether the last client trust validation passed.Returns the last client trust validation result, including captured certificates and validation status.Returns the last server trust validation result, including captured certificates and validation status.The exception thrown during the last server trust validation, if any.Indicates whether the last server trust validation passed.
-
Constructor Details
-
CertificateCapturingTrustManager
Constructs a new CertificateCapturingTrustManager with the given trust manager.- Parameters:
trustManager- the trust manager to delegate to
-
-
Method Details
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException Captures the client certificate chain and delegates trust validation.- Specified by:
checkClientTrustedin interfaceX509TrustManager- Parameters:
chain- the client certificate chainauthType- the authentication type- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException Captures the server certificate chain and delegates trust validation. Does not rethrow the exception to allow certificate capture.- Specified by:
checkServerTrustedin interfaceX509TrustManager- Parameters:
chain- the server certificate chainauthType- the authentication type- Throws:
CertificateException
-
getAcceptedIssuers
Returns the list of accepted issuers from the underlying trust manager.- Specified by:
getAcceptedIssuersin interfaceX509TrustManager- Returns:
- an array of accepted X509Certificate issuers
-
getLastClientTrustValidationResult
Returns the last client trust validation result, including captured certificates and validation status.- Returns:
- an
TrustValidationResultcontaining the results of the last client trust validation, ornullif no validation has been performed yet.
-
getLastServerTrustValidationResult
Returns the last server trust validation result, including captured certificates and validation status.- Returns:
- an
TrustValidationResultcontaining the results of the last server trust validation, ornullif no validation has been performed yet.
-
getCapturedServerCertificates
The most recently captured server certificate chain as a list. -
getCapturedClientCertificates
The most recently captured client certificate chain as a list. -
getServerTrustValidationPassed
Indicates whether the last server trust validation passed. -
getClientTrustValidationPassed
Indicates whether the last client trust validation passed. -
getServerTrustValidationException
The exception thrown during the last server trust validation, if any. -
getClientTrustValidationException
The exception thrown during the last client trust validation, if any.
-