public final class DefaultHostnameVerifier extends Object implements HostnameVerifier
HostnameVerifier implementation.| Modifier and Type | Field and Description |
|---|---|
(package private) static int | DNS_NAME_TYPEDNS name type constant |
(package private) static int | IP_ADDRESS_TYPEIP address type constant |
| Constructor and Description |
|---|
DefaultHostnameVerifier()Create hostname verifier with default settings. |
DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)Create hostname verifier with public suffix matcher. |
| Modifier and Type | Method and Description |
|---|---|
(package private) static String | extractCN(String subjectPrincipal)Extract the Common Name from the subject principal. |
(package private) static List<String> | extractSubjectAlts(X509Certificate cert,
int subjectType)Extract subject alternative names from the certificate. |
(package private) static void | matchCN(String host,
String cn,
PublicSuffixMatcher publicSuffixMatcher)Match the common name against the hostname. |
(package private) static void | matchDNSName(String host,
List<String> subjectAlts,
PublicSuffixMatcher publicSuffixMatcher)Match the DNS name against subject alternative names. |
(package private) static boolean | matchDomainRoot(String host,
String domainRoot)Match the host against a domain root. |
(package private) static boolean | matchIdentity(String host,
String identity)Match the host against the identity. |
(package private) static boolean | matchIdentity(String host,
String identity,
PublicSuffixMatcher publicSuffixMatcher)Match the host against the identity with public suffix matching. |
(package private) static boolean | matchIdentityStrict(String host,
String identity)Strictly match the host against the identity. |
(package private) static boolean | matchIdentityStrict(String host,
String identity,
PublicSuffixMatcher publicSuffixMatcher)Strictly match the host against the identity with public suffix matching. |
(package private) static void | matchIPAddress(String host,
List<String> subjectAlts)Match the IP address against subject alternative names. |
(package private) static void | matchIPv6Address(String host,
List<String> subjectAlts)Match the IPv6 address against subject alternative names. |
(package private) static String | normaliseAddress(String hostname)Normalize an IPv6 or DNS name. |
boolean | verify(String host,
SSLSession session) |
void | verify(String host,
X509Certificate cert)Verify the hostname against the certificate. |
static final int DNS_NAME_TYPE
static final int IP_ADDRESS_TYPE
public DefaultHostnameVerifier()
public DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)
publicSuffixMatcher - public suffix matcherstatic String extractCN(String subjectPrincipal) throws SSLException
subjectPrincipal - the X500 principal nameSSLException - if the name is invalidstatic List<String> extractSubjectAlts(X509Certificate cert, int subjectType)
cert - the certificatesubjectType - the subject type (DNS or IP)static void matchCN(String host, String cn, PublicSuffixMatcher publicSuffixMatcher) throws SSLException
SSLExceptionstatic void matchDNSName(String host, List<String> subjectAlts, PublicSuffixMatcher publicSuffixMatcher) throws SSLException
SSLExceptionstatic boolean matchDomainRoot(String host, String domainRoot)
static boolean matchIdentity(String host, String identity)
static boolean matchIdentity(String host, String identity, PublicSuffixMatcher publicSuffixMatcher)
static boolean matchIdentityStrict(String host, String identity)
static boolean matchIdentityStrict(String host, String identity, PublicSuffixMatcher publicSuffixMatcher)
static void matchIPAddress(String host, List<String> subjectAlts) throws SSLException
SSLExceptionstatic void matchIPv6Address(String host, List<String> subjectAlts) throws SSLException
SSLExceptionstatic String normaliseAddress(String hostname)
hostname - the hostname to normalizepublic final boolean verify(String host, SSLSession session)
verify in interface HostnameVerifierpublic final void verify(String host, X509Certificate cert) throws SSLException
host - the hostnamecert - the certificateSSLException - if verification fails