Skip to content

Commit

Permalink
Change RSA.LegalKeySizes for Apple platforms to return 8192
Browse files Browse the repository at this point in the history
  • Loading branch information
vcsjones authored Jan 3, 2025
1 parent 86a7ff9 commit 192f43b
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public sealed partial class RSASecurityTransforms : RSA, IRuntimeAlgorithm
{
private SecKeyPair? _keys;

// All values are in bits.
// 1024 was achieved via experimentation.
// 1024 and 1024+8 both generated successfully, 1024-8 produced errSecParam.
// 8192 generated successfully, 8192+8 produced errSecParam.
private static readonly KeySizes s_legalKeySize = new KeySizes(minSize: 1024, maxSize: 8192, skipSize: 8);

public RSASecurityTransforms()
: this(2048)
{
Expand All @@ -38,19 +44,7 @@ internal RSASecurityTransforms(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandl
SetKey(SecKeyPair.PublicPrivatePair(publicKey, privateKey));
}

public override KeySizes[] LegalKeySizes
{
get
{
return new KeySizes[]
{
// All values are in bits.
// 1024 was achieved via experimentation.
// 1024 and 1024+8 both generated successfully, 1024-8 produced errSecParam.
new KeySizes(minSize: 1024, maxSize: 16384, skipSize: 8),
};
}
}
public override KeySizes[] LegalKeySizes => [s_legalKeySize];

public override int KeySize
{
Expand Down

0 comments on commit 192f43b

Please sign in to comment.