apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.45k stars 157 forks source link

Update lower bound for RSA key sizes #218

Closed ptoffy closed 6 months ago

ptoffy commented 7 months ago

Update lower bound for RSA key sizes to 2048 rather than 1024

Checklist

Motivation:

Since 2015, NIST recommends a minimum key size of 2048 bits as stated in https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf This is also stated in the JWA specification (RFC7518 3.3 and 3.5) and in the RSA SSH spec, that's why this PR enforces the use of key sizes >=2048 rather than >=1024 as before.

Modifications:

Update lower bound for RSA key sizes to 2048 rather than 1024, specifically in the RSA key initialisers. Also update tests which use 1024 bits-sized keys and make sure they throw

Result:

Creating RSA keys of sizes <2048 will throw

ptoffy commented 7 months ago

@Lukasa that seems sensible. I've updated the PR with those changes, let me know what you think!

Lukasa commented 6 months ago

@swift-server-bot test this please