RFR 8130302: jarsigner and keytool -providerClass needs be re-examined for modules

Wang Weijun weijun.wang at oracle.com
Sun Jun 12 12:44:57 UTC 2016


I was about to send out a new webrev (CCC just approved) but noticed a behavior change.

Although "-addprovider SUN" is useless it still worked when I posted webrev.03, but now it failed, because ServiceLoader.load(Provider.class) does not contain "SUN" anymore. Maybe it is inside java.base and loaded in a shortcut mode?

Therefore I am looking to add some extra lines into the following method:

   public static void loadProviderByName(String provName, String arg) {
+       Provider loaded = Security.getProvider(provName);
+       if (loaded != null) {
+           if (arg != null) {
+               loaded = loaded.configure(arg);
+               Security.addProvider(loaded);
+           }
+           return;
+       }
       for (Provider p : ServiceLoader.load(Provider.class)) {
           if (p.getName().equals(provName)) {
               if (arg != null) {
                   p = p.configure(arg);
               }
               Security.addProvider(p);
               return;
           }
       }
       throw new IllegalArgumentException();
   }

Although it might not be worth supporting "-addprovider SUN", but suppose one day we have a provider inside java.base that requires an argument, this would be useful.

If you are OK with this, I will send out a webrev.04 soon.

Thanks
Max

> On Feb 23, 2016, at 11:28 AM, Wang Weijun <weijun.wang at oracle.com> wrote:
> 
> Webrev updated at http://cr.openjdk.java.net/~weijun/8130302/webrev.03/.
> 
> -provider and loadProviderByName() are useless for jdk9/dev, and loadProviderByClass() only uses reflection.
> 
> The SunPKCS11 compatibility line will be add in a sub-patch for jake.
> 
> --Max




More information about the security-dev mailing list