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

Org.BouncyCastle.Cms.CmsAuthenticatedDataStreamGenerator

Streaming generator for CMS AuthenticatedData (MAC-protected) messages. Add recipients via the base CmsAuthenticatedGenerator methods, then call Open to obtain a Stream to which the content to be authenticated is written; closing that stream finalizes the CMS structure and emits the MAC.

Creates a generator using the default randomness source.

Creates a generator with an explicit randomness source for key and MAC generation.

protected Stream Open(Stream outStr, AlgorithmIdentifier macAlgId, ICipherParameters cipherParameters, Asn1EncodableVector recipientInfos)

Opens a stream for generating a CMS AuthenticatedData object using a pre-built MAC algorithm identifier, MAC key parameters and the supplied recipient infos.

public Stream Open(Stream outStr, string encryptionOid)

Opens a stream for generating a CMS AuthenticatedData object, deriving a MAC key of the algorithm's default strength.

public Stream Open(Stream outStr, string encryptionOid, int keySize)

Opens a stream for generating a CMS AuthenticatedData object, deriving a MAC key of the given size.

public void SetBerEncodeRecipients(bool berEncodeRecipientSet)

Controls whether recipient information is stored using a BER (indefinite-length) SET.

public void SetBufferSize(int bufferSize)

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