summary refs log tree commit diff
path: root/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/KeyTransRecipientInfo.cs')
-rw-r--r--crypto/src/asn1/cms/KeyTransRecipientInfo.cs33
1 files changed, 14 insertions, 19 deletions
diff --git a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
index 5e4fd22b4..c33ab8b73 100644
--- a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
@@ -8,6 +8,20 @@ namespace Org.BouncyCastle.Asn1.Cms
     public class KeyTransRecipientInfo
         : Asn1Encodable
     {
+        public static KeyTransRecipientInfo GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is KeyTransRecipientInfo keyTransRecipientInfo)
+                return keyTransRecipientInfo;
+            return new KeyTransRecipientInfo(Asn1Sequence.GetInstance(obj));
+        }
+
+        public static KeyTransRecipientInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return new KeyTransRecipientInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+        }
+
         private DerInteger          version;
         private RecipientIdentifier rid;
         private AlgorithmIdentifier keyEncryptionAlgorithm;
@@ -41,25 +55,6 @@ namespace Org.BouncyCastle.Asn1.Cms
             this.encryptedKey = (Asn1OctetString) seq[3];
         }
 
-		/**
-         * return a KeyTransRecipientInfo object from the given object.
-         *
-         * @param obj the object we want converted.
-         * @exception ArgumentException if the object cannot be converted.
-         */
-        public static KeyTransRecipientInfo GetInstance(
-            object obj)
-        {
-            if (obj == null || obj is KeyTransRecipientInfo)
-                return (KeyTransRecipientInfo) obj;
-
-			if(obj is Asn1Sequence)
-                return new KeyTransRecipientInfo((Asn1Sequence) obj);
-
-			throw new ArgumentException(
-                "Illegal object in KeyTransRecipientInfo: " + Platform.GetTypeName(obj));
-        }
-
 		public DerInteger Version
 		{
 			get { return version; }