1
1
/*
2
2
* ===========================================================================
3
- * (c) Copyright IBM Corp. 2022, 2024 All Rights Reserved
3
+ * (c) Copyright IBM Corp. 2022, 2025 All Rights Reserved
4
4
* ===========================================================================
5
5
*
6
6
* This code is free software; you can redistribute it and/or modify it
42
42
import java .util .List ;
43
43
import java .util .Map ;
44
44
import java .util .Objects ;
45
+ import java .util .Optional ;
45
46
import java .util .Properties ;
46
47
import java .util .Set ;
47
48
import java .util .regex .Matcher ;
@@ -67,6 +68,7 @@ public final class RestrictedSecurity {
67
68
68
69
private static final boolean isNSSSupported ;
69
70
private static final boolean isOpenJCEPlusSupported ;
71
+ private static boolean isOpenJCEPlusModuleExist ;
70
72
71
73
private static final boolean userSetProfile ;
72
74
private static final boolean shouldEnableSecurity ;
@@ -137,6 +139,14 @@ public String[] run() {
137
139
}
138
140
isOpenJCEPlusSupported = isOsSupported && isArchSupported ;
139
141
142
+ // Check whether the OpenJCEPlus module exists.
143
+ isOpenJCEPlusModuleExist = false ;
144
+ ModuleLayer layer = ModuleLayer .boot ();
145
+ Optional <Module > module = layer .findModule ("openjceplus" );
146
+ if (module .isPresent ()) {
147
+ isOpenJCEPlusModuleExist = true ;
148
+ }
149
+
140
150
// Check the default solution to see if FIPS is supported.
141
151
isFIPSSupported = isNSSSupported ;
142
152
@@ -387,6 +397,11 @@ private static void checkIfKnownProfileSupported() {
387
397
+ " on this platform." );
388
398
}
389
399
400
+ if (profileID .contains ("OpenJCEPlus" ) && !isOpenJCEPlusModuleExist ) {
401
+ printStackTraceAndExit ("FIPS 140-3 profile specified. Required OpenJCEPlus"
402
+ + " module not found." );
403
+ }
404
+
390
405
if (debug != null ) {
391
406
debug .println ("RestrictedSecurity profile " + profileID
392
407
+ " is supported on this platform." );
0 commit comments