Android APIs
public abstract class

AbstractVerifier

extends Object
implements X509HostnameVerifier
java.lang.Object
   ↳ org.apache.http.conn.ssl.AbstractVerifier
Known Direct Subclasses

Class Overview

Abstract base class for all standard X509HostnameVerifier implementations.

Summary

Public Constructors
AbstractVerifier()
Public Methods
static boolean acceptableCountryWildcard(String cn)
static int countDots(String s)
Counts the number of dots "." in a string.
static String[] getCNs(X509Certificate cert)
static String[] getDNSSubjectAlts(X509Certificate cert)
Extracts the array of SubjectAlt DNS names from an X509Certificate.
final void verify(String host, String[] cns, String[] subjectAlts, boolean strictWithSubDomains)
final boolean verify(String host, SSLSession session)
Verifies that the specified hostname is allowed within the specified SSL session.
final void verify(String host, X509Certificate cert)
final void verify(String host, SSLSocket ssl)
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.net.ssl.HostnameVerifier
From interface org.apache.http.conn.ssl.X509HostnameVerifier

Public Constructors

public AbstractVerifier ()

Added in API level 1

Public Methods

public static boolean acceptableCountryWildcard (String cn)

Added in API level 1

public static int countDots (String s)

Added in API level 1

Counts the number of dots "." in a string.

Parameters
s string to count dots from
Returns
  • number of dots

public static String[] getCNs (X509Certificate cert)

Added in API level 1

public static String[] getDNSSubjectAlts (X509Certificate cert)

Added in API level 1

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.

public final void verify (String host, String[] cns, String[] subjectAlts, boolean strictWithSubDomains)

Added in API level 1

Throws
SSLException

public final boolean verify (String host, SSLSession session)

Added in API level 1

Verifies that the specified hostname is allowed within the specified SSL session.

Parameters
host the hostname.
session the SSL session of the connection.
Returns
  • true if the specified hostname is allowed, otherwise false.

public final void verify (String host, X509Certificate cert)

Added in API level 1

Throws
SSLException

public final void verify (String host, SSLSocket ssl)

Added in API level 1

Throws
IOException