summary refs log tree commit diff
path: root/crypto/src/asn1/DERSequenceGenerator.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 16:08:19 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 16:08:19 +0700
commit7735c6336809bc20d10dae1c15891143d0cc54c5 (patch)
tree3f08af7faa908520ae06944744c1e86aeea395d6 /crypto/src/asn1/DERSequenceGenerator.cs
parentRemove unused class (diff)
downloadBouncyCastle.NET-ed25519-7735c6336809bc20d10dae1c15891143d0cc54c5.tar.xz
Asn1Generator implements IDisposable
- now expects BerOctetStringGenerator to be disposed, not just its octets stream
Diffstat (limited to 'crypto/src/asn1/DERSequenceGenerator.cs')
-rw-r--r--crypto/src/asn1/DERSequenceGenerator.cs20
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/src/asn1/DERSequenceGenerator.cs b/crypto/src/asn1/DERSequenceGenerator.cs
index 12c978508..be240a86c 100644
--- a/crypto/src/asn1/DERSequenceGenerator.cs
+++ b/crypto/src/asn1/DERSequenceGenerator.cs
@@ -7,21 +7,22 @@ namespace Org.BouncyCastle.Asn1
 	{
 		private readonly MemoryStream _bOut = new MemoryStream();
 
-		public DerSequenceGenerator(
-			Stream outStream)
+		public DerSequenceGenerator(Stream outStream)
 			: base(outStream)
 		{
 		}
 
-		public DerSequenceGenerator(
-			Stream	outStream,
-			int		tagNo,
-			bool	isExplicit)
+		public DerSequenceGenerator(Stream outStream, int tagNo, bool isExplicit)
 			: base(outStream, tagNo, isExplicit)
 		{
 		}
 
-		public override void AddObject(Asn1Encodable obj)
+        protected override void Finish()
+        {
+            WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray());
+        }
+
+        public override void AddObject(Asn1Encodable obj)
 		{
             obj.EncodeTo(_bOut, Asn1Encodable.Der);
 		}
@@ -35,10 +36,5 @@ namespace Org.BouncyCastle.Asn1
 		{
 			return _bOut;
 		}
-
-		public override void Close()
-		{
-			WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray());
-		}
 	}
 }