diff options
Diffstat (limited to 'crypto/src/cms/CMSCompressedDataGenerator.cs')
-rw-r--r-- | crypto/src/cms/CMSCompressedDataGenerator.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/src/cms/CMSCompressedDataGenerator.cs b/crypto/src/cms/CMSCompressedDataGenerator.cs index 872c4a144..70515e8d3 100644 --- a/crypto/src/cms/CMSCompressedDataGenerator.cs +++ b/crypto/src/cms/CMSCompressedDataGenerator.cs @@ -21,10 +21,7 @@ namespace Org.BouncyCastle.Cms */ public class CmsCompressedDataGenerator { - public const string ZLibOid = "1.2.840.113549.1.9.16.3.8"; - - [Obsolete("Use 'ZLibOid' instead")] - public const string ZLib = ZLibOid; + public static readonly string ZLib = CmsObjectIdentifiers.ZlibCompress.Id; public CmsCompressedDataGenerator() { @@ -33,10 +30,12 @@ namespace Org.BouncyCastle.Cms /** * Generate an object that contains an CMS Compressed Data */ - public CmsCompressedData Generate( - CmsProcessable content, - string compressionOid) + public CmsCompressedData Generate(CmsProcessable content, string compressionOid) { + if (ZLib != compressionOid) + throw new ArgumentException("Unsupported compression algorithm: " + compressionOid, + nameof(compressionOid)); + AlgorithmIdentifier comAlgId; Asn1OctetString comOcts; @@ -49,7 +48,7 @@ namespace Org.BouncyCastle.Cms Platform.Dispose(zOut); - comAlgId = new AlgorithmIdentifier(new DerObjectIdentifier(compressionOid)); + comAlgId = new AlgorithmIdentifier(CmsObjectIdentifiers.ZlibCompress); comOcts = new BerOctetString(bOut.ToArray()); } catch (IOException e) |