From bf135f987ab9b636bc583e7589c3270394d4b268 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 29 Apr 2016 21:53:39 +0700 Subject: Support GetInstance from byte[] --- crypto/src/asn1/DerBitString.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crypto/src/asn1/DerBitString.cs') 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)); } -- cgit 1.4.1