summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Hook <dgh@bouncycastle.org>2021-05-24 09:07:17 +1000
committerDavid Hook <dgh@bouncycastle.org>2021-05-24 09:07:17 +1000
commit357e91b86ff4f258921a460d8eb70c2a60e577d8 (patch)
tree98406cda1b5424b6d172bb72898c9b3699af2ecf
parentMerge remote-tracking branch 'origin/master' (diff)
downloadBouncyCastle.NET-ed25519-357e91b86ff4f258921a460d8eb70c2a60e577d8.tar.xz
github#54 test for mixed mode definition
-rw-r--r--crypto/test/src/crypto/test/OAEPTest.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crypto/test/src/crypto/test/OAEPTest.cs b/crypto/test/src/crypto/test/OAEPTest.cs
index 08ecb6314..3c4373270 100644
--- a/crypto/test/src/crypto/test/OAEPTest.cs
+++ b/crypto/test/src/crypto/test/OAEPTest.cs
@@ -787,17 +787,17 @@ namespace Org.BouncyCastle.Crypto.Tests
             //
             // OAEP - public encrypt, private decrypt, differing hashes
             //
-            IAsymmetricBlockCipher cipher = new OaepEncoding(new RsaEngine(), new Sha256Digest(), new Sha1Digest(), new byte[10]);
+            IAsymmetricBlockCipher cipher = new OaepEncoding(new RsaEngine(), new Sha256Digest(), new Sha1Digest(), null);
 
             cipher.Init(true, new ParametersWithRandom(pubParam, new SecureRandom()));
 
             byte[] input = new byte[10];
 
-            byte[] output = cipher.ProcessBlock(input, 0, input.Length);
+            byte[] enc = cipher.ProcessBlock(input, 0, input.Length);
 
             cipher.Init(false, privParam);
 
-            output = cipher.ProcessBlock(output, 0, output.Length);
+            byte[] output = cipher.ProcessBlock(enc, 0, enc.Length);
 
             for (int i = 0; i != input.Length; i++)
             {
@@ -807,6 +807,14 @@ namespace Org.BouncyCastle.Crypto.Tests
                 }
             }
 
+            IBufferedCipher cBuf = CipherUtilities.GetCipher("RSA/NONE/OAEPWITHSHA-256ANDMGF1WITHSHA-1PADDING");
+
+            cBuf.Init(false, privParam);
+
+            output = cBuf.DoFinal(enc, 0, enc.Length);
+
+            Assert.AreEqual(input, output);
+
             cipher = new OaepEncoding(new RsaEngine(), new Sha1Digest(), new Sha256Digest(), new byte[10]);
 
             cipher.Init(true, new ParametersWithRandom(pubParam, new SecureRandom()));