Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 98cfbe5

Browse files
committed
Fix RSACryptoServiceProvider::LegalKeySize on Unix
The Unix RSACryptoServiceProvider type didn't set _legalKeySizesValue, or override the LegalKeySizesValue, and so null was being returned.
1 parent 774cc01 commit 98cfbe5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/System.Security.Cryptography.RSA/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public sealed partial class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgori
1717
public RSACryptoServiceProvider()
1818
{
1919
_defer = new RSAOpenSsl();
20+
_legalKeySizesValue = _defer.LegalKeySizes;
2021
}
2122

2223
public RSACryptoServiceProvider(int dwKeySize)
2324
{
2425
_defer = new RSAOpenSsl(dwKeySize);
26+
_legalKeySizesValue = _defer.LegalKeySizes;
2527
}
2628

2729
public RSACryptoServiceProvider(int dwKeySize, CspParameters parameters)

src/System.Security.Cryptography.RSA/tests/KeyGeneration.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ namespace System.Security.Cryptography.Rsa.Tests
88
public class KeyGeneration
99
{
1010
[Fact]
11-
[ActiveIssue(1984, PlatformID.AnyUnix)]
1211
public static void GenerateMinKey()
1312
{
1413
GenerateKey(rsa => GetMin(rsa.LegalKeySizes));
1514
}
1615

1716
[Fact]
18-
[ActiveIssue(1984, PlatformID.AnyUnix)]
1917
public static void GenerateSecondMinKey()
2018
{
2119
GenerateKey(rsa => GetSecondMin(rsa.LegalKeySizes));

0 commit comments

Comments
 (0)