Class ToolariumTrustManager
java.lang.Object
com.github.toolarium.security.keystore.impl.ToolariumTrustManager
- All Implemented Interfaces:
TrustManager,X509TrustManager
Toolariun
TrustManager which logs the verification.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a trusted certificateprotected voidcheckCACertificate(X509Certificate cacert) Checks the CA certificateprotected voidChecks the certificateprotected voidcheckCertificateChain(X509Certificate[] chain) Checks the certificate chainvoidcheckClientTrusted(X509Certificate[] chain, String protocol) voidcheckServerTrusted(X509Certificate[] chain, String protocol) intGets the check resultprotected StringGets the host namevoidsetVerifyCertificate(boolean verifyCertificate) Set the verify certificateprotected booleantrustServerCertificate(X509Certificate certificate) Check if the given certificate should be trust and added to the certificate server listvoidverifyCertificateChain(X509Certificate[] chain, String protocol) Verifies a certificate chain.
-
Constructor Details
-
ToolariumTrustManager
public ToolariumTrustManager()Constructor for ToolariumTrustManager
-
-
Method Details
-
addTrustedCertificate
Adds a trusted certificate- Parameters:
cert- the certificate to trust
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String protocol) throws CertificateException - Specified by:
checkClientTrustedin interfaceX509TrustManager- Throws:
CertificateException- See Also:
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String protocol) throws CertificateException - Specified by:
checkServerTrustedin interfaceX509TrustManager- Throws:
CertificateException- See Also:
-
setVerifyCertificate
public void setVerifyCertificate(boolean verifyCertificate) Set the verify certificate- Parameters:
verifyCertificate- true to verify certificates
-
getAcceptedIssuers
- Specified by:
getAcceptedIssuersin interfaceX509TrustManager- See Also:
-
getCheckResult
public int getCheckResult()Gets the check result- Returns:
- the check result
-
verifyCertificateChain
public void verifyCertificateChain(X509Certificate[] chain, String protocol) throws CertificateException Verifies a certificate chain.- Parameters:
chain- a certificate chainprotocol- the protocol- Throws:
CertificateException- in case of error
-
checkCertificate
Checks the certificate- Parameters:
cert- the certificate to test- Throws:
CertificateException- In case of a certificate error
-
checkCACertificate
Checks the CA certificate- Parameters:
cacert- the certificate to test- Throws:
CertificateException- In case of a certificate error
-
checkCertificateChain
Checks the certificate chain- Parameters:
chain- the chain- Throws:
CertificateException- In case of a certificate error
-
trustServerCertificate
Check if the given certificate should be trust and added to the certificate server list- Parameters:
certificate- the server certificate- Returns:
- true if we trust the server certificate
-
getHostname
Gets the host name- Returns:
- the name
-