diff options
-rw-r--r-- | crypto/test/src/crypto/test/OAEPTest.cs | 14 |
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())); |