11/*
22 * ===========================================================================
3- * (c) Copyright IBM Corp. 2022, 2024 All Rights Reserved
3+ * (c) Copyright IBM Corp. 2022, 2025 All Rights Reserved
44 * ===========================================================================
55 *
66 * This code is free software; you can redistribute it and/or modify it
4242import java .util .List ;
4343import java .util .Map ;
4444import java .util .Objects ;
45+ import java .util .Optional ;
4546import java .util .Properties ;
4647import java .util .Set ;
4748import java .util .regex .Matcher ;
@@ -67,6 +68,7 @@ public final class RestrictedSecurity {
6768
6869 private static final boolean isNSSSupported ;
6970 private static final boolean isOpenJCEPlusSupported ;
71+ private static boolean isOpenJCEPlusModuleExist ;
7072
7173 private static final boolean userSetProfile ;
7274 private static final boolean shouldEnableSecurity ;
@@ -137,6 +139,14 @@ public String[] run() {
137139 }
138140 isOpenJCEPlusSupported = isOsSupported && isArchSupported ;
139141
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+
140150 // Check the default solution to see if FIPS is supported.
141151 isFIPSSupported = isNSSSupported ;
142152
@@ -387,6 +397,11 @@ private static void checkIfKnownProfileSupported() {
387397 + " on this platform." );
388398 }
389399
400+ if (profileID .contains ("OpenJCEPlus" ) && !isOpenJCEPlusModuleExist ) {
401+ printStackTraceAndExit ("FIPS 140-3 profile specified. Required OpenJCEPlus"
402+ + " module not found." );
403+ }
404+
390405 if (debug != null ) {
391406 debug .println ("RestrictedSecurity profile " + profileID
392407 + " is supported on this platform." );
0 commit comments