generate an object that contains an CMS Compressed Data
AlgorithmIdentifier comAlgId;
ASN1OctetString comOcts;
try
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DeflaterOutputStream zOut = new DeflaterOutputStream(bOut);
content.write(zOut);
zOut.close();
comAlgId = makeAlgId(compressionOID, null);
comOcts = new BERConstructedOctetString(bOut.toByteArray());
}
catch (IOException e)
{
throw new CMSException("exception encoding data.", e);
}
ContentInfo comContent = new ContentInfo(
CMSObjectIdentifiers.data, comOcts);
ContentInfo contentInfo = new ContentInfo(
CMSObjectIdentifiers.compressedData,
new CompressedData(comAlgId, comContent));
return new CMSCompressedData(contentInfo);