summary refs log tree commit diff
path: root/crypto/src/asn1/cms/OtherKeyAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/OtherKeyAttribute.cs')
-rw-r--r--crypto/src/asn1/cms/OtherKeyAttribute.cs34
1 files changed, 13 insertions, 21 deletions
diff --git a/crypto/src/asn1/cms/OtherKeyAttribute.cs b/crypto/src/asn1/cms/OtherKeyAttribute.cs
index 285c88154..7c85de86e 100644
--- a/crypto/src/asn1/cms/OtherKeyAttribute.cs
+++ b/crypto/src/asn1/cms/OtherKeyAttribute.cs
@@ -1,33 +1,25 @@
-using System;
-
-using Org.BouncyCastle.Utilities;
-
 namespace Org.BouncyCastle.Asn1.Cms
 {
     public class OtherKeyAttribute
         : Asn1Encodable
     {
-        private DerObjectIdentifier	keyAttrId;
-        private Asn1Encodable		keyAttr;
-
-		/**
-         * return an OtherKeyAttribute object from the given object.
-         *
-         * @param o the object we want converted.
-         * @exception ArgumentException if the object cannot be converted.
-         */
-        public static OtherKeyAttribute GetInstance(
-            object obj)
+        public static OtherKeyAttribute GetInstance(object obj)
         {
-            if (obj == null || obj is OtherKeyAttribute)
-                return (OtherKeyAttribute) obj;
-
-			if (obj is Asn1Sequence)
-                return new OtherKeyAttribute((Asn1Sequence) obj);
+            if (obj == null)
+                return null;
+            if (obj is OtherKeyAttribute otherKeyAttribute)
+                return otherKeyAttribute;
+            return new OtherKeyAttribute(Asn1Sequence.GetInstance(obj));
+        }
 
-            throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
+        public static OtherKeyAttribute GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return new OtherKeyAttribute(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
+        private DerObjectIdentifier	keyAttrId;
+        private Asn1Encodable		keyAttr;
+
 		public OtherKeyAttribute(
             Asn1Sequence seq)
         {