I am trying to test your api in order to sign pdf files with a certificate and LTV enabled. I think I didn't quite understand how it works. I get the message "Spire.Pdf.Exceptions.PdfException: 'lost private key.'" at line
- Code: Select all
doc.SaveToFile(aFullSignedFilePath)
The code I am using is:
- Code: Select all
Dim page As PdfPageBase = doc.Pages(0)
certificate = ReturnSelectedCertificate()
Dim bytecertificate As Byte() = certificate.Export(X509ContentType.Cert, "test")
Dim cert As New PdfCertificate(bytecertificate, "test")
Dim signature As PdfSignature = New PdfSignature(doc, page, cert, "demo")
signature.ContactInfo = "K********s"
signature.Certificated = True
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges
signature.ConfigureHttpOCSP(Nothing, Nothing)
doc.SaveToFile(aFullSignedFilePath)