Example usage for org.bouncycastle.cms SignerInformation getEncodedSignedAttributes

List of usage examples for org.bouncycastle.cms SignerInformation getEncodedSignedAttributes

Introduction

In this page you can find the example usage for org.bouncycastle.cms SignerInformation getEncodedSignedAttributes.

Prototype

public byte[] getEncodedSignedAttributes() throws IOException 

Source Link

Document

return the DER encoding of the signed attributes.

Usage

From source file:com.aaasec.sigserv.csspsupport.pdfbox.PdfBoxSigUtil.java

License:EUPL

/**
 * This method extracts data from a dummy signature into the PdfBoxModel used
 * in a later stage to update the signature with an externally created signature.
 * @param model A PdfBoxModel for this signature task.
 * @throws IOException /*  w  w w. j a va2s  .c  om*/
 */
public static void parseSignedData(PdfSignModel model) throws IOException {
    CMSSignedData signedData = model.getSignedData();
    SignerInformationStore signerInfos = signedData.getSignerInfos();
    Iterator iterator = signerInfos.getSigners().iterator();
    List<SignerInformation> siList = new ArrayList<SignerInformation>();
    while (iterator.hasNext()) {
        siList.add((SignerInformation) iterator.next());
    }
    if (!siList.isEmpty()) {
        SignerInformation si = siList.get(0);
        model.setCmsSigAttrBytes(si.getEncodedSignedAttributes());
    }
}