Skip to content

Commit

Permalink
Skip compatibility-with-JCE for JDK 10
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhosv committed Feb 20, 2024
1 parent cb91fe2 commit de5498b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static com.amazon.corretto.crypto.provider.test.TestUtil.NATIVE_PROVIDER;
import static com.amazon.corretto.crypto.provider.test.TestUtil.assertThrows;
import static com.amazon.corretto.crypto.provider.test.TestUtil.assumeMinimumVersion;
import static com.amazon.corretto.crypto.provider.test.TestUtil.getJavaVersion;
import static com.amazon.corretto.crypto.provider.test.TestUtil.versionCompare;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -448,11 +449,14 @@ public void testRsaPSSBadParams() throws Exception {
signature.setParameter(
new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 4096, 1)));

// Assert compatiblity with JCE on setting null parameter, BC doesn't throw.
// Assert compatibility with JCE for JDKs other than 10 on setting null parameter, BC doesn't
// throw.
assertThrows(InvalidAlgorithmParameterException.class, () -> signature.setParameter(null));
assertThrows(
InvalidAlgorithmParameterException.class,
() -> Signature.getInstance("RSASSA-PSS", "SunRsaSign").setParameter(null));
if (getJavaVersion() != 10) {
assertThrows(
InvalidAlgorithmParameterException.class,
() -> Signature.getInstance("RSASSA-PSS", "SunRsaSign").setParameter(null));
}
Signature.getInstance("RSASSA-PSS", TestUtil.BC_PROVIDER).setParameter(null);

// "1" should be only valid trailer value.
Expand Down

0 comments on commit de5498b

Please sign in to comment.