From e5d77a0741bcc55088054b2ad4a91ab0508ac092 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 20 Jul 2023 19:01:12 +0700 Subject: Refactoring in Asn1.Cms --- crypto/src/asn1/cms/CmsAlgorithmProtection.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'crypto/src/asn1/cms/CmsAlgorithmProtection.cs') diff --git a/crypto/src/asn1/cms/CmsAlgorithmProtection.cs b/crypto/src/asn1/cms/CmsAlgorithmProtection.cs index 9d21e53ff..cb7a23f84 100644 --- a/crypto/src/asn1/cms/CmsAlgorithmProtection.cs +++ b/crypto/src/asn1/cms/CmsAlgorithmProtection.cs @@ -23,6 +23,20 @@ namespace Org.BouncyCastle.Asn1.Cms public class CmsAlgorithmProtection : Asn1Encodable { + public static CmsAlgorithmProtection GetInstance(object obj) + { + if (obj == null) + return null; + if (obj is CmsAlgorithmProtection cmsAlgorithmProtection) + return cmsAlgorithmProtection; + return new CmsAlgorithmProtection(Asn1Sequence.GetInstance(obj)); + } + + public static CmsAlgorithmProtection GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return new CmsAlgorithmProtection(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); + } + public static readonly int Signature = 1; public static readonly int Mac = 2; @@ -78,15 +92,6 @@ namespace Org.BouncyCastle.Asn1.Cms } } - public static CmsAlgorithmProtection GetInstance(object obj) - { - if (obj == null) - return null; - if (obj is CmsAlgorithmProtection cmsAlgorithmProtection) - return cmsAlgorithmProtection; - return new CmsAlgorithmProtection(Asn1Sequence.GetInstance(obj)); - } - public AlgorithmIdentifier DigestAlgorithm => digestAlgorithm; public AlgorithmIdentifier MacAlgorithm => macAlgorithm; -- cgit 1.4.1