Javascript 用于数字签名的智能卡选择
我正在编写一个VB6 Windows应用程序,它通过启动一个JS文件对PDF文档进行数字签名,该文件位于Acrobat9.0的Javascripts子文件夹中。现在,我的客户希望将另一个智能卡读卡器插入到承载该应用程序的PC上,并使用其自己的智能卡,该智能卡包含与将签署特定类型文档的第二个人相关的证书 我的问题是:如何通过编程从JavaScript代码中选择我想要的智能卡阅读器? 在我的JavaScript代码中,我执行以下操作:Javascript 用于数字签名的智能卡选择,javascript,pdf,digital-signature,Javascript,Pdf,Digital Signature,我正在编写一个VB6 Windows应用程序,它通过启动一个JS文件对PDF文档进行数字签名,该文件位于Acrobat9.0的Javascripts子文件夹中。现在,我的客户希望将另一个智能卡读卡器插入到承载该应用程序的PC上,并使用其自己的智能卡,该智能卡包含与将签署特定类型文档的第二个人相关的证书 我的问题是:如何通过编程从JavaScript代码中选择我想要的智能卡阅读器? 在我的JavaScript代码中,我执行以下操作: //Initialize the signature h
//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"
}
});
//初始化签名处理程序
var myEngine=security.getHandler(“Adobe.PPKLite”);
//获取可用的证书
var id=myEngine.digitalIDs;
var myCerts=ids.certs;
//查找我要用于签名的证书
对于(var j=0;j请注意,我没有使用Acrobat脚本的经验,但在PKCS中,插槽id是指连接到计算机的智能卡读卡器的id,令牌标签将分配给该插槽/读卡器中的一个智能卡的标签,这可能因PKCS#11实现而异
找到PKCS#11令牌标签的最简单方法是在Firefox浏览器中配置作为安全设备使用的PKCS#11 DLL,并在配置中查看标签字段。但这只是为了让您朝着正确的方向前进
您可以针对PKCS#11编写一个简短的C程序,并使用C#u GetSlotList
和C#u GetSlotInfo
查找插槽id和令牌标签,这就是一个例子。将代码移植到VB应该不会有问题。此外,您还可以使用它来连接PKCS#11 DLL