Class HostnameVerifierImpl
java.lang.Object
org.mariadb.jdbc.internal.protocol.tls.HostnameVerifierImpl
- All Implemented Interfaces:
HostnameVerifier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
private class
private class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
extractCommonName
(String principal) private static boolean
DNS verification : Matching is performed using the matching rules specified by [RFC2459].private static boolean
matchWildCards
(boolean hostIsIp, String hostnameToken, String tlsDnsToken) private static String
normaliseAddress
(String hostname) private static String
normalizedHostMsg
(String normalizedHost) void
verify
(String host, X509Certificate cert, long serverThreadId) Verification that throw an exception with a detailed error message in case of error.boolean
verify
(String host, SSLSession session) boolean
verify
(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:
verify
in 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
-