diff options
Diffstat (limited to 'crypto/src/asn1/cms/EnvelopedData.cs')
-rw-r--r-- | crypto/src/asn1/cms/EnvelopedData.cs | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/crypto/src/asn1/cms/EnvelopedData.cs b/crypto/src/asn1/cms/EnvelopedData.cs index 85216a2e8..1b88d7791 100644 --- a/crypto/src/asn1/cms/EnvelopedData.cs +++ b/crypto/src/asn1/cms/EnvelopedData.cs @@ -1,10 +1,22 @@ -using System; - namespace Org.BouncyCastle.Asn1.Cms { public class EnvelopedData : Asn1Encodable { + public static EnvelopedData GetInstance(object obj) + { + if (obj == null) + return null; + if (obj is EnvelopedData envelopedData) + return envelopedData; + return new EnvelopedData(Asn1Sequence.GetInstance(obj)); + } + + public static EnvelopedData GetInstance(Asn1TaggedObject obj, bool explicitly) + { + return new EnvelopedData(Asn1Sequence.GetInstance(obj, explicitly)); + } + private DerInteger version; private OriginatorInfo originatorInfo; private Asn1Set recipientInfos; @@ -60,38 +72,6 @@ namespace Org.BouncyCastle.Asn1.Cms } } - /** - * return an EnvelopedData object from a tagged object. - * - * @param obj the tagged object holding the object we want. - * @param explicitly true if the object is meant to be explicitly - * tagged false otherwise. - * @exception ArgumentException if the object held by the - * tagged object cannot be converted. - */ - public static EnvelopedData GetInstance( - Asn1TaggedObject obj, - bool explicitly) - { - return GetInstance(Asn1Sequence.GetInstance(obj, explicitly)); - } - - /** - * return an EnvelopedData object from the given object. - * - * @param obj the object we want converted. - * @exception ArgumentException if the object cannot be converted. - */ - public static EnvelopedData GetInstance( - object obj) - { - if (obj is EnvelopedData) - return (EnvelopedData)obj; - if (obj == null) - return null; - return new EnvelopedData(Asn1Sequence.GetInstance(obj)); - } - public DerInteger Version { get { return version; } |