From 3de05be61134679df6dae2dfcdcf661d6a335197 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Wed, 6 Mar 2024 13:42:47 -0500 Subject: [PATCH] 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. --- .../RSA/EncryptDecrypt.cs | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs index 283db08daec7e..050e43d867a68 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs @@ -694,26 +694,6 @@ public void NotSupportedValueMethods() } } - [ConditionalTheory] - [InlineData(new byte[] { 1, 2, 3, 4 })] - [InlineData(new byte[0])] - public void Decrypt_Pkcs1_ErrorsForInvalidPadding(byte[] data) - { - if (data.Length == 0 && !PlatformSupportsEmptyRSAEncryption) - { - throw new SkipTestException("Platform does not support RSA encryption of empty data."); - } - - using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params)) - { - byte[] encrypted = Encrypt(rsa, data, RSAEncryptionPadding.Pkcs1); - encrypted[1] ^= 0xFF; - - // PKCS#1, the data, and the key are all deterministic so this should always throw an exception. - Assert.ThrowsAny(() => Decrypt(rsa, encrypted, RSAEncryptionPadding.Pkcs1)); - } - } - [Fact] public void Decrypt_Pkcs1_BadPadding() {