-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
KMS: fix RSA PSS signing issue for salt length #12467
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
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 4m 3s ⏱️ - 1h 47m 36s Results for commit aa692da. ± Comparison against base commit 9383d50. This pull request removes 3636 and adds 8 tests. Note that renamed tests count towards both.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! First I got a bit confused because Section 3.3 in the RFC doesn't mention the recommended salt length. However, 3.1 does:
saltLength
The saltLength field is the octet length of the salt. For a
given hashAlgorithm, the recommended value of saltLength is the
number of octets in the hash value. Unlike the other fields of
type RSASSA-PSS-params, saltLength does not need to be fixed
for a given RSA key pair; a different value could be used for
each RSASSA-PSS signature generated.
So using the digest (hash) length here is indeed more correct.
Awesome work on the test as well! :)
@pytest.mark.parametrize( | ||
"key_spec,sign_algo", | ||
[ | ||
("RSA_2048", "RSASSA_PSS_SHA_256"), | ||
("RSA_2048", "RSASSA_PSS_SHA_384"), | ||
("RSA_2048", "RSASSA_PSS_SHA_512"), | ||
("RSA_4096", "RSASSA_PKCS1_V1_5_SHA_256"), | ||
("RSA_4096", "RSASSA_PKCS1_V1_5_SHA_512"), | ||
("ECC_NIST_P256", "ECDSA_SHA_256"), | ||
("ECC_NIST_P384", "ECDSA_SHA_384"), | ||
("ECC_SECG_P256K1", "ECDSA_SHA_256"), | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice parametrized test :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! thank you for doing that
Motivation
When using an RSA key to sign with PSS algorithm, currently the salt length is set to be
MAX_LENGTH
, which is not in accordance with the ones required by RFC 4055 making making it difficult to verify such signatures across platforms: https://datatracker.ietf.org/doc/html/rfc4055#section-3.3.Closes #9602
Changes
This PR:
cryptography
library.