0

It is possible to delete the prefix "SunPKCS11-"? because always I get a provider whose name is "SunPKCS11-SmartCard" and not "SmartCard" .

this my code :

String configName = "pkcs11.cfg";

Provider p = getInstalledProvider(providerName);
if (p == null)
{ 
    p = new sun.security.pkcs11.SunPKCS11(configName);
}

Security.addProvider(p);
return KeyStore.Builder.newInstance("PKCS11", p, loadProtection);

and this my configuration file :

name = SmartCard
description = configuration file
library =C:\Program Files\Gemalto\Classic Client\BIN\gclib.dll
lgoncalves
  • 2,040
  • 1
  • 14
  • 12
Sabri Mbarek
  • 31
  • 1
  • 12
  • I can get a provider name "SmartCard". unfortunately, I noticed that the provider I created has the name "SunPKCS11-SmartCard". My question: How to remove "SunPKCS11-"? – Sabri Mbarek Nov 15 '17 at 08:31
  • No, because the name of the provider is 'SunPKCS11-SmartCard', not 'SmartCard'. What do you care what the name of the provider is? Prior comment of mine to this effect mysteriously removed, reasons unknown. – user207421 Nov 15 '17 at 10:11

1 Answers1

0

As @EJP pointed, you cannot change the provider name. When you are creating the provider instance, Java prepends the string SunPKCS11-prefix to the name you provide. You can look at the Java documentation about it here.

Once you have created your provider instance, it is recommended to get the name using the Provider.getName().

always_a_rookie
  • 4,515
  • 1
  • 25
  • 46