/**
        * Generate an object that contains an CMS Compressed Data
        */

        public CmsCompressedData Generate(CmsProcessable content, string compressionOid)
        {
            AlgorithmIdentifier comAlgId;
            Asn1OctetString comOcts;

            try
            {
                using (var bOut = new MemoryStream())
                {
                    using (var zOut = new ZOutputStream(bOut, JZlib.Z_DEFAULT_COMPRESSION))
                    {
                        content.Write(zOut);
                    }

                    comAlgId = new AlgorithmIdentifier(new DerObjectIdentifier(compressionOid));
                    comOcts = new BerOctetString(bOut.ToArray());
                }
            }
            catch (IOException e)
            {
                throw new CmsException("exception encoding data.", e);
            }

            var comContent = new ContentInfo(CmsObjectIdentifiers.Data, comOcts);
            var contentInfo = new ContentInfo(CmsObjectIdentifiers.CompressedData, new CompressedData(comAlgId, comContent));

            return new CmsCompressedData(contentInfo);
        }
 internal CmsCompressedOutputStream(ZOutputStream outStream, BerSequenceGenerator sGen, BerSequenceGenerator cGen, BerSequenceGenerator eiGen)
 {
     _out = outStream;
     _sGen = sGen;
     _cGen = cGen;
     _eiGen = eiGen;
 }