diff options
Diffstat (limited to 'crypto/src/asn1/cms/EncryptedData.cs')
-rw-r--r-- | crypto/src/asn1/cms/EncryptedData.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/crypto/src/asn1/cms/EncryptedData.cs b/crypto/src/asn1/cms/EncryptedData.cs index b8492d14b..a79f8119b 100644 --- a/crypto/src/asn1/cms/EncryptedData.cs +++ b/crypto/src/asn1/cms/EncryptedData.cs @@ -1,27 +1,27 @@ using System; -using Org.BouncyCastle.Utilities; - namespace Org.BouncyCastle.Asn1.Cms { - public class EncryptedData + public class EncryptedData : Asn1Encodable { - private readonly DerInteger version; - private readonly EncryptedContentInfo encryptedContentInfo; - private readonly Asn1Set unprotectedAttrs; - - public static EncryptedData GetInstance( - object obj) + public static EncryptedData GetInstance(object obj) + { + if (obj == null) + return null; + if (obj is EncryptedData encryptedData) + return encryptedData; + return new EncryptedData(Asn1Sequence.GetInstance(obj)); + } + + public static EncryptedData GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { - if (obj is EncryptedData) - return (EncryptedData) obj; + return new EncryptedData(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); + } - if (obj is Asn1Sequence) - return new EncryptedData((Asn1Sequence) obj); - - throw new ArgumentException("Invalid EncryptedData: " + Platform.GetTypeName(obj)); - } + private readonly DerInteger version; + private readonly EncryptedContentInfo encryptedContentInfo; + private readonly Asn1Set unprotectedAttrs; public EncryptedData( EncryptedContentInfo encInfo) |