Skip to content

Commit ba2f0d5

Browse files
Add test for multiple constraints (attributes)
1 parent 21e358b commit ba2f0d5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

closed/test/jdk/openj9/internal/security/TestConstraintsSuccess.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,15 @@ private static void getInstances() throws Exception {
7878
TrustManagerFactory.getInstance("SunX509");
7979
SSLContext.getInstance("TLSv1.3");
8080

81-
// Since there are two constraints for MD5, the second one allows
82-
// for use by this class, successfully getting the algorithm
81+
// Since there are two constraints for MD5, with only the second one
82+
// allowing for use by this class, successfully getting the algorithm
8383
// verifies that all constraints are checked.
8484
MessageDigest.getInstance("MD5");
85+
86+
// Since there are two constraints for SHA512withECDSA, with only the
87+
// second one having the correct attribute, successfully getting the
88+
// algorithm verifies that all constraints are checked.
89+
Signature.getInstance("SHA512withECDSA");
8590
}
8691

8792
@Test

closed/test/jdk/openj9/internal/security/constraints-java.security

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ RestrictedSecurity.TestConstraints.Version.jce.provider.1 = sun.security.provide
4141
RestrictedSecurity.TestConstraints.Version.jce.provider.2 = sun.security.ec.SunEC [ \
4242
{AlgorithmParameters, EC, *, ModuleAndFullClassName:java.base/java.security.KeyPairGenerator}, \
4343
{Signature, SHA256withECDSA, *, FullClassName:TestConstraintsSuccess}, \
44+
{Signature, SHA512withECDSA, KeySize=255, FullClassName:TestConstraintsSuccess}, \
45+
{Signature, SHA512withECDSA, KeySize=256, FullClassName:TestConstraintsSuccess}, \
4446
{KeyPairGenerator, EC, *, FullClassName:TestConstraintsSuccess}, \
4547
{KeyAgreement, ECDH, *, FullClassName:TestConstraintsSuccess}, \
4648
{KeyFactory, EC, *, FullClassName:TestConstraintsSuccess}]

0 commit comments

Comments
 (0)