javasignpkcs#11gemalto

PKCS11 - Delete prefix "SunPKCS11-"?


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

Solution

  • 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().