From 00153da4b9ca5da090a697b25901e319a1a98b32 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 22 Mar 2017 20:12:54 +1030 Subject: Added support for empty sequences --- crypto/src/asn1/x509/UserNotice.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crypto/src/asn1/x509') diff --git a/crypto/src/asn1/x509/UserNotice.cs b/crypto/src/asn1/x509/UserNotice.cs index 5938f7c49..f40916434 100644 --- a/crypto/src/asn1/x509/UserNotice.cs +++ b/crypto/src/asn1/x509/UserNotice.cs @@ -58,6 +58,7 @@ namespace Org.BouncyCastle.Asn1.X509 * calling @{link toASN1Object()} for a UserNotice * instance or from parsing it from a DER-encoded stream.

*/ + [Obsolete("Use GetInstance() instead")] public UserNotice( Asn1Sequence seq) { @@ -71,12 +72,19 @@ namespace Org.BouncyCastle.Asn1.X509 if (seq[0].ToAsn1Object() is Asn1Sequence) { noticeRef = NoticeReference.GetInstance(seq[0]); + explicitText = null; } else { + noticeRef = null; explicitText = DisplayText.GetInstance(seq[0]); } } + else if (seq.Count == 0) + { + noticeRef = null; // neither field set! + explicitText = null; + } else { throw new ArgumentException("Bad sequence size: " + seq.Count); -- cgit 1.4.1