@@ -100,6 +100,20 @@ private Providers() {
100
100
"SunJCE" ,
101
101
};
102
102
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
+
103
117
// Return Sun provider.
104
118
// This method should only be called by
105
119
// sun.security.util.ManifestEntryVerifier and java.security.SecureRandom.
@@ -115,7 +129,10 @@ public static Provider getSunProvider() {
115
129
*/
116
130
public static Object startJarVerification () {
117
131
ProviderList currentList = getProviderList ();
118
- ProviderList jarList = currentList .getJarList (jarVerificationProviders );
132
+ ProviderList jarList = currentList .getJarList (
133
+ RestrictedSecurity .isEnabled ()
134
+ ? restrictedJarVerificationProviders
135
+ : jarVerificationProviders );
119
136
if (jarList .getProvider ("SUN" ) == null ) {
120
137
// add backup provider
121
138
Provider p ;
0 commit comments