pdf文件上的不同类型的签名

Different types of signature on pdf file

我使用此代码签署 pdf 文件(我使用 itextsharp):

            Org.BouncyCastle.X509.X509CertificateParser cp = new Org.BouncyCastle.X509.X509CertificateParser();
            Org.BouncyCastle.X509.X509Certificate[] chain = new Org.BouncyCastle.X509.X509Certificate[] { cp.ReadCertificate(cert.RawData) };
            IExternalSignature externalSignature = new X509Certificate2Signature(cert, "SHA-256");
            PdfReader pdfReader = new PdfReader("testin.pdf");
            FileStream signedPdf = new FileStream("testout.pdf", FileMode.Create);  
            PdfStamper pdfStamper = PdfStamper.CreateSignature(pdfReader, signedPdf, '[=10=]');
            PdfSignatureAppearance signatureAppearance = pdfStamper.SignatureAppearance;
            signatureAppearance.Reason = "Sign pdf";
            signatureAppearance.Location = "Location test";
            signatureAppearance.SignatureRenderingMode = PdfSignatureAppearance.RenderingMode.DESCRIPTION;
            MakeSignature.SignDetached(signatureAppearance, externalSignature, chain, null, null, null, 0, CryptoStandard.CMS);
            signedPdf.Close();

一切正常,这是我用 Acrobat 打开文件时看到的 Reader (*IMG1):

现在我得到了其他人签名的 pdf,并在页面末尾显示了这个 (*IMG2):

点击签名打开属性 (*IMG3):

这些属性与之前的有点不同,插入了我的签名,但除此之外,我想知道为什么我的签名在侧面板中,而不是我在其他文件中找到的签名是位于页面底部,立即可见。 如何在如图所示的页面上显示我的签名 (*IMG2)?

I would like to know why my signature goes in the side panel and instead the one I find in the other files is located at the bottom of the page and is visible immediately. How can I show my signature on the page as shown in the image (*IMG2)?

您的签名在文档中没有可视化,因为您将其创建为不可见签名(firma invisibile)!如果你想创建一个可见的签名,你必须告诉 iText 该可视化应该去哪里。您可以使用 PdfSignatureAppearance 方法 SetVisibleSignature:

PdfSignatureAppearance signatureAppearance = pdfStamper.SignatureAppearance;
signatureAppearance.SetVisibleSignature(new iTextSharp.text.Rectangle(20, 10, 170, 60), 1, "FieldName");

不过,请注意您显示的图片

这个绿色勾号看起来可能使用了 Adob​​e Acrobat 功能,该功能已于 2003 年弃用,并在 ETSI TS 102 778-6 和 ISO 32000-2 中被禁止,签名验证结果的显示在文档内签名可视化。

这样的签名最终可能会被认为可疑甚至无效