pdf - Certify XFA document using iTextSharp -
I am using iTextSharp 5.5.2 and I want to certify an XFA document with a digital certificate. My code looks as follows:
PDF reader reader = new PDF reader (path); Filestream OS = new filestream (Dest, Flamemode.ket); PDFStamper Stamper = PDFStamp.CreateExLisation (Reader, OS); XmlSignatureAppearance Presence = stamper.xmlSignatureAppearance; Appearance.SetxmlLocator (new XfaXmlLocator (Stammer)); Appearance.SetxpathConstructor (new XfaXpathConstructor (XfaXpathConstructor.XdpPackage.Datasets)); // Optional line presence. Certificate of certification (micr); Var pk = Org.BouncyCastle.Security.DotNetUtilities.GetKeyPair (myCert.PrivateKey). Private; IExternalSignature pks = New PrivateSignature (PK, Digest Algorithm. SH1); MakeXmlSignature.SignXmlDSig (Presence, PX, GenerateInMyChain);
Unfortunately, when I open PDF after authentication, it will pop up that "Verified operation failed." If I comment on an alternate line related to XfaXpathConstructor, then I get a banner message with the type of PDF, which says "at least one data signature is invalid".
Either way, I open the signature panel and the PDF has not been successfully verified ... What am I missing?
Comments
Post a Comment