是否可以删除前缀“SunPKCS11 11-”?因为我总是得到一个提供者,它的名字是“SunPKCS11 11-智能卡”,而不是"SmartCard“。
这是我的代码:
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);这是我的配置文件:
name = SmartCard
description = configuration file
library =C:\Program Files\Gemalto\Classic Client\BIN\gclib.dll发布于 2017-11-15 15:15:45
正如@EJP所指出的,您不能更改提供程序名称。在创建提供程序实例时,Java会将字符串SunPKCS11-前缀添加到您提供的名称之前。您可以查看有关它的这里文档。
一旦创建了提供程序实例,建议使用Provider.getName()获取名称。
https://stackoverflow.com/questions/47302468
复制相似问题