Class HostnameChecker.AbstractChecker
java.lang.Object
com.github.shyiko.mysql.binlog.network.HostnameChecker.AbstractChecker
- All Implemented Interfaces:
HostnameChecker,HostnameVerifier
- Enclosing interface:
HostnameChecker
public abstract static class HostnameChecker.AbstractChecker
extends Object
implements HostnameChecker
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.shyiko.mysql.binlog.network.HostnameChecker
HostnameChecker.AbstractChecker -
Field Summary
Fields inherited from interface com.github.shyiko.mysql.binlog.network.HostnameChecker
ALLOW_ALL, DEFAULT, DEFAULT_AND_LOCALHOST, STRICT, STRICT_IE6 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanvoidcheck(String[] hosts, String[] cns, String[] subjectAlts, boolean ie6, boolean strictWithSubDomains) voidcheck(String[] host, X509Certificate cert) voidvoidvoidcheck(String host, X509Certificate cert) voidstatic intCounts the number of dots "." in a string.static String[]getCNs(X509Certificate cert) static String[]Extracts the array of SubjectAlt DNS names from an X509Certificate.static booleanisIP4Address(String cn) static booleanisLocalhost(String host) booleanverify(String host, SSLSession session) The javax.net.ssl.HostnameVerifier contract.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.shyiko.mysql.binlog.network.HostnameChecker
check
-
Constructor Details
-
AbstractChecker
protected AbstractChecker()
-
-
Method Details
-
getCNs
-
getDNSSubjectAlts
Extracts the array of SubjectAlt DNS names from an X509Certificate. Returns null if there aren't any.Note: Java doesn't appear able to extract international characters from the SubjectAlts. It can only extract international characters from the CN field.
(Or maybe the version of OpenSSL I'm using to test isn't storing the international characters correctly in the SubjectAlts?).
- Parameters:
cert- X509Certificate- Returns:
- Array of SubjectALT DNS names stored in the certificate.
-
verify
The javax.net.ssl.HostnameVerifier contract.- Specified by:
verifyin interfaceHostnameChecker- Specified by:
verifyin interfaceHostnameVerifier- Parameters:
host- 'hostname' we used to create our socketsession- SSLSession with the remote server- Returns:
- true if the host matched the one in the certificate.
-
check
- Specified by:
checkin interfaceHostnameChecker- Throws:
IOException
-
check
- Specified by:
checkin interfaceHostnameChecker- Throws:
SSLException
-
check
- Specified by:
checkin interfaceHostnameChecker- Throws:
SSLException
-
check
- Specified by:
checkin interfaceHostnameChecker- Throws:
IOException
-
check
- Specified by:
checkin interfaceHostnameChecker- Throws:
SSLException
-
check
public void check(String[] hosts, String[] cns, String[] subjectAlts, boolean ie6, boolean strictWithSubDomains) throws SSLException - Throws:
SSLException
-
isIP4Address
-
acceptableCountryWildcard
-
isLocalhost
-
countDots
Counts the number of dots "." in a string.- Parameters:
s- string to count dots from- Returns:
- number of dots
-