summary refs log tree commit diff
path: root/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-01-31 19:26:09 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-01-31 19:26:09 +0700
commit65b588a45feb07f27716288ff15f784b5bf73812 (patch)
tree41d4d9e5d939e32008460cee18d6fc3dd6857ce0 /crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
parentremoved unnecessary extra ECGOST3410 class (diff)
downloadBouncyCastle.NET-ed25519-65b588a45feb07f27716288ff15f784b5bf73812.tar.xz
Fixes and tidying up for release
Diffstat (limited to 'crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs')
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs17
1 files changed, 8 insertions, 9 deletions
diff --git a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
index 3b05deea7..8f751492f 100644
--- a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
+++ b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
@@ -1,11 +1,11 @@
-using Org.BouncyCastle.Asn1.Pkcs;
+using System;
+using System.IO;
+
+using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.IO;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
 
 namespace Org.BouncyCastle.Pkcs
 {
@@ -36,10 +36,9 @@ namespace Org.BouncyCastle.Pkcs
                 ICipher cOut = encryptor.BuildCipher(bOut);
                 byte[] keyData = privateKeyInfo.GetEncoded();
 
-                using (var str = cOut.Stream)
-                {
-                    str.Write(keyData, 0, keyData.Length);
-                }
+                Stream str = cOut.Stream;
+                str.Write(keyData, 0, keyData.Length);
+                Platform.Dispose(str);
 
                 return new Pkcs8EncryptedPrivateKeyInfo(new EncryptedPrivateKeyInfo((AlgorithmIdentifier)encryptor.AlgorithmDetails, bOut.ToArray()));
             }