From c86b2ce3dcf86b4b7d1286ea3686f89aea2bbbe7 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 5 Jan 2023 13:29:15 +0700 Subject: Refactor SendSignatureInput and callers --- crypto/src/tls/TlsUtilities.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs index 424fca133..4a89d6708 100644 --- a/crypto/src/tls/TlsUtilities.cs +++ b/crypto/src/tls/TlsUtilities.cs @@ -2157,8 +2157,6 @@ namespace Org.BouncyCastle.Tls } buf.CopyInputTo(output); - - output.Dispose(); } internal static DigitallySigned GenerateCertificateVerifyClient(TlsClientContext clientContext, @@ -2399,7 +2397,10 @@ namespace Org.BouncyCastle.Tls byte[] signature; if (streamSigner != null) { - SendSignatureInput(context, extraSignatureInput, digestBuffer, streamSigner.Stream); + using (var output = streamSigner.Stream) + { + SendSignatureInput(context, extraSignatureInput, digestBuffer, output); + } signature = streamSigner.GetSignature(); } else @@ -2445,7 +2446,10 @@ namespace Org.BouncyCastle.Tls bool verified; if (streamVerifier != null) { - SendSignatureInput(context, null, digestBuffer, streamVerifier.Stream); + using (var output = streamVerifier.Stream) + { + SendSignatureInput(context, null, digestBuffer, output); + } verified = streamVerifier.IsVerified(); } else -- cgit 1.4.1