Print Page | Close Window

Smart card selection for digital signature

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 25 Feb 2020 at 12:28am
Software Version: Web Wiz Forums 11.10 -

Topic: Smart card selection for digital signature
Posted By: Max
Subject: Smart card selection for digital signature
Date Posted: 03 Dec 2015 at 4:22pm
Hi to all,

I am mantaining a VB6 Windows application which digitally signs PDF documents by launching a JS file, located in the Javascripts subfolder of Acrobat 9.0. Now my Customer wants to plug another smart card reader to the PC which hosts the application, with its own smart card containing certificates related to a second person who will sign certain type of documents.

My question is: how can I programmatically choose, from my JavaScript code, the smart card reader I want?
In my JavaScript code I do the following:

//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];

//Log to the signature engine by passing the certificate I want to use to sign //and the slot where the smart card reader containing that certificate 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"

Why do I receive a General Error when executing signatureSign? Which is the correct way to assign the iSlotID parameter when logging to the signature engine or, alternatively, the cTokenLabel parameter?

Thanks in advance for your help and suggestions!

Posted By: paulnevinthomas
Date Posted: 04 Mar 2016 at 12:04pm
Thanks for accessing the website of the Directorate of Commercial Taxes, West Bengal. Now the dealers registered under West Bengal Value Added Tax Act, 2003 will be provided with the Digital Signature Certificate service in website of the Directorate of Commercial Taxes, West Bengal. However, initially this facility is available only to the Registered Dealers who have been selected for the purpose.You can write a short C program against the PKCS#11 and use - -   and C_GetSlotInfoto find out the slot id's and token labels, - - hereis an example of that. It should not be a problem to port that code over to VB. Also there is - NCryptoki  that you can use to interface the PKCS#11 DLL.

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -