Skip to content

Commit c0a2606

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 f09cd44 commit c0a2606

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
@@ -718,26 +718,6 @@ public void NotSupportedValueMethods()
718718
}
719719
}
720720

721-
[ConditionalTheory]
722-
[InlineData(new byte[] { 1, 2, 3, 4 })]
723-
[InlineData(new byte[0])]
724-
public void Decrypt_Pkcs1_ErrorsForInvalidPadding(byte[] data)
725-
{
726-
if (data.Length == 0 && !PlatformSupportsEmptyRSAEncryption)
727-
{
728-
throw new SkipTestException("Platform does not support RSA encryption of empty data.");
729-
}
730-
731-
using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params))
732-
{
733-
byte[] encrypted = Encrypt(rsa, data, RSAEncryptionPadding.Pkcs1);
734-
encrypted[1] ^= 0xFF;
735-
736-
// PKCS#1, the data, and the key are all deterministic so this should always throw an exception.
737-
Assert.ThrowsAny<CryptographicException>(() => Decrypt(rsa, encrypted, RSAEncryptionPadding.Pkcs1));
738-
}
739-
}
740-
741721
[Fact]
742722
public void Decrypt_Pkcs1_BadPadding()
743723
{

0 commit comments

Comments
 (0)