我正在管理一个PDF应用程序,它通过启动一个JS文件来对VB6文档进行数字签名,该文件位于Acrobat9.0的JavaScript子文件夹中。现在,我的客户想要将另一个智能卡读卡器插入托管应用程序的PC,该读卡器具有自己的智能卡,其中包含与将签署特定类型文档的第二人相关的证书。
我的问题是:我如何通过编程方式从我的JavaScript代码中选择我想要的智能卡读卡器?在我的JavaScript代码中,我执行以下操作:
//Initialize the signature handler
var myEngine = security.getHandler("Adobe.PPKLite");
//Obtain the available certificates
var ids = myEngine.digitalIDs;
var myCerts = ids.certs;
//Find the certificate I want to use to sign
for(var j=0; j<myCerts.length; j++)
{
if(myCerts[j].subjectCN == "SMITH JOHN")
{
oCert = myCerts[j];
break;
}
}
//Log to the signature engine by passing the certificate I want to use
//and the slot where the corresponding smart card reader is plugged
myEngine.login( { oParams: { cDIPath: ACROSDK.sigDigitalIDPath,
cPassword: ACROSDK.sigUserPwd,
iSlotID: 1,
oEndUserSignCert: oCert
}
} );
//Digitally sign the document with the certificate I chose
sigField.signatureSign({oSig: myEngine,
bUI: false,
oInfo: { password: ACROSDK.sigUserPwd,
location: ACROSDK.sigLocation,
reason: ACROSDK.sigReason,
contactInfo: ACROSDK.sigContactInfo,
appearance: "FirmaRPPR"
}
});为什么在执行signatureSign时收到一般错误?在记录到签名引擎或cTokenLabel参数时,分配iSlotID参数的正确方式是什么?
提前感谢您的帮助和建议!
发布于 2015-12-04 04:08:28
请注意,我没有使用PKCS#11脚本的经验,但在Acrobat中,插槽id指的是连接到计算机的智能卡读卡器的id,令牌标签将被分配给插槽/读卡器中的一个智能车,这可能会因Acrobat实现而异。
找出PKCS#11令牌标签的最简单方法是在Firefox浏览器中配置您用作安全设备的PKCS#11动态链接库,并查看配置中的标签字段。但这只是为了让你朝着正确的方向前进。
您可以针对PKCS#11编写一个简短的C程序,然后使用C_GetSlotList和C_GetSlotInfo找出插槽id和令牌标签,here就是一个这样的例子。将代码移植到VB应该不是问题。此外,还可以使用NCryptoki作为PKCS#11动态链接库的接口。
https://stackoverflow.com/questions/34071711
复制相似问题