Example usage for org.bouncycastle.asn1.pkcs SignerInfo getInstance

List of usage examples for org.bouncycastle.asn1.pkcs SignerInfo getInstance

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.pkcs SignerInfo getInstance.

Prototype

public static SignerInfo getInstance(Object o) 

Source Link

Usage

From source file:fi.laverca.Pkcs7.java

License:Apache License

/**
 * Read SignerInfo elements from a SignedData
 * @param sd data//  w  w  w  .  j  a  v a 2s .co 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;
}