• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
BrowserCompatHostnameVerifier Class Reference

The HostnameVerifier that works the same way as Curl and Firefox. More...

Inheritance diagram for BrowserCompatHostnameVerifier:
AbstractVerifier X509HostnameVerifier

Description

The hostname must match either the first CN, or any of the subject-alts. A wildcard can occur in the CN, and in any of the subject-alts.

The only difference between BROWSER_COMPATIBLE and STRICT is that a wildcard (such as "*.foo.com") with BROWSER_COMPATIBLE matches all subdomains, including "a.b.foo.com".

Author
Julius Davies

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

final void verify (final String host, final String[] cns, final String[] subjectAlts) throws SSLException
 Checks to see if the supplied hostname matches any of the supplied CNs or "DNS" Subject-Alts. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractVerifier
static String[] getDNSSubjectAlts (X509Certificate cert)
 Extracts the array of SubjectAlt DNS names from an X509Certificate. More...
 
static int countDots (final String s)
 Counts the number of dots "." in a string. More...
 

Member Function Documentation

◆ verify()

final void verify ( final String  host,
final String[]  cns,
final String[]  subjectAlts 
) throws SSLException

Most implementations only look at the first CN, and ignore any additional CNs. Most implementations do look at all of the "DNS" Subject-Alts. The CNs or Subject-Alts may contain wildcards according to RFC 2818.

Parameters
cnsCN fields, in order, as extracted from the X.509 certificate.
subjectAltsSubject-Alt fields of type 2 ("DNS"), as extracted from the X.509 certificate.
hostThe hostname to verify.
Exceptions
SSLExceptionIf verification failed.

Implements X509HostnameVerifier.