public class

CMSSignedDataGenerator

extends CMSSignedGenerator
java.lang.Object
   ↳ org.bouncycastle.cms.CMSSignedGenerator
     ↳ org.bouncycastle.cms.CMSSignedDataGenerator

Class Overview

general class for generating a pkcs7-signature message.

A simple example of usage, generating a detached signature.

      List             certList = new ArrayList();
      CMSTypedData     msg = new CMSProcessableByteArray("Hello world!".getBytes());

      certList.add(signCert);

      Store           certs = new JcaCertStore(certList);

      CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
      ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(signKP.getPrivate());

      gen.addSignerInfoGenerator(
                new JcaSignerInfoGeneratorBuilder(
                     new JcaDigestCalculatorProviderBuilder().setProvider("BC").build())
                     .build(sha1Signer, signCert));

      gen.addCertificates(certs);

      CMSSignedData sigData = gen.generate(msg, false);
 

Summary

[Expand]
Inherited Fields
From class org.bouncycastle.cms.CMSSignedGenerator
Public Constructors
CMSSignedDataGenerator()
base constructor
CMSSignedDataGenerator(SecureRandom rand)
constructor allowing specific source of randomness
Public Methods
void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String digestOID)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID)
This method is deprecated. use addSignerInfoGenerator
void addSigner(PrivateKey key, X509Certificate cert, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
This method is deprecated. use addSignerInfoGenerator
CMSSignedData generate(CMSTypedData content)
CMSSignedData generate(CMSProcessable content, String sigProvider)
generate a signed object that for a CMS Signed Data object using the given provider.
CMSSignedData generate(String eContentType, CMSProcessable content, boolean encapsulate, Provider sigProvider, boolean addDefaultAttributes)
Similar method to the other generate methods.
CMSSignedData generate(String eContentType, CMSProcessable content, boolean encapsulate, Provider sigProvider)
This method is deprecated. use generate(CMSTypedData, boolean)
CMSSignedData generate(CMSProcessable content, boolean encapsulate, String sigProvider)
This method is deprecated. use generate(CMSTypedData, boolean)
CMSSignedData generate(CMSProcessable content, Provider sigProvider)
generate a signed object that for a CMS Signed Data object using the given provider.
CMSSignedData generate(String eContentType, CMSProcessable content, boolean encapsulate, String sigProvider)
This method is deprecated. use generate(CMSTypedData, boolean)
CMSSignedData generate(CMSTypedData content, boolean encapsulate)
CMSSignedData generate(String eContentType, CMSProcessable content, boolean encapsulate, String sigProvider, boolean addDefaultAttributes)
This method is deprecated. use generate(CMSTypedData, boolean)
CMSSignedData generate(CMSProcessable content, boolean encapsulate, Provider sigProvider)
This method is deprecated. use generate(CMSTypedData, boolean)
SignerInformationStore generateCounterSigners(SignerInformation signer, String sigProvider)
This method is deprecated. use generateCounterSigners(SignerInformation)
SignerInformationStore generateCounterSigners(SignerInformation signer)
generate a set of one or more SignerInformation objects representing counter signatures on the passed in SignerInformation object.
SignerInformationStore generateCounterSigners(SignerInformation signer, Provider sigProvider)
This method is deprecated. use generateCounterSigners(SignerInformation)
[Expand]
Inherited Methods
From class org.bouncycastle.cms.CMSSignedGenerator
From class java.lang.Object

Public Constructors

public CMSSignedDataGenerator ()

base constructor

public CMSSignedDataGenerator (SecureRandom rand)

constructor allowing specific source of randomness

Parameters
rand instance of SecureRandom to use

Public Methods

public void addSigner (PrivateKey key, byte[] subjectKeyID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)

This method is deprecated.
use addSignerInfoGenerator

add a signer with extra signed/unsigned attributes based on generators.

public void addSigner (PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)

This method is deprecated.
use addSignerInfoGenerator

add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.

Parameters
key signing key to use
cert certificate containing corresponding public key
encryptionOID digest encryption algorithm OID
digestOID digest algorithm OID
signedAttr table of attributes to be included in signature
unsignedAttr table of attributes to be included as unsigned

public void addSigner (PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)

This method is deprecated.
use addSignerInfoGenerator

add a signer, including digest encryption algorithm, with extra signed/unsigned attributes based on generators.

public void addSigner (PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)

This method is deprecated.
use addSignerInfoGenerator

add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.

Parameters
key signing key to use
subjectKeyID subjectKeyID of corresponding public key
encryptionOID digest encryption algorithm OID
digestOID digest algorithm OID
signedAttr table of attributes to be included in signature
unsignedAttr table of attributes to be included as unsigned

public void addSigner (PrivateKey key, X509Certificate cert, String digestOID)

This method is deprecated.
use addSignerInfoGenerator

add a signer - no attributes other than the default ones will be provided here.

Parameters
key signing key to use
cert certificate containing corresponding public key
digestOID digest algorithm OID

public void addSigner (PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)

This method is deprecated.
use addSignerInfoGenerator

add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes based on generators.

public void addSigner (PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID)

This method is deprecated.
use addSignerInfoGenerator

add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be provided here.

Parameters
key signing key to use
cert certificate containing corresponding public key
encryptionOID digest encryption algorithm OID
digestOID digest algorithm OID

public void addSigner (PrivateKey key, X509Certificate cert, String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)

This method is deprecated.
use addSignerInfoGenerator

add a signer with extra signed/unsigned attributes based on generators.

public void addSigner (PrivateKey key, byte[] subjectKeyID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)

This method is deprecated.
use addSignerInfoGenerator

add a signer with extra signed/unsigned attributes.

Parameters
key signing key to use
subjectKeyID subjectKeyID of corresponding public key
digestOID digest algorithm OID
signedAttr table of attributes to be included in signature
unsignedAttr table of attributes to be included as unsigned

public void addSigner (PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID)

This method is deprecated.
use addSignerInfoGenerator

add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be provided here.

public void addSigner (PrivateKey key, byte[] subjectKeyID, String digestOID)

This method is deprecated.
use addSignerInfoGenerator

add a signer - no attributes other than the default ones will be provided here.

public void addSigner (PrivateKey key, X509Certificate cert, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)

This method is deprecated.
use addSignerInfoGenerator

add a signer with extra signed/unsigned attributes.

Parameters
key signing key to use
cert certificate containing corresponding public key
digestOID digest algorithm OID
signedAttr table of attributes to be included in signature
unsignedAttr table of attributes to be included as unsigned

public CMSSignedData generate (CMSTypedData content)

Throws
CMSException

public CMSSignedData generate (CMSProcessable content, String sigProvider)

generate a signed object that for a CMS Signed Data object using the given provider.

public CMSSignedData generate (String eContentType, CMSProcessable content, boolean encapsulate, Provider sigProvider, boolean addDefaultAttributes)

Similar method to the other generate methods. The additional argument addDefaultAttributes indicates whether or not a default set of signed attributes need to be added automatically. If the argument is set to false, no attributes will get added at all.

public CMSSignedData generate (String eContentType, CMSProcessable content, boolean encapsulate, Provider sigProvider)

This method is deprecated.
use generate(CMSTypedData, boolean)

generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature. The content type is set according to the OID represented by the string signedContentType.

public CMSSignedData generate (CMSProcessable content, boolean encapsulate, String sigProvider)

This method is deprecated.
use generate(CMSTypedData, boolean)

generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature with the default content type "data".

public CMSSignedData generate (CMSProcessable content, Provider sigProvider)

generate a signed object that for a CMS Signed Data object using the given provider.

public CMSSignedData generate (String eContentType, CMSProcessable content, boolean encapsulate, String sigProvider)

This method is deprecated.
use generate(CMSTypedData, boolean)

generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature. The content type is set according to the OID represented by the string signedContentType.

public CMSSignedData generate (CMSTypedData content, boolean encapsulate)

Throws
CMSException

public CMSSignedData generate (String eContentType, CMSProcessable content, boolean encapsulate, String sigProvider, boolean addDefaultAttributes)

This method is deprecated.
use generate(CMSTypedData, boolean)

Similar method to the other generate methods. The additional argument addDefaultAttributes indicates whether or not a default set of signed attributes need to be added automatically. If the argument is set to false, no attributes will get added at all.

public CMSSignedData generate (CMSProcessable content, boolean encapsulate, Provider sigProvider)

This method is deprecated.
use generate(CMSTypedData, boolean)

generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature with the default content type "data".

public SignerInformationStore generateCounterSigners (SignerInformation signer, String sigProvider)

This method is deprecated.
use generateCounterSigners(SignerInformation)

generate a set of one or more SignerInformation objects representing counter signatures on the passed in SignerInformation object.

Parameters
signer the signer to be countersigned
sigProvider the provider to be used for counter signing.
Returns
  • a store containing the signers.

public SignerInformationStore generateCounterSigners (SignerInformation signer)

generate a set of one or more SignerInformation objects representing counter signatures on the passed in SignerInformation object.

Parameters
signer the signer to be countersigned
Returns
  • a store containing the signers.

public SignerInformationStore generateCounterSigners (SignerInformation signer, Provider sigProvider)

This method is deprecated.
use generateCounterSigners(SignerInformation)

generate a set of one or more SignerInformation objects representing counter signatures on the passed in SignerInformation object.

Parameters
signer the signer to be countersigned
sigProvider the provider to be used for counter signing.
Returns
  • a store containing the signers.