我正在尝试使用比利时的eID令牌签署一系列(数千份)PDF,同时只询问用户的PIN码。将我的引脚作为函数的参数给出了一些错误:
Dim pin As String = "1234"
Using pkcs11rsaSignature As Pkcs11RsaSignature = New Pkcs11RsaSignature(librarypath, tokenserial, tokenlabel, pin, ckalabel, ckaId, Net.Pkcs11Interop.PDF.HashAlgorithm.SHA1)
Dim signingCertificate = pkcs11rsaSignature.GetSigningCertificate()
Dim otherCertificates = pkcs11rsaSignature.GetAllCertificates()
Dim certPath = CertUtils.BuildCertPath(signingCertificate, otherCertificates)
Using pdfreader As PdfReader = New PdfReader(unsignedPdfPath)
Using outputstream As FileStream = New FileStream(signedPdfPath, FileMode.Create)
Using PdfStamper As PdfStamper = PdfStamper.CreateSignature(pdfreader, outputstream, "0"c, Path.GetTempFileName(), True)
MakeSignature.SignDetached(PdfStamper.SignatureAppearance, pkcs11rsaSignature, certPath, Nothing, Nothing, Nothing, 0, CryptoStandard.CADES)
End Using
End Using
End Using
End Using
我正在使用此代码,但获取FormatException:找不到可识别的数字。我怎样才能解决我的问题?
bdebaere
答案 0 :(得分:0)
您可以安全地重用Pkcs11RsaSignature
类的单个实例来创建多个签名。请查看Pkcs11RsaSignatureReuseTest,其中包含100个PDF文档。
答案 1 :(得分:0)
由于法律要求,比利时eID中间件强制每个签名操作都有一个PIN对话框。