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

Update RSA key generation unit test #405

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aws-lc
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (ext.isExperimentalFips) {

if (ext.isExperimentalFips || !ext.isFips) {
// Experimental FIPS uses the same AWS-LC version as non-FIPS builds.
ext.awsLcGitVersionId = 'v1.34.2'
ext.awsLcGitVersionId = 'v1.36.0'
} else {
ext.awsLcGitVersionId = 'AWS-LC-FIPS-2.0.15'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,18 @@ public void test4096() throws GeneralSecurityException {
public void test5120() throws GeneralSecurityException {
final KeyPairGenerator generator = getGenerator();
generator.initialize(5120);
if (TestUtil.isFips()) {
assertThrows(RuntimeCryptoException.class, () -> generator.generateKeyPair());
} else {
try {
final KeyPair keyPair = generator.generateKeyPair();
final RSAPublicKey pubKey = (RSAPublicKey) keyPair.getPublic();
final RSAPrivateCrtKey privKey = (RSAPrivateCrtKey) keyPair.getPrivate();
assertEquals(5120, pubKey.getModulus().bitLength());
assertEquals(RSAKeyGenParameterSpec.F4, pubKey.getPublicExponent());
assertConsistency(pubKey, privKey);
} catch (final RuntimeCryptoException e) {
// Starting from version v1.35.1, AWS-LC built in FIPS mode allows key sizes larger than 4096.
// This exception could happen if ACCP is built with a version of AWS-LC in FIPS mode that
// does not support key sizes larger than 4096.
assertTrue(TestUtil.isFips());
}
}

Expand Down
Loading