我曾尝试用一张智能卡与Node、、chilkat、签署pdf,但都失败了。当我把智能卡安装在我的电脑上时,我发现了这个错误,然后我执行我的代码:我找不到最好的解决方案。
> 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另外:当我运行这段代码时:
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发布于 2022-02-16 17:27:15
我在这里上传了一个新的构建:https://www.npmjs.com/package/@chilkat/ck-node14-win64它是版本“9.50.89-hotfix1 1”。
请试试看。另外,我看到您正在将"TnTrust令牌“传递给LoadFromSmartCard。如果问题仍然存在,请尝试传递一个空字符串。这将导致Chilkat尝试使用默认的Microsoft存储提供程序,这可能会获得更好的成功。
https://stackoverflow.com/questions/71141816
复制相似问题