Top Description Fields Constructors Methods
org.apache.http.conn.ssl

public abstract Class AbstractVerifier

extends Object
implements X509HostnameVerifier
Class Inheritance
All Implemented Interfaces
org.apache.http.conn.ssl.X509HostnameVerifier, javax.net.ssl.HostnameVerifier
Known Direct Subclasses
org.apache.http.conn.ssl.AllowAllHostnameVerifier, org.apache.http.conn.ssl.BrowserCompatHostnameVerifier, org.apache.http.conn.ssl.StrictHostnameVerifier
Annotations
@Deprecated
Imports
java.io.IOException, .InputStream, java.security.cert.Certificate, .X509Certificate, java.util.ArrayList, .Arrays, .List, .Locale, javax.net.ssl.SSLException, .SSLSession, .SSLSocket, javax.security.auth.x500.X500Principal, org.apache.commons.logging.Log, .LogFactory, org.apache.http.conn.util.InetAddressUtils, org.apache.http.util.Args

Deprecated

(4.4) use an implementation of javax.net.ssl.HostnameVerifier or DefaultHostnameVerifier.

Abstract base class for all standard X509HostnameVerifier implementations.
Since
4.0

Field Summary

Modifier and TypeField and Description
pack-priv static final String[]
private final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean
public static int

Returns:

number of dots
countDots
(final String
string to count dots from
s
)

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

public static String[]
getCNs(final X509Certificate cert)

public static String[]

Returns:

Array of SubjectALT DNS names stored in the certificate.
getDNSSubjectAlts
(final X509Certificate
X509Certificate
cert
)

Extracts the array of SubjectAlt DNS names from an X509Certificate.

private static boolean
matchIdentity(final String host, final String identity, final boolean strict)

private static boolean
public final void
verify(final String
the host.
host
,
final SSLSocket
the SSL socket.
ssl
)

Implements org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Verifies that the host name is an acceptable match with the server's authentication scheme based on the given SSLSocket.
public final boolean
verify(final String
the host name
host
,
final SSLSession
SSLSession used on the connection to host
session
)

Implements javax.net.ssl.HostnameVerifier.verify.

Verify that the host name is an acceptable match with the server's authentication scheme.
public final void
verify(final String
the host.
host
,
final X509Certificate
the certificate.
cert
)

Implements org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Verifies that the host name is an acceptable match with the server's authentication scheme based on the given X509Certificate.
public final void
verify(final String host, final String[] cns, final String[] subjectAlts, final boolean strictWithSubDomains)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BAD_COUNTRY_2LDSback to summary
pack-priv static final String[] BAD_COUNTRY_2LDS
logback to summary
private final Log log

Constructor Detail

AbstractVerifierback to summary
public AbstractVerifier()

Method Detail

acceptableCountryWildcardback to summary
public static boolean acceptableCountryWildcard(final String cn)
countDotsback to summary
public static int countDots(final String s)

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

Parameters
s:String

string to count dots from

Returns:int

number of dots

getCNsback to summary
public static String[] getCNs(final X509Certificate cert)
getDNSSubjectAltsback to summary
public static String[] getDNSSubjectAlts(final 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

X509Certificate

Returns:String[]

Array of SubjectALT DNS names stored in the certificate.

matchIdentityback to summary
private static boolean matchIdentity(final String host, final String identity, final boolean strict)
validCountryWildcardback to summary
private static boolean validCountryWildcard(final String[] parts)
verifyback to summary
public final void verify(final String host, final SSLSocket ssl) throws IOException

Implements org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Doc from org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Verifies that the host name is an acceptable match with the server's authentication scheme based on the given SSLSocket.

Parameters
host:String

the host.

ssl:SSLSocket

the SSL socket.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs or the verification process fails.
verifyback to summary
public final boolean verify(final String host, final SSLSession session)

Implements javax.net.ssl.HostnameVerifier.verify.

Doc from javax.net.ssl.HostnameVerifier.verify.

Verify that the host name is an acceptable match with the server's authentication scheme.

Parameters
host:String

the host name

session:SSLSession

SSLSession used on the connection to host

Returns:boolean

true if the host name is acceptable

Annotations
@Override
verifyback to summary
public final void verify(final String host, final X509Certificate cert) throws SSLException

Implements org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Doc from org.apache.http.conn.ssl.X509HostnameVerifier.verify.

Verifies that the host name is an acceptable match with the server's authentication scheme based on the given X509Certificate.

Parameters
host:String

the host.

cert:X509Certificate

the certificate.

Annotations
@Override
Exceptions
SSLException:
if the verification process fails.
verifyback to summary
public final void verify(final String host, final String[] cns, final String[] subjectAlts, final boolean strictWithSubDomains) throws SSLException