Example usage for org.bouncycastle.asn1.pkcs SignedData getSignerInfos

List of usage examples for org.bouncycastle.asn1.pkcs SignedData getSignerInfos

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.pkcs SignedData getSignerInfos.

Prototype

public ASN1Set getSignerInfos() 

Source Link

Usage

From source file:fi.laverca.Pkcs7.java

License:Apache License

/**
 * Read SignerInfo elements from a SignedData
 * @param sd data/*from   w  w  w .  ja v a  2  s. c o m*/
 * @return SignerInfo element list or null
 */
public static List<SignerInfo> readSignerInfos(final SignedData sd) {
    if (sd == null) {
        return null;
    }

    List<SignerInfo> signerInfos = new ArrayList<SignerInfo>();

    ASN1Set siSet = sd.getSignerInfos();
    Enumeration<?> e = siSet.getObjects();
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        try {
            SignerInfo si = SignerInfo.getInstance(o);
            signerInfos.add(si);
        } catch (RuntimeException ex) {
            log.trace("SignerInfo " + o + " not found");
        }
    }

    return signerInfos;
}