我将Siemens的CardOS API驱动程序用作PKCS#11驱动程序,以从PKI卡加载证书,如下所示:
char[] pin = "123456".toCharArray();
KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(pin);
KeyStore keyStore = KeyStore.Builder.newInstance("PKCS11", Security.getProvider("SunPKCS11-verinice"), pp).getKeyStore();
keyStore.load(null,pin);
keyStore.getKey("key 1", pin);
keyStore.getKey("key 2", pin);
尽管我将其作为参数传递,但驱动程序会提示您为每个密钥提供一个PIN。还有其他方法可以通过API传递PIN吗?我可以激活任何“PIN缓存”吗?
最佳答案
我也在使用CardOS和Siemens卡。
卡上有两个PIN。
在大多数情况下,两个PIN是相同的(否则用户会感到困惑)。
我也有没有签名PIN的卡。这样,我可以签名而无需其他PIN输入。也许您可以删除签名PIN或获取没有签名PIN的卡。