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 final boolean isOpenJCEPlusModuleExist ;
7072
7173 private static final boolean userSetProfile ;
7274 private static final boolean shouldEnableSecurity ;
@@ -137,6 +139,11 @@ public String[] run() {
137139 }
138140 isOpenJCEPlusSupported = isOsSupported && isArchSupported ;
139141
142+ // Check whether the OpenJCEPlus module exists.
143+ ModuleLayer layer = ModuleLayer .boot ();
144+ Optional <Module > module = layer .findModule ("openjceplus" );
145+ isOpenJCEPlusModuleExist = module .isPresent ();
146+
140147 // Check the default solution to see if FIPS is supported.
141148 isFIPSSupported = isNSSSupported ;
142149
@@ -387,6 +394,11 @@ private static void checkIfKnownProfileSupported() {
387394 + " on this platform." );
388395 }
389396
397+ if (!isOpenJCEPlusModuleExist && profileID .contains ("OpenJCEPlus" )) {
398+ printStackTraceAndExit ("FIPS 140-3 profile specified. Required OpenJCEPlus"
399+ + " module not found." );
400+ }
401+
390402 if (debug != null ) {
391403 debug .println ("RestrictedSecurity profile " + profileID
392404 + " is supported on this platform." );
0 commit comments