summary refs log tree commit diff
path: root/crypto/src/asn1/cms/EncryptedContentInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/EncryptedContentInfo.cs')
-rw-r--r--crypto/src/asn1/cms/EncryptedContentInfo.cs35
1 files changed, 14 insertions, 21 deletions
diff --git a/crypto/src/asn1/cms/EncryptedContentInfo.cs b/crypto/src/asn1/cms/EncryptedContentInfo.cs
index 999f2a01e..2d4a744a3 100644
--- a/crypto/src/asn1/cms/EncryptedContentInfo.cs
+++ b/crypto/src/asn1/cms/EncryptedContentInfo.cs
@@ -1,13 +1,24 @@
-using System;
-
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.Cms
 {
     public class EncryptedContentInfo
         : Asn1Encodable
     {
+        public static EncryptedContentInfo GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is EncryptedContentInfo encryptedContentInfo)
+                return encryptedContentInfo;
+            return new EncryptedContentInfo(Asn1Sequence.GetInstance(obj));
+        }
+
+        public static EncryptedContentInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return new EncryptedContentInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+        }
+
         private DerObjectIdentifier	contentType;
         private AlgorithmIdentifier	contentEncryptionAlgorithm;
         private Asn1OctetString		encryptedContent;
@@ -35,24 +46,6 @@ namespace Org.BouncyCastle.Asn1.Cms
             }
         }
 
-		/**
-         * return an EncryptedContentInfo object from the given object.
-         *
-         * @param obj the object we want converted.
-         * @exception ArgumentException if the object cannot be converted.
-         */
-        public static EncryptedContentInfo GetInstance(
-            object obj)
-        {
-            if (obj == null || obj is EncryptedContentInfo)
-                return (EncryptedContentInfo)obj;
-
-			if (obj is Asn1Sequence)
-                return new EncryptedContentInfo((Asn1Sequence)obj);
-
-            throw new ArgumentException("Invalid EncryptedContentInfo: " + Platform.GetTypeName(obj));
-        }
-
         public DerObjectIdentifier ContentType
         {
             get { return contentType; }