org.apache.commons.ssl
Class HostnameVerifier.AbstractVerifier

java.lang.Object
  extended by org.apache.commons.ssl.HostnameVerifier.AbstractVerifier
All Implemented Interfaces:
HostnameVerifier
Enclosing interface:
HostnameVerifier

public abstract static class HostnameVerifier.AbstractVerifier
extends Object
implements HostnameVerifier


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.commons.ssl.HostnameVerifier
HostnameVerifier.AbstractVerifier
 
Field Summary
private static String[] BAD_COUNTRY_2LDS
          This contains a list of 2nd-level domains that aren't allowed to have wildcards when combined with country-codes.
private static String[] LOCALHOSTS
           
 
Fields inherited from interface org.apache.commons.ssl.HostnameVerifier
ALLOW_ALL, DEFAULT, DEFAULT_AND_LOCALHOST, STRICT, STRICT_IE6
 
Constructor Summary
protected HostnameVerifier.AbstractVerifier()
           
 
Method Summary
static boolean acceptableCountryWildcard(String cn)
           
 void check(String[] host, SSLSocket ssl)
           
 void check(String[] hosts, String[] cns, String[] subjectAlts, boolean ie6, boolean strictWithSubDomains)
           
 void check(String[] host, X509Certificate cert)
           
 void check(String host, SSLSocket ssl)
           
 void check(String host, String[] cns, String[] subjectAlts)
           
 void check(String host, X509Certificate cert)
           
static int countDots(String s)
          Counts the number of dots "." in a string.
static boolean isIP4Address(String cn)
           
static boolean isLocalhost(String host)
           
 boolean verify(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, wait
 
Methods inherited from interface org.apache.commons.ssl.HostnameVerifier
check
 

Field Detail

BAD_COUNTRY_2LDS

private static final String[] BAD_COUNTRY_2LDS
This contains a list of 2nd-level domains that aren't allowed to have wildcards when combined with country-codes. For example: [*.co.uk].

The [*.co.uk] problem is an interesting one. Should we just hope that CA's would never foolishly allow such a certificate to happen? Looks like we're the only implementation guarding against this. Firefox, Curl, Sun Java 1.4, 5, 6 don't bother with this check.


LOCALHOSTS

private static final String[] LOCALHOSTS
Constructor Detail

HostnameVerifier.AbstractVerifier

protected HostnameVerifier.AbstractVerifier()
Method Detail

verify

public boolean verify(String host,
                      SSLSession session)
The javax.net.ssl.HostnameVerifier contract.

Specified by:
verify in interface HostnameVerifier
Parameters:
host - 'hostname' we used to create our socket
session - SSLSession with the remote server
Returns:
true if the host matched the one in the certificate.

check

public void check(String host,
                  SSLSocket ssl)
           throws IOException
Throws:
IOException

check

public void check(String host,
                  X509Certificate cert)
           throws SSLException
Throws:
SSLException

check

public void check(String host,
                  String[] cns,
                  String[] subjectAlts)
           throws SSLException
Throws:
SSLException

check

public void check(String[] host,
                  SSLSocket ssl)
           throws IOException
Throws:
IOException

check

public void check(String[] host,
                  X509Certificate cert)
           throws SSLException
Throws:
SSLException

check

public void check(String[] hosts,
                  String[] cns,
                  String[] subjectAlts,
                  boolean ie6,
                  boolean strictWithSubDomains)
           throws SSLException
Throws:
SSLException

isIP4Address

public static boolean isIP4Address(String cn)

acceptableCountryWildcard

public static boolean acceptableCountryWildcard(String cn)

isLocalhost

public static boolean isLocalhost(String host)

countDots

public static int countDots(String s)
Counts the number of dots "." in a string.

Parameters:
s - string to count dots from
Returns:
number of dots