Skip to content

Commit 6355683

Browse files
Delete Decrypt_Pkcs1_ErrorsForInvalidPadding
This test has a small random chance of failure because of non-determinism. The test Decrypt_Pkcs1_BadPadding covers this scenario and is properly deterministic, so let's go ahead and delete the test that has a chance of failing. Co-authored-by: Kevin Jones <[email protected]>
1 parent bc5e878 commit 6355683

File tree

1 file changed

+0
-20
lines changed
  • src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA

1 file changed

+0
-20
lines changed

src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -694,26 +694,6 @@ public void NotSupportedValueMethods()
694694
}
695695
}
696696

697-
[ConditionalTheory]
698-
[InlineData(new byte[] { 1, 2, 3, 4 })]
699-
[InlineData(new byte[0])]
700-
public void Decrypt_Pkcs1_ErrorsForInvalidPadding(byte[] data)
701-
{
702-
if (data.Length == 0 && !PlatformSupportsEmptyRSAEncryption)
703-
{
704-
throw new SkipTestException("Platform does not support RSA encryption of empty data.");
705-
}
706-
707-
using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params))
708-
{
709-
byte[] encrypted = Encrypt(rsa, data, RSAEncryptionPadding.Pkcs1);
710-
encrypted[1] ^= 0xFF;
711-
712-
// PKCS#1, the data, and the key are all deterministic so this should always throw an exception.
713-
Assert.ThrowsAny<CryptographicException>(() => Decrypt(rsa, encrypted, RSAEncryptionPadding.Pkcs1));
714-
}
715-
}
716-
717697
[Fact]
718698
public void Decrypt_Pkcs1_BadPadding()
719699
{

0 commit comments

Comments
 (0)