Example usage for org.apache.commons.ssl TrustMaterial getCertificates

List of usage examples for org.apache.commons.ssl TrustMaterial getCertificates

Introduction

In this page you can find the example usage for org.apache.commons.ssl TrustMaterial getCertificates.

Prototype

public synchronized SortedSet getCertificates()
        throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException 

Source Link

Usage

From source file:org.opensaml.xml.security.x509.X509Util.java

/**
 * Decodes X.509 certificates in DER or PEM format.
 * /*from  ww  w .  j av  a2s  .  com*/
 * @param certs encoded certs
 * 
 * @return decoded certs
 * 
 * @throws CertificateException thrown if the certificates can not be decoded
 */
@SuppressWarnings("unchecked")
public static Collection<X509Certificate> decodeCertificate(byte[] certs) throws CertificateException {
    try {
        TrustMaterial tm = new TrustMaterial(certs);
        return tm.getCertificates();
    } catch (Exception e) {
        throw new CertificateException("Unable to decode X.509 certificates", e);
    }
}