Package org.ldaptive.ssl
Class X509ExtendedTrustManagerWrapper
- java.lang.Object
-
- javax.net.ssl.X509ExtendedTrustManager
-
- org.ldaptive.ssl.X509ExtendedTrustManagerWrapper
-
- All Implemented Interfaces:
TrustManager
,X509TrustManager
public class X509ExtendedTrustManagerWrapper extends X509ExtendedTrustManager
Wraps anX509TrustManager
in order to provide hostname verification.
-
-
Field Summary
Fields Modifier and Type Field Description private CertificateHostnameVerifier
hostnameVerifier
Hostname verifier.protected Logger
logger
Logger for this class.private X509TrustManager
trustManager
Trust manager.
-
Constructor Summary
Constructors Constructor Description X509ExtendedTrustManagerWrapper(X509TrustManager manager, CertificateHostnameVerifier verifier)
Creates a new X509 extended trust manager wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClientTrusted(X509Certificate[] chain, String authType)
void
checkClientTrusted(X509Certificate[] chain, String authType, Socket socket)
void
checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine)
void
checkServerTrusted(X509Certificate[] chain, String authType)
void
checkServerTrusted(X509Certificate[] chain, String authType, Socket socket)
void
checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine)
X509Certificate[]
getAcceptedIssuers()
protected void
verifyHostname(SSLSession session, X509Certificate cert)
Resolves a hostname from the supplied session and invokeshostnameVerifier
.
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
trustManager
private final X509TrustManager trustManager
Trust manager.
-
hostnameVerifier
private final CertificateHostnameVerifier hostnameVerifier
Hostname verifier.
-
-
Constructor Detail
-
X509ExtendedTrustManagerWrapper
public X509ExtendedTrustManagerWrapper(X509TrustManager manager, CertificateHostnameVerifier verifier)
Creates a new X509 extended trust manager wrapper.- Parameters:
manager
- to wrapverifier
- to verify hostname
-
-
Method Detail
-
verifyHostname
protected void verifyHostname(SSLSession session, X509Certificate cert) throws CertificateException
Resolves a hostname from the supplied session and invokeshostnameVerifier
.- Parameters:
session
- to extract hostname fromcert
- to verify hostname against- Throws:
CertificateException
- if the hostname cannot be verified
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException
- Specified by:
checkClientTrusted
in classX509ExtendedTrustManager
- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException
- Specified by:
checkServerTrusted
in classX509ExtendedTrustManager
- Throws:
CertificateException
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException
- Specified by:
checkClientTrusted
in classX509ExtendedTrustManager
- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException
- Specified by:
checkServerTrusted
in classX509ExtendedTrustManager
- Throws:
CertificateException
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
- Throws:
CertificateException
-
getAcceptedIssuers
public X509Certificate[] getAcceptedIssuers()
-
-