<PackageReference Include="BouncyCastle.Cryptography" Version="2.7.0" />

Org.BouncyCastle.Cms.CmsSignedDataStreamGenerator

Streaming generator for CMS SignedData (PKCS#7 signed-data) messages. Configure signers with AddSigner (and overloads), add certificates and CRLs via the base CmsSignedGenerator methods, then call Open to obtain a Stream to which the content being signed is written. Closing that stream finalizes the CMS structure.

Creates a generator using the default randomness source.

Creates a generator with an explicit randomness source for signature generation.

public void AddDigests(string[] digestOids)

Registers one or more digest algorithm OIDs to be computed over the signed content.

public void AddDigests(IEnumerable<string> digestOids)

Registers one or more digest algorithm OIDs to be computed over the signed content.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string digestOid)

Adds a signer identified by certificate, inferring the signature algorithm OID from the key type. Only default signed attributes are included.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string encryptionOid, string digestOid)

Adds a signer identified by certificate with explicit digest and signature algorithm OIDs. Only default signed attributes are included.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string digestOid, AttributeTable signedAttr, AttributeTable unsignedAttr)

Adds a certificate-identified signer with caller-supplied signed and unsigned attribute tables.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string encryptionOid, string digestOid, AttributeTable signedAttr, AttributeTable unsignedAttr)

Adds a certificate-identified signer with explicit algorithm OIDs and attribute tables.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string digestOid, CmsAttributeTableGenerator signedAttrGenerator, CmsAttributeTableGenerator unsignedAttrGenerator)

Adds a certificate-identified signer with caller-supplied attribute table generators, inferring the signature algorithm OID from the key type.

public void AddSigner(AsymmetricKeyParameter privateKey, X509Certificate cert, string encryptionOid, string digestOid, CmsAttributeTableGenerator signedAttrGenerator, CmsAttributeTableGenerator unsignedAttrGenerator)

Adds a certificate-identified signer with explicit algorithm OIDs and attribute table generators.

public void AddSigner(AsymmetricKeyParameter privateKey, byte[] subjectKeyID, string digestOid)

Adds a signer identified by subject key identifier, inferring the signature algorithm OID from the key. Only default signed attributes are included.

public void AddSigner(AsymmetricKeyParameter privateKey, byte[] subjectKeyID, string encryptionOid, string digestOid)

Adds a signer identified by subject key identifier with explicit digest and signature algorithm OIDs. Only default signed attributes are included.

public void AddSigner(AsymmetricKeyParameter privateKey, byte[] subjectKeyID, string digestOid, AttributeTable signedAttr, AttributeTable unsignedAttr)

Adds a subject-key-id-identified signer with caller-supplied signed and unsigned attribute tables.

public void AddSigner(AsymmetricKeyParameter privateKey, byte[] subjectKeyID, string digestOid, CmsAttributeTableGenerator signedAttrGenerator, CmsAttributeTableGenerator unsignedAttrGenerator)

Adds a subject-key-id-identified signer with caller-supplied attribute table generators, inferring the signature algorithm OID from the key type.

public void AddSigner(AsymmetricKeyParameter privateKey, byte[] subjectKeyID, string encryptionOid, string digestOid, CmsAttributeTableGenerator signedAttrGenerator, CmsAttributeTableGenerator unsignedAttrGenerator)

Adds a subject-key-id-identified signer with explicit algorithm OIDs and attribute table generators.

public Stream Open(Stream outStream)

Opens a stream for generating a CMS SignedData object. The content is signed but not encapsulated.

public Stream Open(Stream outStream, bool encapsulate)

Opens a stream for generating a CMS SignedData object using the default content type "data".

public Stream Open(Stream outStream, bool encapsulate, Stream dataOutputStream)

Opens a stream for generating a CMS SignedData object using the default content type "data", optionally copying the content being signed to a second stream as it is processed.

public Stream Open(Stream outStream, string signedContentType, bool encapsulate)

Opens a stream for generating a CMS SignedData object with the given encapsulated content type.

public Stream Open(Stream outStream, string signedContentType, bool encapsulate, Stream dataOutputStream)

Opens a stream for generating a CMS SignedData object with the given encapsulated content type, optionally copying the content being signed to a second stream as it is processed.

public Stream Open(Stream outStream, DerObjectIdentifier contentType, bool encapsulate)

Opens a stream for generating a CMS SignedData object with the given encapsulated content type.

public Stream Open(Stream outStream, DerObjectIdentifier contentType, bool encapsulate, Stream dataOutputStream)

Opens a stream for generating a CMS SignedData object with the given encapsulated content type, optionally copying the content being signed to a second stream as it is processed.

public void SetBufferSize(int bufferSize)

Sets the buffer size used for the OCTET STRING segments holding the encapsulated content.