@@ -1090,7 +1090,7 @@ private void init(String profileID) {
1090
1090
// Load restricted security providers from java.security properties.
1091
1091
initProviders (profileID , allInfo );
1092
1092
// Load restricted security properties from java.security properties.
1093
- loadProperties (profileID , allInfo );
1093
+ loadProperties (profileID , allInfo , true );
1094
1094
1095
1095
String hashProperty = profileID + ".desc.hash" ;
1096
1096
String hashValue = securityProps .getProperty (hashProperty );
@@ -1124,7 +1124,7 @@ private void update(String profileExtensionId) {
1124
1124
// Load restricted security providers from java.security properties.
1125
1125
updateProviders (profileExtensionId , allInfo );
1126
1126
// Load restricted security properties from java.security properties.
1127
- loadProperties (profileExtensionId , allInfo );
1127
+ loadProperties (profileExtensionId , allInfo , false );
1128
1128
1129
1129
String hashProperty = profileExtensionId + ".desc.hash" ;
1130
1130
String hashValue = securityProps .getProperty (hashProperty );
@@ -1314,48 +1314,79 @@ private void updateProviders(String profileExtensionId, List<String> allInfo) {
1314
1314
}
1315
1315
}
1316
1316
1317
+ private String getExistingValue (String property ) {
1318
+ // Look for values from profiles that this one extends.
1319
+ String existingValue = profileProperties .get (property );
1320
+
1321
+ // If there is no value, look for non-profile values in java.security file.
1322
+ if (existingValue == null ) {
1323
+ String propertyKey = null ;
1324
+ switch (property ) {
1325
+ case "jdkCertpathDisabledAlgorithms" :
1326
+ propertyKey = "jdk.certpath.disabledAlgorithms" ;
1327
+ break ;
1328
+ case "jdkSecurityLegacyAlgorithms" :
1329
+ propertyKey = "jdk.security.legacyAlgorithms" ;
1330
+ break ;
1331
+ case "jdkTlsDisabledAlgorithms" :
1332
+ propertyKey = "jdk.tls.disabledAlgorithms" ;
1333
+ break ;
1334
+ case "jdkTlsDisabledNamedCurves" :
1335
+ propertyKey = "jdk.tls.disabledNamedCurves" ;
1336
+ break ;
1337
+ case "jdkTlsLegacyAlgorithms" :
1338
+ propertyKey = "jdk.tls.legacyAlgorithms" ;
1339
+ break ;
1340
+ default :
1341
+ propertyKey = "" ;
1342
+ }
1343
+ existingValue = securityProps .getProperty (propertyKey );
1344
+ }
1345
+ return existingValue ;
1346
+ }
1347
+
1317
1348
/**
1318
1349
* Load restricted security properties.
1319
1350
*/
1320
- private void loadProperties (String profileID , List <String > allInfo ) {
1351
+ private void loadProperties (String profileID , List <String > allInfo , boolean isBaseProfile ) {
1321
1352
if (debug != null ) {
1322
1353
debug .println ("\t Loading properties of restricted security profile." );
1323
1354
}
1324
1355
1325
- setProperty ("descName" , profileID + ".desc.name" , allInfo );
1326
- if (setProperty ("descIsDefaultString" , profileID + ".desc.default" , allInfo )) {
1356
+ setProperty ("descName" , profileID + ".desc.name" , allInfo , isBaseProfile );
1357
+ if (setProperty ("descIsDefaultString" , profileID + ".desc.default" , allInfo , isBaseProfile )) {
1327
1358
descIsDefault = Boolean .parseBoolean (profileProperties .get ("descIsDefaultString" ));
1328
1359
}
1329
- if (setProperty ("descIsFIPSString" , profileID + ".desc.fips" , allInfo )) {
1360
+ if (setProperty ("descIsFIPSString" , profileID + ".desc.fips" , allInfo , isBaseProfile )) {
1330
1361
descIsFIPS = Boolean .parseBoolean (profileProperties .get ("descIsFIPSString" ));
1331
1362
}
1332
- setProperty ("descNumber" , profileID + ".desc.number" , allInfo );
1333
- setProperty ("descPolicy" , profileID + ".desc.policy" , allInfo );
1334
- setProperty ("descSunsetDate" , profileID + ".desc.sunsetDate" , allInfo );
1363
+ setProperty ("descNumber" , profileID + ".desc.number" , allInfo , isBaseProfile );
1364
+ setProperty ("descPolicy" , profileID + ".desc.policy" , allInfo , isBaseProfile );
1365
+ setProperty ("descSunsetDate" , profileID + ".desc.sunsetDate" , allInfo , isBaseProfile );
1335
1366
1336
1367
setProperty ("jdkTlsDisabledNamedCurves" ,
1337
- profileID + ".tls.disabledNamedCurves" , allInfo );
1368
+ profileID + ".tls.disabledNamedCurves" , allInfo , isBaseProfile );
1338
1369
setProperty ("jdkTlsDisabledAlgorithms" ,
1339
- profileID + ".tls.disabledAlgorithms" , allInfo );
1370
+ profileID + ".tls.disabledAlgorithms" , allInfo , isBaseProfile );
1340
1371
setProperty ("jdkTlsEphemeralDHKeySize" ,
1341
- profileID + ".tls.ephemeralDHKeySize" , allInfo );
1372
+ profileID + ".tls.ephemeralDHKeySize" , allInfo , isBaseProfile );
1342
1373
setProperty ("jdkTlsLegacyAlgorithms" ,
1343
- profileID + ".tls.legacyAlgorithms" , allInfo );
1374
+ profileID + ".tls.legacyAlgorithms" , allInfo , isBaseProfile );
1344
1375
setProperty ("jdkCertpathDisabledAlgorithms" ,
1345
- profileID + ".jce.certpath.disabledAlgorithms" , allInfo );
1376
+ profileID + ".jce.certpath.disabledAlgorithms" , allInfo , isBaseProfile );
1346
1377
setProperty ("jdkSecurityLegacyAlgorithms" ,
1347
- profileID + ".jce.legacyAlgorithms" , allInfo );
1378
+ profileID + ".jce.legacyAlgorithms" , allInfo , isBaseProfile );
1348
1379
setProperty ("keyStoreType" ,
1349
- profileID + ".keystore.type" , allInfo );
1380
+ profileID + ".keystore.type" , allInfo , isBaseProfile );
1350
1381
setProperty ("keyStore" ,
1351
- profileID + ".javax.net.ssl.keyStore" , allInfo );
1382
+ profileID + ".javax.net.ssl.keyStore" , allInfo , isBaseProfile );
1352
1383
1353
1384
setProperty ("jdkSecureRandomProvider" ,
1354
- profileID + ".securerandom.provider" , allInfo );
1385
+ profileID + ".securerandom.provider" , allInfo , isBaseProfile );
1355
1386
setProperty ("jdkSecureRandomAlgorithm" ,
1356
- profileID + ".securerandom.algorithm" , allInfo );
1387
+ profileID + ".securerandom.algorithm" , allInfo , isBaseProfile );
1357
1388
setProperty ("jdkFipsMode" ,
1358
- profileID + ".fips.mode" , allInfo );
1389
+ profileID + ".fips.mode" , allInfo , isBaseProfile );
1359
1390
1360
1391
if (debug != null ) {
1361
1392
debug .println ("\t Properties of restricted security profile successfully loaded." );
@@ -1573,7 +1604,7 @@ private void printProfile(String profileToPrint) {
1573
1604
* @param propertyKey the property key in the java.security file
1574
1605
* @return whether the property was set
1575
1606
*/
1576
- private boolean setProperty (String property , String propertyKey , List <String > allInfo ) {
1607
+ private boolean setProperty (String property , String propertyKey , List <String > allInfo , boolean isBaseProfile ) {
1577
1608
if (debug != null ) {
1578
1609
debug .println ("Setting property: " + property );
1579
1610
}
@@ -1585,7 +1616,7 @@ private boolean setProperty(String property, String propertyKey, List<String> al
1585
1616
allInfo .add (propertyKey + "=" + value );
1586
1617
1587
1618
// Check if property overrides, adds to or removes from previous value.
1588
- String existingValue = profileProperties . get (property );
1619
+ String existingValue = getExistingValue (property );
1589
1620
if (value .startsWith ("+" )) {
1590
1621
if (!isPropertyAppendable (property )) {
1591
1622
printStackTraceAndExit ("Property '" + property + "' is not appendable." );
0 commit comments