Class HostnameVerifierImpl
java.lang.Object
org.mariadb.jdbc.internal.protocol.tls.HostnameVerifierImpl
- All Implemented Interfaces:
HostnameVerifier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate classprivate class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringextractCommonName(String principal) private static booleanDNS verification : Matching is performed using the matching rules specified by [RFC2459].private static booleanmatchWildCards(boolean hostIsIp, String hostnameToken, String tlsDnsToken) private static StringnormaliseAddress(String hostname) private static StringnormalizedHostMsg(String normalizedHost) voidverify(String host, X509Certificate cert, long serverThreadId) Verification that throw an exception with a detailed error message in case of error.booleanverify(String host, SSLSession session) booleanverify(String host, SSLSession session, long serverThreadId) Verification, like HostnameVerifier.verify() with an additional server thread id to identify connection in logs.
-
Field Details
-
logger
-
-
Constructor Details
-
HostnameVerifierImpl
public HostnameVerifierImpl()
-
-
Method Details
-
matchDns
DNS verification : Matching is performed using the matching rules specified by [RFC2459]. If more than one identity of a given type is present in the certificate (e.g., more than one dNSName name, a match in any one of the set is considered acceptable.) Names may contain the wildcard character * which is considered to match any single domain name component or component fragment. E.g., *.a.com matches foo.a.com but not bar.foo.a.com. f*.com matches foo.com but not bar.com.- Parameters:
hostname- hostnametlsDnsPattern- DNS pattern (may contain wildcard)- Returns:
- true if matching
- Throws:
SSLException
-
matchWildCards
private static boolean matchWildCards(boolean hostIsIp, String hostnameToken, String tlsDnsToken) throws SSLException - Throws:
SSLException
-
extractCommonName
- Throws:
SSLException
-
normaliseAddress
-
normalizedHostMsg
-
getSubjectAltNames
private HostnameVerifierImpl.SubjectAltNames getSubjectAltNames(X509Certificate cert) throws CertificateParsingException - Throws:
CertificateParsingException
-
verify
- Specified by:
verifyin interfaceHostnameVerifier
-
verify
Verification, like HostnameVerifier.verify() with an additional server thread id to identify connection in logs.- Parameters:
host- host to connect (DNS/IP)session- SSL sessionserverThreadId- connection id to identify connection in logs- Returns:
- true if valid
-
verify
Verification that throw an exception with a detailed error message in case of error.- Parameters:
host- hostnamecert- certificateserverThreadId- server thread Identifier to identify connection in logs- Throws:
SSLException- exception
-