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

Org.BouncyCastle.Cms.CmsCompressedDataStreamGenerator

Streaming generator for CMS CompressedData messages. Call Open to obtain a Stream to which the content to be compressed is written; closing that stream finalizes the CMS structure. Only ZLIB compression ( ZLib) is supported.
public static readonly string ZLib

The OID for ZLIB compression, the only algorithm supported by this generator.

Creates a generator instance.

public Stream Open(Stream outStream)

Opens a stream for generating a CMS CompressedData object using ZLIB compression and content type "data".

public Stream Open(Stream outStream, string compressionOid)

Opens a stream for generating a CMS CompressedData object with content type "data".

public Stream Open(Stream outStream, string contentOid, string compressionOid)

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

public void SetBufferSize(int bufferSize)

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