summary refs log tree commit diff
path: root/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs')
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
index 5882dee38..e18619c18 100644
--- a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
+++ b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
@@ -91,9 +91,11 @@ namespace Org.BouncyCastle.Pkcs
 
                 ICipher encIn = decryptorBuilder.BuildCipher(new MemoryInputStream(encryptedPrivateKeyInfo.GetEncryptedData()));
 
-                Stream strm = encIn.Stream;
-                byte[] data = Streams.ReadAll(encIn.Stream);
-                Platform.Dispose(strm);
+                byte[] data;
+                using (var strm = encIn.Stream)
+                {
+                    data = Streams.ReadAll(encIn.Stream);
+                }
 
                 return PrivateKeyInfo.GetInstance(data);
             }