summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-14 01:46:02 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-14 01:46:02 +0700
commitc4b9868dd436cb97777c8cb1b66e8715bc6f2700 (patch)
tree3dd0d81d74f72c8fc81fb3b88991fa680a2a053e
parentBigInteger changed to use uint[] internally (diff)
downloadBouncyCastle.NET-ed25519-c4b9868dd436cb97777c8cb1b66e8715bc6f2700.tar.xz
Remove unnecessary classes
-rw-r--r--crypto/src/crmf/EncryptedValueBuilder.cs2
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfo.cs6
-rw-r--r--crypto/src/pkcs/Pkcs8EncryptedPrivateKeyInfoBuilder.cs5
-rw-r--r--crypto/src/util/io/MemoryInputStream.cs19
-rw-r--r--crypto/src/util/io/MemoryOutputStream.cs14
5 files changed, 7 insertions, 39 deletions
diff --git a/crypto/src/crmf/EncryptedValueBuilder.cs b/crypto/src/crmf/EncryptedValueBuilder.cs
index 37f38df1c..3dca9e72c 100644
--- a/crypto/src/crmf/EncryptedValueBuilder.cs
+++ b/crypto/src/crmf/EncryptedValueBuilder.cs
@@ -111,7 +111,7 @@ namespace Org.BouncyCastle.Crmf
 
         private EncryptedValue EncryptData(byte[] data)
         {
-            MemoryOutputStream bOut = new MemoryOutputStream();
+            MemoryStream bOut = new MemoryStream();
             var cipher = encryptor.BuildCipher(bOut);
 
             try
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();
 
diff --git a/crypto/src/util/io/MemoryInputStream.cs b/crypto/src/util/io/MemoryInputStream.cs
deleted file mode 100644
index cdc5aafb3..000000000
--- a/crypto/src/util/io/MemoryInputStream.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.IO;
-
-namespace Org.BouncyCastle.Utilities.IO
-{
-    public class MemoryInputStream
-        : MemoryStream
-    {
-        public MemoryInputStream(byte[] buffer)
-            : base(buffer, false)
-        {
-        }
-
-        public sealed override bool CanWrite
-        {
-            get { return false; }
-        }
-    }
-}
diff --git a/crypto/src/util/io/MemoryOutputStream.cs b/crypto/src/util/io/MemoryOutputStream.cs
deleted file mode 100644
index 828f23b4a..000000000
--- a/crypto/src/util/io/MemoryOutputStream.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.IO;
-
-namespace Org.BouncyCastle.Utilities.IO
-{
-    public class MemoryOutputStream
-        : MemoryStream
-    {
-        public sealed override bool CanRead
-        {
-            get { return false; }
-        }
-    }
-}