org.apache.http.conn.ssl
Class AbstractVerifierHC4

java.lang.Object
  extended by org.apache.http.conn.ssl.AbstractVerifierHC4
All Implemented Interfaces:
javax.net.ssl.HostnameVerifier, org.apache.http.conn.ssl.X509HostnameVerifier
Direct Known Subclasses:
AllowAllHostnameVerifierHC4, BrowserCompatHostnameVerifierHC4, StrictHostnameVerifierHC4

@Immutable
public abstract class AbstractVerifierHC4
extends java.lang.Object
implements org.apache.http.conn.ssl.X509HostnameVerifier

Abstract base class for all standard X509HostnameVerifier implementations.

Since:
4.0

Constructor Summary
AbstractVerifierHC4()
           
 
Method Summary
static boolean acceptableCountryWildcard(java.lang.String cn)
          Deprecated. (4.3.1) should not be a part of public APIs.
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.X509HostnameVerifier
verify
 

Constructor Detail

AbstractVerifierHC4

public AbstractVerifierHC4()
Method Detail

verify

public final void verify(java.lang.String host,
                         javax.net.ssl.SSLSocket ssl)
                  throws java.io.IOException
Specified by:
verify in interface org.apache.http.conn.ssl.X509HostnameVerifier
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
Specified by:
verify in interface org.apache.http.conn.ssl.X509HostnameVerifier

verify

public final void verify(java.lang.String host,
                         java.security.cert.X509Certificate cert)
                  throws javax.net.ssl.SSLException
Specified by:
verify in interface org.apache.http.conn.ssl.X509HostnameVerifier
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

@Deprecated
public static boolean acceptableCountryWildcard(java.lang.String cn)
Deprecated. (4.3.1) should not be a part of public APIs.


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