Example usage for org.bouncycastle.cms CMSSignedData toASN1Structure

List of usage examples for org.bouncycastle.cms CMSSignedData toASN1Structure

Introduction

In this page you can find the example usage for org.bouncycastle.cms CMSSignedData toASN1Structure.

Prototype

public ContentInfo toASN1Structure() 

Source Link

Document

return the ContentInfo

Usage

From source file:org.xipki.pki.scep.serveremulator.ScepResponder.java

License:Open Source License

private ContentInfo createSignedData(final Certificate cert) throws CaException {
    CMSSignedDataGenerator cmsSignedDataGen = new CMSSignedDataGenerator();

    CMSSignedData cmsSigneddata;
    try {/*w  w w. j  av a2s .co m*/
        cmsSignedDataGen.addCertificate(new X509CertificateHolder(cert));
        if (control.isSendCaCert()) {
            cmsSignedDataGen.addCertificate(new X509CertificateHolder(caEmulator.getCaCert()));
        }

        cmsSigneddata = cmsSignedDataGen.generate(new CMSAbsentContent());
    } catch (CMSException ex) {
        throw new CaException(ex);
    }

    return cmsSigneddata.toASN1Structure();
}