Class ThreadLocalX509TrustEngineSupport
- java.lang.Object
-
- org.opensaml.security.x509.tls.impl.ThreadLocalX509TrustEngineSupport
-
public final class ThreadLocalX509TrustEngineSupport extends Object
Support class for centralizing evaluation of a certificate chain using trust engine and criteria fromThreadLocalX509TrustEngineContext.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGLogger.
-
Constructor Summary
Constructors Modifier Constructor Description privateThreadLocalX509TrustEngineSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidevaluate(X509Certificate[] chain)Perform trust evaluation on the specified certificate chain using the current data inThreadLocalX509TrustEngineContext.static voidevaluate(SSLSocket sslSocket)Perform trust evaluation on the specifiedSSLSocketusing the current data inThreadLocalX509TrustEngineContext.private static X509CredentialextractCredential(X509Certificate[] chain)Extract the server TLSX509Credentialfrom the suppliedSSLSocket.private static booleanperformTrustEval(X509Certificate[] chain, TrustEngine<? super X509Credential> trustEngine, CriteriaSet criteriaSet)Perform trust evaluation on the specified certificate chain using the supplied trust engine and criteria.
-
-
-
Method Detail
-
evaluate
public static void evaluate(@Nonnull SSLSocket sslSocket) throws SSLPeerUnverifiedExceptionPerform trust evaluation on the specifiedSSLSocketusing the current data inThreadLocalX509TrustEngineContext.- Parameters:
sslSocket- the socket whose certificates are to be evaluated- Throws:
SSLPeerUnverifiedException- if the certificate chain was not trusted by the supplied TrustEngine
-
evaluate
public static void evaluate(@Nonnull X509Certificate[] chain) throws CertificateExceptionPerform trust evaluation on the specified certificate chain using the current data inThreadLocalX509TrustEngineContext.- Parameters:
chain- the certificate chain to be evaluated- Throws:
CertificateException- if the certificate chain is not trusted by the supplied TrustEngine
-
performTrustEval
private static boolean performTrustEval(@Nonnull X509Certificate[] chain, @Nonnull TrustEngine<? super X509Credential> trustEngine, @Nonnull CriteriaSet criteriaSet) throws CertificateExceptionPerform trust evaluation on the specified certificate chain using the supplied trust engine and criteria.- Parameters:
chain- the certificate chain to be evaluatedtrustEngine- the trust enginecriteriaSet- the criteria set- Returns:
- true if certificate was established as trusted, false if not
- Throws:
CertificateException- if the trust of the certificate
-
extractCredential
@Nonnull private static X509Credential extractCredential(@Nonnull @NotEmpty X509Certificate[] chain) throws CertificateException
Extract the server TLSX509Credentialfrom the suppliedSSLSocket.- Parameters:
chain- the chain of X509 certificates- Returns:
- an X509Credential representing the entity certificate as well as the supplied supporting intermediate certificate chain (if any)
- Throws:
CertificateException- if credential data can not be extracted from the socket
-
-