summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 20:12:54 +1030
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 20:12:54 +1030
commit00153da4b9ca5da090a697b25901e319a1a98b32 (patch)
treec82a2f0f935acf619ba325989dc35f7a8de2d3e1
parentBJA-620 followup for Poly1305 (diff)
downloadBouncyCastle.NET-ed25519-00153da4b9ca5da090a697b25901e319a1a98b32.tar.xz
Added support for empty sequences
-rw-r--r--crypto/src/asn1/x509/UserNotice.cs8
1 files changed, 8 insertions, 0 deletions
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 <code>UserNotice</code>
          * instance or from parsing it from a DER-encoded stream.</p>
          */
+        [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);