summary refs log tree commit diff
path: root/crypto/src/asn1/cms/KEKRecipientInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/KEKRecipientInfo.cs')
-rw-r--r--crypto/src/asn1/cms/KEKRecipientInfo.cs53
1 files changed, 15 insertions, 38 deletions
diff --git a/crypto/src/asn1/cms/KEKRecipientInfo.cs b/crypto/src/asn1/cms/KEKRecipientInfo.cs
index 810e7fc97..6ab5f264f 100644
--- a/crypto/src/asn1/cms/KEKRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KEKRecipientInfo.cs
@@ -1,13 +1,24 @@
-using System;
-
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.Cms
 {
     public class KekRecipientInfo
         : Asn1Encodable
     {
+        public static KekRecipientInfo GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is KekRecipientInfo kekRecipientInfo)
+                return kekRecipientInfo;
+            return new KekRecipientInfo(Asn1Sequence.GetInstance(obj));
+        }
+
+        public static KekRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly)
+        {
+            return new KekRecipientInfo(Asn1Sequence.GetInstance(obj, explicitly));
+        }
+
         private DerInteger			version;
         private KekIdentifier       kekID;
         private AlgorithmIdentifier keyEncryptionAlgorithm;
@@ -33,41 +44,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             encryptedKey = (Asn1OctetString) seq[3];
         }
 
-		/**
-         * return a KekRecipientInfo 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 KekRecipientInfo GetInstance(
-            Asn1TaggedObject	obj,
-            bool				explicitly)
-        {
-            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
-        }
-
-        /**
-         * return a KekRecipientInfo object from the given object.
-         *
-         * @param obj the object we want converted.
-         * @exception ArgumentException if the object cannot be converted.
-         */
-        public static KekRecipientInfo GetInstance(
-            object obj)
-        {
-            if (obj == null || obj is KekRecipientInfo)
-                return (KekRecipientInfo)obj;
-
-			if(obj is Asn1Sequence)
-                return new KekRecipientInfo((Asn1Sequence)obj);
-
-            throw new ArgumentException("Invalid KekRecipientInfo: " + Platform.GetTypeName(obj));
-        }
-
-		public DerInteger Version
+        public DerInteger Version
 		{
 			get { return version; }
 		}