Skip to content

Commit 85d4362

Browse files
authored
Merge pull request ibmruntimes#363 from KostasTsiounis/update_jarlist
Add fully-qualified class names of jar verification providers
2 parents 0424dfc + ba60c69 commit 85d4362

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/java.base/share/classes/sun/security/jca/Providers.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ private Providers() {
100100
"SunJCE",
101101
};
102102

103+
// Hardcoded fully-qualified class names of providers to use for JAR
104+
// verification when RestrictedSecurity is enabled (similar to
105+
// jarVerificationProviders array).
106+
//
107+
// MUST NOT be on the bootclasspath and not in signed JAR files.
108+
private static final String[] restrictedJarVerificationProviders = {
109+
"sun.security.provider.Sun",
110+
"sun.security.rsa.SunRsaSign",
111+
// Note: when SunEC is in a signed JAR file, it's not signed
112+
// by EC algorithms. So it's still safe to be listed here.
113+
"sun.security.ec.SunEC",
114+
"com.sun.crypto.provider.SunJCE",
115+
};
116+
103117
// Return Sun provider.
104118
// This method should only be called by
105119
// sun.security.util.ManifestEntryVerifier and java.security.SecureRandom.
@@ -115,7 +129,10 @@ public static Provider getSunProvider() {
115129
*/
116130
public static Object startJarVerification() {
117131
ProviderList currentList = getProviderList();
118-
ProviderList jarList = currentList.getJarList(jarVerificationProviders);
132+
ProviderList jarList = currentList.getJarList(
133+
RestrictedSecurity.isEnabled()
134+
? restrictedJarVerificationProviders
135+
: jarVerificationProviders);
119136
if (jarList.getProvider("SUN") == null) {
120137
// add backup provider
121138
Provider p;

0 commit comments

Comments
 (0)