summary refs log tree commit diff
path: root/crypto/src/asn1/pkcs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/pkcs')
-rw-r--r--crypto/src/asn1/pkcs/EncryptionScheme.cs32
1 files changed, 14 insertions, 18 deletions
diff --git a/crypto/src/asn1/pkcs/EncryptionScheme.cs b/crypto/src/asn1/pkcs/EncryptionScheme.cs
index 34d26e172..a073f8c17 100644
--- a/crypto/src/asn1/pkcs/EncryptionScheme.cs
+++ b/crypto/src/asn1/pkcs/EncryptionScheme.cs
@@ -1,13 +1,24 @@
-using System;
-
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.Pkcs
 {
     public class EncryptionScheme
         : AlgorithmIdentifier
     {
+        public new static EncryptionScheme GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is EncryptionScheme encryptionScheme)
+                return encryptionScheme;
+            return new EncryptionScheme(Asn1Sequence.GetInstance(obj));
+        }
+
+        public new static EncryptionScheme GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+        }
+
         public EncryptionScheme(
             DerObjectIdentifier	objectID)
             : base(objectID)
@@ -27,21 +38,6 @@ namespace Org.BouncyCastle.Asn1.Pkcs
         {
         }
 
-		public new static EncryptionScheme GetInstance(object obj)
-		{
-			if (obj is EncryptionScheme)
-			{
-				return (EncryptionScheme)obj;
-			}
-
-			if (obj is Asn1Sequence)
-			{
-				return new EncryptionScheme((Asn1Sequence)obj);
-			}
-
-			throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj");
-		}
-
 		public Asn1Object Asn1Object
 		{
 			get { return Parameters.ToAsn1Object(); }