summary refs log tree commit diff
path: root/crypto/src/asn1/DerBitString.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2016-04-29 21:53:39 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2016-04-29 21:53:39 +0700
commitbf135f987ab9b636bc583e7589c3270394d4b268 (patch)
treee7f79ff086faf297c3de8de6097921d0ed883408 /crypto/src/asn1/DerBitString.cs
parentAdded IsCertification methods. (diff)
downloadBouncyCastle.NET-ed25519-bf135f987ab9b636bc583e7589c3270394d4b268.tar.xz
Support GetInstance from byte[]
Diffstat (limited to 'crypto/src/asn1/DerBitString.cs')
-rw-r--r--crypto/src/asn1/DerBitString.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/src/asn1/DerBitString.cs b/crypto/src/asn1/DerBitString.cs
index a3c2cee01..26adc575b 100644
--- a/crypto/src/asn1/DerBitString.cs
+++ b/crypto/src/asn1/DerBitString.cs
@@ -28,6 +28,17 @@ namespace Org.BouncyCastle.Asn1
 			{
 				return (DerBitString) obj;
 			}
+            if (obj is byte[])
+            {
+                try
+                {
+                    return (DerBitString)FromByteArray((byte[])obj);
+                }
+                catch (Exception e)
+                {
+                    throw new ArgumentException("encoding error in GetInstance: " + e.ToString());
+                }
+            }
 
             throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
 		}