我正试图在我的web应用程序中使用applet来使用智能卡加密一些数据。我正在遵循以下链接:http://www.developer.com/java/other/article.php/3587361/Java-Applet-for-Signing-with-a-Smart-Card.htm
我能够读取存储在智能卡中的证书,并使用证书加密数据。但是它要求我传递PKCS#11实现库文件(.dll)和智能卡引脚的位置。
我的功能需求是从连接到系统的单个(或多个)智能卡加载证书列表,而不传递任何.dll文件。当然,当用户选择要签名的证书时,他/她将输入PIN。
是否可以在不传递PKCS#11实现库文件(.dll)位置的情况下从智能卡提取证书详细信息?
执行情况:
PKCS11LibraryFileAndPINCodeDialog localPKCS11LibraryFileAndPINCodeDialog = new PKCS11LibraryFileAndPINCodeDialog();
boolean bool;
try {
bool = localPKCS11LibraryFileAndPINCodeDialog.run();
}
finally
{
localPKCS11LibraryFileAndPINCodeDialog.dispose();
}
if (bool)
{
String str2 = this.mSignButton.getLabel();
this.mSignButton.setLabel("Working...");
this.mSignButton.setEnabled(false);
try
{
String str3 = localPKCS11LibraryFileAndPINCodeDialog.getLibraryFileName();
String str4 = localPKCS11LibraryFileAndPINCodeDialog.getSmartCardPINCode();
SmartCardSignerApplet.CertificationChainAndSignatureBase64 localCertificationChainAndSignatureBase641 = signDocument(arrayOfByte, str3, str4);
}发布于 2015-03-13 14:30:38
简短的回答是“不”。在与智能卡交互时,Java只是将PKCS#11请求传递给实际与智能卡交互的.dll文件,因此您需要提供这个.dll文件来与智能卡进行交互并读取证书。
在没有.dll文件的情况下,您可能可以这样做,但我认为这相当于自己重写.dll代码。我的理解是,不同的智能卡具有不同的API,用于访问它们的.dll文件提供了标准的PKCS#11 API,因此,用于智能卡访问的Java库不是实现所有智能卡API,而是使用由.dll文件提供的PKCS#11接口。
发布于 2021-12-18 06:14:27
对于在2021年或以后的7年后登陆这里的人,对于现代浏览器来说,可以使用浏览器扩展,而浏览器扩展反过来又使用本地主机应用程序访问本地证书存储,后者使用CSP连接到智能卡,您不需要指定PKCS#11库。有关加密、解密和其他API,请参考Stacks Overflow Answer。
https://stackoverflow.com/questions/25360749
复制相似问题