org.apache.http.conn.ssl
Class AbstractVerifier

java.lang.Object
  extended by org.apache.http.conn.ssl.AbstractVerifier
All Implemented Interfaces:
javax.net.ssl.HostnameVerifier
Direct Known Subclasses:
AllowAllHostnameVerifier, BrowserCompatHostnameVerifier, StrictHostnameVerifier

public abstract class AbstractVerifier
extends java.lang.Object
implements HostnameVerifier

Abstract base class for all standard HostnameVerifier implementations.

Author:
Julius Davies

Method Summary
static boolean acceptableCountryWildcard(java.lang.String cn)
           
static int countDots(java.lang.String s)
          Counts the number of dots "." in a string.
static java.lang.String[] getCNs(java.security.cert.X509Certificate cert)
           
static java.lang.String[] getDNSSubjectAlts(java.security.cert.X509Certificate cert)
          Extracts the array of SubjectAlt DNS names from an X509Certificate.
 boolean verify(java.lang.String host, javax.net.ssl.SSLSession session)
           
 void verify(java.lang.String host, javax.net.ssl.SSLSocket ssl)
           
 void verify(java.lang.String host, java.lang.String[] cns, java.lang.String[] subjectAlts, boolean strictWithSubDomains)
           
 void verify(java.lang.String host, java.security.cert.X509Certificate cert)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.conn.ssl.HostnameVerifier
verify
 

Method Detail

verify

public final void verify(java.lang.String host,
                         javax.net.ssl.SSLSocket ssl)
                  throws java.io.IOException
Throws:
java.io.IOException

verify

public final boolean verify(java.lang.String host,
                            javax.net.ssl.SSLSession session)
Specified by:
verify in interface javax.net.ssl.HostnameVerifier

verify

public final void verify(java.lang.String host,
                         java.security.cert.X509Certificate cert)
                  throws javax.net.ssl.SSLException
Throws:
javax.net.ssl.SSLException

verify

public final void verify(java.lang.String host,
                         java.lang.String[] cns,
                         java.lang.String[] subjectAlts,
                         boolean strictWithSubDomains)
                  throws javax.net.ssl.SSLException
Throws:
javax.net.ssl.SSLException

acceptableCountryWildcard

public static boolean acceptableCountryWildcard(java.lang.String cn)

getCNs

public static java.lang.String[] getCNs(java.security.cert.X509Certificate cert)

getDNSSubjectAlts

public static java.lang.String[] getDNSSubjectAlts(java.security.cert.X509Certificate cert)
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.

countDots

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

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


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.