Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RSA.LegalKeySizes for Apple platforms to return 8192 #110591

Merged
merged 5 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading