org.bouncycastle.cms

## Class CMSSignedGenerator

- java.lang.Object
- - org.bouncycastle.cms.CMSSignedGenerator

Direct Known Subclasses:
  CMSSignedDataGenerator, CMSSignedDataStreamGenerator

    public class CMSSignedGenerator
    extends java.lang.Object

### Field Summary

Fields
`protected java.util.List` `_certs`
`protected java.util.List` `_crls`
`protected java.util.Map` `_digests`
`protected java.util.List` `_signers`
`static java.lang.String` `DATA` Default type for the signed data.
`static java.lang.String` `DIGEST_GOST3411`
`static java.lang.String` `DIGEST_MD5`
`static java.lang.String` `DIGEST_RIPEMD128`
`static java.lang.String` `DIGEST_RIPEMD160`
`static java.lang.String` `DIGEST_RIPEMD256`
`static java.lang.String` `DIGEST_SHA1`
`static java.lang.String` `DIGEST_SHA224`
`static java.lang.String` `DIGEST_SHA256`
`static java.lang.String` `DIGEST_SHA384`
`static java.lang.String` `DIGEST_SHA512`
`static java.lang.String` `ENCRYPTION_DSA`
`static java.lang.String` `ENCRYPTION_ECDSA`
`static java.lang.String` `ENCRYPTION_ECGOST3410`
`static java.lang.String` `ENCRYPTION_GOST3410`
`static java.lang.String` `ENCRYPTION_RSA`
`static java.lang.String` `ENCRYPTION_RSA_PSS`
`protected java.security.SecureRandom` `rand`

### Constructor Summary

Constructors
`protected` `CMSSignedGenerator()` base constructor
`protected` `CMSSignedGenerator(java.security.SecureRandom rand)` constructor allowing specific source of randomness

### Method Summary

Methods
`void` `addAttributeCertificates(org.bouncycastle.x509.X509Store store)` Add the attribute certificates contained in the passed in store to the generator.
`void` `addCertificatesAndCRLs(java.security.cert.CertStore certStore)` add the certificates and CRLs contained in the given CertStore to the pool that will be included in the encoded signature block.
`void` `addSigners(SignerInformationStore signerStore)` Add a store of precalculated signers to the generator.
`protected org.bouncycastle.asn1.ASN1Set` `getAttributeSet(org.bouncycastle.asn1.cms.AttributeTable attr)`
`protected java.util.Map` `getBaseParameters(org.bouncycastle.asn1.DERObjectIdentifier contentType, org.bouncycastle.asn1.x509.AlgorithmIdentifier digAlgId, byte[] hash)`
`protected org.bouncycastle.asn1.x509.AlgorithmIdentifier` `getEncAlgorithmIdentifier(java.lang.String encOid, java.security.Signature sig)`
`protected java.lang.String` `getEncOID(java.security.PrivateKey key, java.lang.String digestOID)`
`java.util.Map` `getGeneratedDigests()` Return a map of oids and byte arrays representing the digests calculated on the content during the last generate.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DATA

    public static final java.lang.String DATA

Default type for the signed data.

#### DIGEST_SHA1

    public static final java.lang.String DIGEST_SHA1

#### DIGEST_SHA224

    public static final java.lang.String DIGEST_SHA224

#### DIGEST_SHA256

    public static final java.lang.String DIGEST_SHA256

#### DIGEST_SHA384

    public static final java.lang.String DIGEST_SHA384

#### DIGEST_SHA512

    public static final java.lang.String DIGEST_SHA512

#### DIGEST_MD5

    public static final java.lang.String DIGEST_MD5

#### DIGEST_GOST3411

    public static final java.lang.String DIGEST_GOST3411

#### DIGEST_RIPEMD128

    public static final java.lang.String DIGEST_RIPEMD128

#### DIGEST_RIPEMD160

    public static final java.lang.String DIGEST_RIPEMD160

#### DIGEST_RIPEMD256

    public static final java.lang.String DIGEST_RIPEMD256

#### ENCRYPTION_RSA

    public static final java.lang.String ENCRYPTION_RSA

#### ENCRYPTION_DSA

    public static final java.lang.String ENCRYPTION_DSA

#### ENCRYPTION_ECDSA

    public static final java.lang.String ENCRYPTION_ECDSA

#### ENCRYPTION_RSA_PSS

    public static final java.lang.String ENCRYPTION_RSA_PSS

#### ENCRYPTION_GOST3410

    public static final java.lang.String ENCRYPTION_GOST3410

#### ENCRYPTION_ECGOST3410

    public static final java.lang.String ENCRYPTION_ECGOST3410

#### _certs

    protected java.util.List _certs

#### _crls

    protected java.util.List _crls

#### _signers

    protected java.util.List _signers

#### _digests

    protected java.util.Map _digests

#### rand

    protected final java.security.SecureRandom rand

### Constructor Detail

#### CMSSignedGenerator

    protected CMSSignedGenerator()

base constructor

#### CMSSignedGenerator

    protected CMSSignedGenerator(java.security.SecureRandom rand)

constructor allowing specific source of randomness

Parameters:
  `rand` - instance of SecureRandom to use

### Method Detail

#### getEncOID

    protected java.lang.String getEncOID(java.security.PrivateKey key,
                             java.lang.String digestOID)

#### getEncAlgorithmIdentifier

    protected org.bouncycastle.asn1.x509.AlgorithmIdentifier getEncAlgorithmIdentifier(java.lang.String encOid,
                                                                           java.security.Signature sig)
                                                                                throws java.io.IOException

Throws:
  `java.io.IOException`

#### getBaseParameters

    protected java.util.Map getBaseParameters(org.bouncycastle.asn1.DERObjectIdentifier contentType,
                                  org.bouncycastle.asn1.x509.AlgorithmIdentifier digAlgId,
                                  byte[] hash)

#### getAttributeSet

    protected org.bouncycastle.asn1.ASN1Set getAttributeSet(org.bouncycastle.asn1.cms.AttributeTable attr)

#### addCertificatesAndCRLs

    public void addCertificatesAndCRLs(java.security.cert.CertStore certStore)
                                throws java.security.cert.CertStoreException,
                                       CMSException

add the certificates and CRLs contained in the given CertStore to the pool that will be included in the encoded signature block.

Note: this assumes the CertStore will support null in the get methods.

Parameters:
  `certStore` - CertStore containing the public key certificates and CRLs
Throws:
  `java.security.cert.CertStoreException` - if an issue occurs processing the CertStore
  `CMSException` - if an issue occurse transforming data from the CertStore into the message

#### addAttributeCertificates

    public void addAttributeCertificates(org.bouncycastle.x509.X509Store store)
                                  throws CMSException

Add the attribute certificates contained in the passed in store to the generator.

Parameters:
  `store` - a store of Version 2 attribute certificates
Throws:
  `CMSException` - if an error occurse processing the store.

#### addSigners

    public void addSigners(SignerInformationStore signerStore)

Add a store of precalculated signers to the generator.

Parameters:
  `signerStore` - store of signers

#### getGeneratedDigests

    public java.util.Map getGeneratedDigests()

Return a map of oids and byte arrays representing the digests calculated on the content during the last generate.

Returns:
  a map of oids (as String objects) and byte[] representing digests.