summary refs log tree commit diff
path: root/crypto/src/asn1/LazyDERSet.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crypto/src/asn1/LazyDERSet.cs110
1 files changed, 56 insertions, 54 deletions
diff --git a/crypto/src/asn1/LazyDERSet.cs b/crypto/src/asn1/LazyDERSet.cs
index 653054bf9..f8271f330 100644
--- a/crypto/src/asn1/LazyDERSet.cs
+++ b/crypto/src/asn1/LazyDERSet.cs
@@ -1,75 +1,77 @@
 using System;
 using System.Collections;
-using System.Diagnostics;
 
 namespace Org.BouncyCastle.Asn1
 {
-	internal class LazyDerSet
-		: DerSet
-	{
-		private byte[] encoded;
+    internal class LazyDerSet
+        : DerSet
+    {
+        private byte[] encoded;
 
-        internal LazyDerSet(
-			byte[] encoded)
-		{
-			this.encoded = encoded;
-		}
+        internal LazyDerSet(byte[] encoded)
+            : base()
+        {
+            if (null == encoded)
+                throw new ArgumentNullException("encoded");
 
-		private void Parse()
-		{
-			lock (this)
-			{
-				if (encoded != null)
-				{
+            this.encoded = encoded;
+        }
+
+        private void Parse()
+        {
+            lock (this)
+            {
+                if (encoded != null)
+                {
                     Asn1InputStream e = new LazyAsn1InputStream(encoded);
                     Asn1EncodableVector v = e.ReadVector();
 
                     this.elements = v.TakeElements();
                     this.encoded = null;
                 }
-			}
-		}
+            }
+        }
 
-		public override Asn1Encodable this[int index]
-		{
-			get
-			{
-				Parse();
+        public override Asn1Encodable this[int index]
+        {
+            get
+            {
+                Parse();
 
-				return base[index];
-			}
-		}
+                return base[index];
+            }
+        }
 
-		public override IEnumerator GetEnumerator()
-		{
-			Parse();
+        public override IEnumerator GetEnumerator()
+        {
+            Parse();
 
-			return base.GetEnumerator();
-		}
+            return base.GetEnumerator();
+        }
 
-		public override int Count
-		{
-			get
-			{
-				Parse();
+        public override int Count
+        {
+            get
+            {
+                Parse();
 
-				return base.Count;
-			}
-		}
+                return base.Count;
+            }
+        }
 
-		internal override void Encode(Asn1OutputStream asn1Out)
-		{
-			lock (this)
-			{
-				if (encoded == null)
-				{
-					base.Encode(asn1Out);
-				}
-				else
-				{
-					asn1Out.WriteEncoded(Asn1Tags.Set | Asn1Tags.Constructed, encoded);
-				}
-			}
-		}
-	}
+        internal override void Encode(Asn1OutputStream asn1Out)
+        {
+            lock (this)
+            {
+                if (encoded == null)
+                {
+                    base.Encode(asn1Out);
+                }
+                else
+                {
+                    asn1Out.WriteEncoded(Asn1Tags.Set | Asn1Tags.Constructed, encoded);
+                }
+            }
+        }
+    }
 }