Skip to content

Commit 357e91b

Browse files
committed
github#54 test for mixed mode definition
1 parent 8cdb0ed commit 357e91b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

crypto/test/src/crypto/test/OAEPTest.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,17 +787,17 @@ public override void PerformTest()
787787
//
788788
// OAEP - public encrypt, private decrypt, differing hashes
789789
//
790-
IAsymmetricBlockCipher cipher = new OaepEncoding(new RsaEngine(), new Sha256Digest(), new Sha1Digest(), new byte[10]);
790+
IAsymmetricBlockCipher cipher = new OaepEncoding(new RsaEngine(), new Sha256Digest(), new Sha1Digest(), null);
791791

792792
cipher.Init(true, new ParametersWithRandom(pubParam, new SecureRandom()));
793793

794794
byte[] input = new byte[10];
795795

796-
byte[] output = cipher.ProcessBlock(input, 0, input.Length);
796+
byte[] enc = cipher.ProcessBlock(input, 0, input.Length);
797797

798798
cipher.Init(false, privParam);
799799

800-
output = cipher.ProcessBlock(output, 0, output.Length);
800+
byte[] output = cipher.ProcessBlock(enc, 0, enc.Length);
801801

802802
for (int i = 0; i != input.Length; i++)
803803
{
@@ -807,6 +807,14 @@ public override void PerformTest()
807807
}
808808
}
809809

810+
IBufferedCipher cBuf = CipherUtilities.GetCipher("RSA/NONE/OAEPWITHSHA-256ANDMGF1WITHSHA-1PADDING");
811+
812+
cBuf.Init(false, privParam);
813+
814+
output = cBuf.DoFinal(enc, 0, enc.Length);
815+
816+
Assert.AreEqual(input, output);
817+
810818
cipher = new OaepEncoding(new RsaEngine(), new Sha1Digest(), new Sha256Digest(), new byte[10]);
811819

812820
cipher.Init(true, new ParametersWithRandom(pubParam, new SecureRandom()));

0 commit comments

Comments
 (0)