summary refs log tree commit diff
path: root/crypto/src/pkcs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 20:55:57 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 20:55:57 +0700
commite049cab36e9e68adff298acc24acdaa2551f72ef (patch)
treee772d623791461cba50b1eba3bbd4f833f893ae9 /crypto/src/pkcs
parentAdd Objects class (diff)
downloadBouncyCastle.NET-ed25519-e049cab36e9e68adff298acc24acdaa2551f72ef.tar.xz
Refactoring around Stream signers
Diffstat (limited to 'crypto/src/pkcs')
-rw-r--r--crypto/src/pkcs/Pkcs10CertificationRequest.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs
index d462fb4db..be4cbb570 100644
--- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs
+++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs
@@ -282,12 +282,10 @@ namespace Org.BouncyCastle.Pkcs
             this.reqInfo = new CertificationRequestInfo(subject, pubInfo, attributes);
 
             IStreamCalculator streamCalculator = signatureFactory.CreateCalculator();
-
-            byte[] reqInfoData = reqInfo.GetDerEncoded();
-
-            streamCalculator.Stream.Write(reqInfoData, 0, reqInfoData.Length);
-
-            Platform.Dispose(streamCalculator.Stream);
+            using (Stream sigStream = streamCalculator.Stream)
+            {
+                reqInfo.EncodeTo(sigStream, Der);
+            }
 
             // Generate Signature.
             sigBits = new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect());