diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 20:55:57 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 20:55:57 +0700 |
commit | e049cab36e9e68adff298acc24acdaa2551f72ef (patch) | |
tree | e772d623791461cba50b1eba3bbd4f833f893ae9 /crypto/src/pkcs | |
parent | Add Objects class (diff) | |
download | BouncyCastle.NET-ed25519-e049cab36e9e68adff298acc24acdaa2551f72ef.tar.xz |
Refactoring around Stream signers
Diffstat (limited to 'crypto/src/pkcs')
-rw-r--r-- | crypto/src/pkcs/Pkcs10CertificationRequest.cs | 10 |
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()); |