summary refs log tree commit diff
path: root/crypto/src/asn1/cms/RecipientInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/RecipientInfo.cs')
-rw-r--r--crypto/src/asn1/cms/RecipientInfo.cs39
1 files changed, 22 insertions, 17 deletions
diff --git a/crypto/src/asn1/cms/RecipientInfo.cs b/crypto/src/asn1/cms/RecipientInfo.cs
index 3f5ccea5b..ff93258b6 100644
--- a/crypto/src/asn1/cms/RecipientInfo.cs
+++ b/crypto/src/asn1/cms/RecipientInfo.cs
@@ -7,6 +7,28 @@ namespace Org.BouncyCastle.Asn1.Cms
     public class RecipientInfo
         : Asn1Encodable, IAsn1Choice
     {
+        public static RecipientInfo GetInstance(object o)
+        {
+            if (o == null)
+                return null;
+
+            if (o is RecipientInfo recipientInfo)
+                return recipientInfo;
+
+            if (o is Asn1Sequence sequence)
+                return new RecipientInfo(sequence);
+
+            if (o is Asn1TaggedObject taggedObject)
+                return new RecipientInfo(taggedObject);
+
+            throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(o), nameof(o));
+        }
+
+        public static RecipientInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return Asn1Utilities.GetInstanceFromChoice(taggedObject, declaredExplicit, GetInstance);
+        }
+
         internal Asn1Encodable info;
 
 		public RecipientInfo(
@@ -45,23 +67,6 @@ namespace Org.BouncyCastle.Asn1.Cms
             this.info = info;
         }
 
-		public static RecipientInfo GetInstance(object o)
-        {
-			if (o == null)
-				return null;
-
-            if (o is RecipientInfo recipientInfo)
-                return recipientInfo;
-
-			if (o is Asn1Sequence sequence)
-                return new RecipientInfo(sequence);
-
-			if (o is Asn1TaggedObject taggedObject)
-                return new RecipientInfo(taggedObject);
-
-            throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(o));
-        }
-
 		public DerInteger Version
         {
 			get