public class HostnameVerifyingTrustManager extends Object implements X509TrustManager
CertificateHostnameVerifier
. Any name that verifies passes this trust manager
check.Modifier and Type | Field and Description |
---|---|
private String[] |
hostnames
Hostnames to allow.
|
private CertificateHostnameVerifier |
hostnameVerifier
Hostname verifier to use for trust.
|
protected Logger |
logger
Logger for this class.
|
Constructor and Description |
---|
HostnameVerifyingTrustManager(CertificateHostnameVerifier verifier,
String... names)
Creates a new hostname verifying trust manager.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkCertificateTrusted(X509Certificate cert)
Verifies the supplied certificate using the hostname verifier with each hostname.
|
void |
checkClientTrusted(X509Certificate[] chain,
String authType) |
void |
checkServerTrusted(X509Certificate[] chain,
String authType) |
X509Certificate[] |
getAcceptedIssuers() |
String |
toString() |
protected final Logger logger
private final String[] hostnames
private final CertificateHostnameVerifier hostnameVerifier
public HostnameVerifyingTrustManager(CertificateHostnameVerifier verifier, String... names)
verifier
- that establishes trustnames
- to match against a certificatepublic void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkClientTrusted
in interface X509TrustManager
CertificateException
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkServerTrusted
in interface X509TrustManager
CertificateException
private void checkCertificateTrusted(X509Certificate cert) throws CertificateException
cert
- to verifyCertificateException
- if none of the hostnames verifypublic X509Certificate[] getAcceptedIssuers()
getAcceptedIssuers
in interface X509TrustManager
Copyright © 2003-2019 Virginia Tech. All Rights Reserved.