Package com.codedx.security
Class ReloadableX509TrustManager
- java.lang.Object
-
- com.codedx.security.ReloadableX509TrustManager
-
- All Implemented Interfaces:
TrustManager
,X509TrustManager
public class ReloadableX509TrustManager extends Object implements X509TrustManager
This X509TrustManager implementation allows invalid certificates to possibly be accepted by the decision of anInvalidCertificateStrategy
that is passed as a constructor argument. Certificates added in this way will be added via aExtraCertManager
, causing the underlying trust manager to be reloaded. Adapted from the implementation at "Managing a Dynamic Java Trust Store" (blog post)
-
-
Constructor Summary
Constructors Constructor Description ReloadableX509TrustManager(ExtraCertManager certManager, InvalidCertificateStrategy invalidCertStrat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClientTrusted(X509Certificate[] chain, String authType)
void
checkServerTrusted(X509Certificate[] chain, String authType)
X509Certificate[]
getAcceptedIssuers()
-
-
-
Constructor Detail
-
ReloadableX509TrustManager
public ReloadableX509TrustManager(ExtraCertManager certManager, InvalidCertificateStrategy invalidCertStrat) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
-
Method Detail
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
- Specified by:
checkClientTrusted
in interfaceX509TrustManager
- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
- Specified by:
checkServerTrusted
in interfaceX509TrustManager
- Throws:
CertificateException
-
getAcceptedIssuers
public X509Certificate[] getAcceptedIssuers()
- Specified by:
getAcceptedIssuers
in interfaceX509TrustManager
-
-