summary refs log tree commit diff
path: root/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs')
-rw-r--r--crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs b/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs
index 5ca612f27..bf0e1aaeb 100644
--- a/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs
+++ b/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs
@@ -1,7 +1,6 @@
 using System;
 
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.Pkcs
 {
@@ -28,19 +27,14 @@ namespace Org.BouncyCastle.Asn1.Pkcs
             this.data = new DerOctetString(encoding);
         }
 
-		public static EncryptedPrivateKeyInfo GetInstance(
-             object obj)
+        public static EncryptedPrivateKeyInfo GetInstance(object obj)
         {
-			if (obj is EncryptedPrivateKeyInfo)
-			{
-				return (EncryptedPrivateKeyInfo) obj;
-			}
-
-			if (obj is Asn1Sequence seq)
-				return new EncryptedPrivateKeyInfo(seq);
-
-			throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj");
-		}
+            if (obj == null)
+                return null;
+            if (obj is EncryptedPrivateKeyInfo encryptedPrivateKeyInfo)
+                return encryptedPrivateKeyInfo;
+            return new EncryptedPrivateKeyInfo(Asn1Sequence.GetInstance(obj));
+        }
 
 		public AlgorithmIdentifier EncryptionAlgorithm
 		{