Class DefaultHostnameVerifier
java.lang.Object
org.apache.hc.client5.http.ssl.DefaultHostnameVerifier
- All Implemented Interfaces:
HostnameVerifier, HttpClientHostnameVerifier
@Contract(threading=STATELESS)
public final class DefaultHostnameVerifier
extends Object
implements HttpClientHostnameVerifier
Default
HostnameVerifier implementation.- Since:
- 4.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final PublicSuffixMatcher -
Constructor Summary
ConstructorsConstructorDescriptionConstructs new instance without a PublicSuffixMatcher.DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher) Constructs new instance with a PublicSuffixMatcher. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringbyteArrayToIp(byte[] bytes) private static StringbyteArrayToIPv6(byte[] bytes) (package private) static DefaultHostnameVerifier.HostNameTypedetermineHostFormat(String host) (package private) static String(package private) static List<SubjectName> (package private) static List<SubjectName> getSubjectAltNames(X509Certificate cert, int subjectName) (package private) static voidmatchCN(String host, X509Certificate cert, PublicSuffixMatcher publicSuffixMatcher) (package private) static voidmatchDNSName(String host, List<SubjectName> subjectAlts, PublicSuffixMatcher publicSuffixMatcher) (package private) static booleanmatchDomainRoot(String host, String domainRoot) (package private) static booleanmatchIdentity(String host, String identity, PublicSuffixMatcher publicSuffixMatcher, boolean strict) (package private) static voidmatchIPAddress(String host, List<SubjectName> subjectAlts) (package private) static voidmatchIPv6Address(String host, List<SubjectName> subjectAlts) (package private) static StringnormaliseAddress(String hostname) (package private) static List<CharSequence> voidverify(String host, X509Certificate cert) Verifies the supplied serverX509Certificateand ensures it matches the original host name.booleanverify(String host, SSLSession session)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
publicSuffixMatcher
-
-
Constructor Details
-
DefaultHostnameVerifier
Constructs new instance with a PublicSuffixMatcher.- Parameters:
publicSuffixMatcher- a PublicSuffixMatcher.
-
DefaultHostnameVerifier
public DefaultHostnameVerifier()Constructs new instance without a PublicSuffixMatcher.
-
-
Method Details
-
verify
- Specified by:
verifyin interfaceHostnameVerifier
-
verify
Description 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:
SSLException
-
matchIPAddress
static void matchIPAddress(String host, List<SubjectName> subjectAlts) throws SSLPeerUnverifiedException - Throws:
SSLPeerUnverifiedException
-
matchIPv6Address
static void matchIPv6Address(String host, List<SubjectName> subjectAlts) throws SSLPeerUnverifiedException - Throws:
SSLPeerUnverifiedException
-
matchDNSName
static void matchDNSName(String host, List<SubjectName> subjectAlts, PublicSuffixMatcher publicSuffixMatcher) throws SSLPeerUnverifiedException - Throws:
SSLPeerUnverifiedException
-
matchCN
static void matchCN(String host, X509Certificate cert, PublicSuffixMatcher publicSuffixMatcher) throws SSLException - Throws:
SSLException
-
parseFQDN
-
matchDomainRoot
-
matchIdentity
static boolean matchIdentity(String host, String identity, PublicSuffixMatcher publicSuffixMatcher, boolean strict) -
extractCN
- Throws:
SSLException
-
determineHostFormat
-
getSubjectAltNames
-
getSubjectAltNames
-
normaliseAddress
-
byteArrayToIp
-
byteArrayToIPv6
-