diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 21:37:59 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 21:37:59 +0700 |
commit | 98c8cbf49384796d55cd05a766e2429d8a4262d2 (patch) | |
tree | d7e195fc5835e03398ee5a670829470d7633623d /crypto/src/bcpg/OnePassSignaturePacket.cs | |
parent | Refactoring around Stream signers (diff) | |
download | BouncyCastle.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.cs | 20 |
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); } |