Example usage for org.apache.commons.ssl Certificates getDNSSubjectAlts

List of usage examples for org.apache.commons.ssl Certificates getDNSSubjectAlts

Introduction

In this page you can find the example usage for org.apache.commons.ssl Certificates getDNSSubjectAlts.

Prototype

public static String[] getDNSSubjectAlts(X509Certificate cert) 

Source Link

Document

Extracts the array of SubjectAlt DNS names from an X509Certificate.

Usage

From source file:org.opensaml.xml.security.x509.tls.StrictHostnameVerifier.java

/** {@inheritDoc} */
public void check(String[] host, X509Certificate cert) throws SSLException {
    String[] cns = X509Util.getCommonNames(cert.getSubjectX500Principal()).toArray(new String[0]);
    String[] subjectAlts = Certificates.getDNSSubjectAlts(cert);
    //Note: could use X509Util for subject alt names also, per below.
    //List<String> subjectAltsList = X509Util.getAltNames(cert, new Integer[]{X509Util.DNS_ALT_NAME});
    //String[] subjectAlts = subjectAltsList.toArray(new String[0]);
    check(host, cns, subjectAlts);//www .  j  a va 2s  .c om
}