I have tried to sign pdf using a smart card with Node JS chilkat but it fails. and I found this error when I put the smart card and install here driver on my computer then I execute my code : I cannot find the best solution
> TnTrust Token ChilkatLog: LoadFromSmartcard(123984ms):
> DllDate: Dec 2 2021
> ChilkatVersion: 9.5.0.89
> UnlockPrefix: Auto unlock for 30-day trial
> Architecture: Little Endian; 64-bit
> Language: Windows Node.js
> VerboseLogging: 1
> NoScminidriver present in UncommonOptions
> chosenCsp: TnTrust Token
> --chooseSmartcardLegacyCsp
> loadFromSmartcard_capi(3078ms):
> loadSmartcardCert:
> kcGetKpCertificate:
> providerName: TnTrust Token
> bExchangeKey: False
> WindowsError: Acc�s refus�.
> WindowsErrorCode: 0x80090010
> --kcGetKpCertificate
> retry with opposite choice...
> kcGetKpCertificate:
> providerName: TnTrust Token
> bExchangeKey: True
> WindowsError: Acc�s refus�.
> WindowsErrorCode: 0x80090010
> --kcGetKpCertificate
> Unable to get the key provider certificate.
> --loadSmartcardCert
> --loadFromSmartcard_capi --LoadFromSmartcard
> --ChilkatLog
also this : [![enter image description here][1]][1] when I run this code :
var pdf = new chilkat.Pdf();
var success = pdf.LoadFile("qa_data/pdf/hello.pdf");
if (success == false) {
console.log(pdf.LastErrorText);
return;
}
var json = new chilkat.JsonObject();
json.UpdateInt("signingCertificateV2",1);
json.UpdateInt("signingTime",1);
json.UpdateInt("page",1);
json.UpdateString("appearance.y","top");
json.UpdateString("appearance.x","left");
json.UpdateString("appearance.fontScale","10.0");
json.UpdateString("appearance.text[0]","Digitally signed by: cert_cn");
json.UpdateString("appearance.text[1]","current_dt");
var cert = new chilkat.Cert();
cert.UncommonOptions = "NoScMinidriver"
cspName = "TnTrust Token";
success = cert.LoadFromSmartcard(cspName)
if (success == false) {
console.log('TnTrust Token',cert.LastErrorText);
return;
}
cert.SmartCardPin = "123456";
success = pdf.SetSigningCert(cert);
if (success == false) {
console.log(pdf.LastErrorText);
return;
}
success = pdf.SignPdf(json,"qa_output/hello_signed_hsm.pdf");
if (success == false) {
console.log(pdf.LastErrorText);
return;
}
console.log("The PDF has been successfully cryptographically signed using an HSM.");
}
chilkatExample();```
thanks.
[1]: https://i.stack.imgur.com/11EwM.png