summary refs log tree commit diff
path: root/crypto/src/pkcs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/pkcs')
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs6
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs5
2 files changed, 6 insertions, 5 deletions
diff --git a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
index e18619c18..03afac8e1 100644
--- a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
+++ b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs
@@ -87,9 +87,11 @@ namespace Org.BouncyCastle.Pkcs
         {
             try
             {
-                ICipherBuilder decryptorBuilder = inputDecryptorProvider.CreateDecryptorBuilder(encryptedPrivateKeyInfo.EncryptionAlgorithm);
+                ICipherBuilder decryptorBuilder = inputDecryptorProvider.CreateDecryptorBuilder(
+                    encryptedPrivateKeyInfo.EncryptionAlgorithm);
 
-                ICipher encIn = decryptorBuilder.BuildCipher(new MemoryInputStream(encryptedPrivateKeyInfo.GetEncryptedData()));
+                ICipher encIn = decryptorBuilder.BuildCipher(
+                    new MemoryStream(encryptedPrivateKeyInfo.GetEncryptedData(), false));
 
                 byte[] data;
                 using (var strm = encIn.Stream)
diff --git a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
index 2556a947f..23c8c7f76 100644
--- a/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
+++ b/crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs
@@ -27,12 +27,11 @@ namespace Org.BouncyCastle.Pkcs
         /// </summary>
         /// <param name="encryptor">The encryptor to use.</param>
         /// <returns>An encrypted private key info containing the original private key info.</returns>
-        public Pkcs8EncryptedPrivateKeyInfo Build(
-            ICipherBuilder encryptor)
+        public Pkcs8EncryptedPrivateKeyInfo Build(ICipherBuilder encryptor)
         {
             try
             {
-                MemoryStream bOut = new MemoryOutputStream();
+                MemoryStream bOut = new MemoryStream();
                 ICipher cOut = encryptor.BuildCipher(bOut);
                 byte[] keyData = privateKeyInfo.GetEncoded();