summary refs log tree commit diff
path: root/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs')
-rw-r--r--crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs55
1 files changed, 15 insertions, 40 deletions
diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
index be2d76e2c..77f3f3748 100644
--- a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
@@ -1,13 +1,24 @@
-using System;
-
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.Cms
 {
     public class KeyAgreeRecipientInfo
         : Asn1Encodable
     {
+        public static KeyAgreeRecipientInfo GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is KeyAgreeRecipientInfo keyAgreeRecipientInfo)
+                return keyAgreeRecipientInfo;
+            return new KeyAgreeRecipientInfo(Asn1Sequence.GetInstance(obj));
+        }
+
+        public static KeyAgreeRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly)
+        {
+            return new KeyAgreeRecipientInfo(Asn1Sequence.GetInstance(obj, explicitly));
+        }
+
         private DerInteger                  version;
         private OriginatorIdentifierOrKey   originator;
         private Asn1OctetString             ukm;
@@ -45,43 +56,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 			recipientEncryptedKeys = (Asn1Sequence)seq[index++];
         }
 
-		/**
-         * return a KeyAgreeRecipientInfo 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 KeyAgreeRecipientInfo GetInstance(
-            Asn1TaggedObject	obj,
-            bool				explicitly)
-        {
-            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
-        }
-
-		/**
-         * return a KeyAgreeRecipientInfo object from the given object.
-         *
-         * @param obj the object we want converted.
-         * @exception ArgumentException if the object cannot be converted.
-         */
-        public static KeyAgreeRecipientInfo GetInstance(
-            object obj)
-        {
-            if (obj == null || obj is KeyAgreeRecipientInfo)
-                return (KeyAgreeRecipientInfo)obj;
-
-			if (obj is Asn1Sequence)
-                return new KeyAgreeRecipientInfo((Asn1Sequence)obj);
-
-			throw new ArgumentException(
-                "Illegal object in KeyAgreeRecipientInfo: " + Platform.GetTypeName(obj));
-
-        }
-
-		public DerInteger Version
+        public DerInteger Version
 		{
 			get { return version; }
 		}