These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How can I sign a document using a "ID Card" (PKCS#11 Device)

Fornachari
Registered: Mar 11 2008
Posts: 8

Hi everybody!

I searched a lot in the internet and in the Acrobat Documentation to how use the acrobat sdk and javascript to sign a document using a certificate stored in a smartcard.
When I use a smart card (PKCS#11 Device) inside the Acrobat, it recognises the smart card and I can sign de document using the card (no PFX certificates are needed).
When I plug the card in my pc, appears in the "Windows Certificate Store" the certificate that are stored in the card. So, using Javascript I found the serial number of the certicate stored in the smart card (I'm sure that the serial number is correct), and I tried to use it and Javascript to sign a pdf document, like below:

var myEngine = security.getHandler("Adobe.PPKLite");
var oCerts = myEngine.digitalIDs.certs;
var serial = "XXXXXX"; //serial number of the certificat that I am looking for in the "Windows Cert Store"
var iSerial;

//search in the windows store certificate for a certificate with the serial number informed
for (var i=0; i < oCerts.length; i++)
{
if (oCerts[i].serialNumber == serial)
iSerial=i;
}

console.println("Signing using the certificate: "+oCerts[iSerial]);

myEngine.login( {oParams:{oEndUserSignCert: oCerts[iSerial] , cPassword: "MyPassword"}});
var f = this.getField("SignHere");

f.signatureSign( myEngine,
{password: "MyPassword",// provide password
location: "Local",
reason: "Any reason",
contactInfo: "555-5555",
appearance: "MyApperance"});

The code above can't loggin the certificate, the problem is that the password is ignored by the code, and I don't know why.
I did a test, if I pass a path of any other PFX certificate in my pc instead of the object certificate (oCerts[iSerial]) the code above works fine: read the password and can loggin the certificate. But i really need to use the smart card to sign the document.

Any help, any idea, please??
Am I in the right way?

Thanks all in advance!

My Product Information:
Acrobat Pro 8.1, Windows
Fornachari
Registered: Mar 11 2008
Posts: 8
Please!!!