Package org.apache.hc.client5.http.ssl
Class DefaultHostnameVerifier
- java.lang.Object
-
- org.apache.hc.client5.http.ssl.DefaultHostnameVerifier
-
- All Implemented Interfaces:
javax.net.ssl.HostnameVerifier,HttpClientHostnameVerifier
@Contract(threading=STATELESS) public final class DefaultHostnameVerifier extends java.lang.Object implements HttpClientHostnameVerifier
DefaultHostnameVerifierimplementation.- Since:
- 4.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDefaultHostnameVerifier.HostNameType
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGprivate PublicSuffixMatcherpublicSuffixMatcher
-
Constructor Summary
Constructors Constructor Description DefaultHostnameVerifier()DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static DefaultHostnameVerifier.HostNameTypedetermineHostFormat(java.lang.String host)(package private) static java.lang.StringextractCN(java.lang.String subjectPrincipal)(package private) static java.util.List<SubjectName>getSubjectAltNames(java.security.cert.X509Certificate cert)(package private) static java.util.List<SubjectName>getSubjectAltNames(java.security.cert.X509Certificate cert, int subjectName)(package private) static voidmatchCN(java.lang.String host, java.security.cert.X509Certificate cert, PublicSuffixMatcher publicSuffixMatcher)(package private) static voidmatchDNSName(java.lang.String host, java.util.List<SubjectName> subjectAlts, PublicSuffixMatcher publicSuffixMatcher)(package private) static booleanmatchDomainRoot(java.lang.String host, java.lang.String domainRoot)(package private) static booleanmatchIdentity(java.lang.String host, java.lang.String identity)(package private) static booleanmatchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher)(package private) static booleanmatchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType)private static booleanmatchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType, boolean strict)(package private) static booleanmatchIdentityStrict(java.lang.String host, java.lang.String identity)(package private) static booleanmatchIdentityStrict(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher)(package private) static booleanmatchIdentityStrict(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType)(package private) static voidmatchIPAddress(java.lang.String host, java.util.List<SubjectName> subjectAlts)(package private) static voidmatchIPv6Address(java.lang.String host, java.util.List<SubjectName> subjectAlts)(package private) static java.lang.StringnormaliseAddress(java.lang.String hostname)voidverify(java.lang.String host, java.security.cert.X509Certificate cert)Verifies the supplied serverX509Certificateand ensures it matches the original host name.booleanverify(java.lang.String host, javax.net.ssl.SSLSession session)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
publicSuffixMatcher
private final PublicSuffixMatcher publicSuffixMatcher
-
-
Constructor Detail
-
DefaultHostnameVerifier
public DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)
-
DefaultHostnameVerifier
public DefaultHostnameVerifier()
-
-
Method Detail
-
verify
public boolean verify(java.lang.String host, javax.net.ssl.SSLSession session)- Specified by:
verifyin interfacejavax.net.ssl.HostnameVerifier
-
verify
public void verify(java.lang.String host, java.security.cert.X509Certificate cert) throws javax.net.ssl.SSLExceptionDescription copied from interface:HttpClientHostnameVerifierVerifies the supplied serverX509Certificateand ensures it matches the original host name.- Specified by:
verifyin interfaceHttpClientHostnameVerifier- Parameters:
host- the original host name.cert- the server certificate;- Throws:
javax.net.ssl.SSLException
-
matchIPAddress
static void matchIPAddress(java.lang.String host, java.util.List<SubjectName> subjectAlts) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
matchIPv6Address
static void matchIPv6Address(java.lang.String host, java.util.List<SubjectName> subjectAlts) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
matchDNSName
static void matchDNSName(java.lang.String host, java.util.List<SubjectName> subjectAlts, PublicSuffixMatcher publicSuffixMatcher) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
matchCN
static void matchCN(java.lang.String host, java.security.cert.X509Certificate cert, PublicSuffixMatcher publicSuffixMatcher) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
matchDomainRoot
static boolean matchDomainRoot(java.lang.String host, java.lang.String domainRoot)
-
matchIdentity
private static boolean matchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType, boolean strict)
-
matchIdentity
static boolean matchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher)
-
matchIdentity
static boolean matchIdentity(java.lang.String host, java.lang.String identity)
-
matchIdentityStrict
static boolean matchIdentityStrict(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher)
-
matchIdentityStrict
static boolean matchIdentityStrict(java.lang.String host, java.lang.String identity)
-
matchIdentity
static boolean matchIdentity(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType)
-
matchIdentityStrict
static boolean matchIdentityStrict(java.lang.String host, java.lang.String identity, PublicSuffixMatcher publicSuffixMatcher, DomainType domainType)
-
extractCN
static java.lang.String extractCN(java.lang.String subjectPrincipal) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
determineHostFormat
static DefaultHostnameVerifier.HostNameType determineHostFormat(java.lang.String host)
-
getSubjectAltNames
static java.util.List<SubjectName> getSubjectAltNames(java.security.cert.X509Certificate cert)
-
getSubjectAltNames
static java.util.List<SubjectName> getSubjectAltNames(java.security.cert.X509Certificate cert, int subjectName)
-
normaliseAddress
static java.lang.String normaliseAddress(java.lang.String hostname)
-
-