summary refs log tree commit diff
path: root/crypto/src/bcpg/OnePassSignaturePacket.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 21:37:59 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 21:37:59 +0700
commit98c8cbf49384796d55cd05a766e2429d8a4262d2 (patch)
treed7e195fc5835e03398ee5a670829470d7633623d /crypto/src/bcpg/OnePassSignaturePacket.cs
parentRefactoring around Stream signers (diff)
downloadBouncyCastle.NET-ed25519-98c8cbf49384796d55cd05a766e2429d8a4262d2.tar.xz
Cleanup Stream disposing in Bcpg
Diffstat (limited to 'crypto/src/bcpg/OnePassSignaturePacket.cs')
-rw-r--r--crypto/src/bcpg/OnePassSignaturePacket.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/crypto/src/bcpg/OnePassSignaturePacket.cs b/crypto/src/bcpg/OnePassSignaturePacket.cs
index b67df0a52..70f0a2207 100644
--- a/crypto/src/bcpg/OnePassSignaturePacket.cs
+++ b/crypto/src/bcpg/OnePassSignaturePacket.cs
@@ -71,21 +71,15 @@ namespace Org.BouncyCastle.Bcpg
 			get { return keyId; }
 		}
 
-		public override void Encode(
-			BcpgOutputStream bcpgOut)
+		public override void Encode(BcpgOutputStream bcpgOut)
 		{
 			MemoryStream bOut = new MemoryStream();
-			BcpgOutputStream pOut = new BcpgOutputStream(bOut);
-
-			pOut.Write(
-				(byte) version,
-				(byte) sigType,
-				(byte) hashAlgorithm,
-				(byte) keyAlgorithm);
-
-			pOut.WriteLong(keyId);
-
-			pOut.WriteByte((byte) nested);
+			using (var pOut = new BcpgOutputStream(bOut))
+            {
+				pOut.Write((byte)version, (byte)sigType, (byte)hashAlgorithm, (byte)keyAlgorithm);
+				pOut.WriteLong(keyId);
+				pOut.WriteByte((byte)nested);
+			}
 
 			bcpgOut.WritePacket(PacketTag.OnePassSignature, bOut.ToArray(), true);
 		}