The Syncfusion .NET PDF Library provides a streamlined solution for adding digital signatures and timestamps to PDF files. It supports various methods for digitally signing PDF documents, including X509 certificates like .pfx files with private keys, hardware security modules (HSM), and Windows store certificates. Additionally, this library ensures authenticity and integrity by supporting the Online Certificate Status Protocol (OCSP), certificate revocation lists (CRL), and the Elliptic Curve Digital Signature Algorithm (ECDSA).
This feature works seamlessly across platforms, including Windows, macOS, Linux, Android, and iOS, through any .NET-based application, such as ASP.NET Core, ASP.NET MVC, Blazor, .NET MAUI, Xamarin, WinForms, WPF, and WinUI.
The below code snippet demonstrates how to digitally sign PDF.
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Security;
using Syncfusion.Pdf;
using Syncfusion.Drawing;
// Create a new PDF document
using (PdfDocument document = new PdfDocument())
{
// Add a new page to the document
PdfPageBase page = document.Pages.Add();
// Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
// Load the certificate from a PFX file with a private key
FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read);
PdfCertificate pdfCert = new PdfCertificate(certificateStream, "password123");
// Create a digital signature
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
// Load the image for the signature field
FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAccess.Read);
PdfBitmap signatureImage = new PdfBitmap(imageStream);
// Set signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am the author of this document.";
// Draw the signature image on the PDF
graphics.DrawImage(
signatureImage, 0, 0);
// Save the document to a file stream
using (FileStream outputFileStream = new FileStream("signed.pdf", FileMode.Create, FileAccess.Write))
{
document.Save(outputFileStream);
}
}
Explore different key functionalities of the digital signature feature.
Customizing the appearance of digital signatures on a PDF page is straightforward for users, allowing them to draw their signature and include signer details. The customization options encompass diverse elements like images, text, and shapes.
Signing a PDF with an LTV signature ensures its validity for the future, even if the root certificate is revoked. To make this work, all essential elements for signature validation must be included.
You can add the date and time of signing to a certificate-based digital signature. This timestamp helps confirm when the PDF was signed, making the signature more reliable.
The default digital signatures generated by the Syncfusion .NET PDF Library follow the CMS standard and use SHA 256 hashing algorithms. Users have the option to switch to the CAdES standard and utilize various hashing algorithms for their digital signatures.
Multiple digital signatures can be added to a single PDF document by appending additional signatures to an already-signed document.
An author signature or certified signature provides a higher level of document control than a normal signature over actions like form filling, comments, and digital signing. This is usually done by the creator of the document before it is published or sent for additional signatures.
Sign PDF documents with an external digital signature created from various sources, such as an HSM, USB tokens, and smart cards, or other cloud services.
Validate digital signatures to ensure the authenticity and integrity of a PDF document. Digital signatures can be validated in any number of PDF documents without human interaction.
Discover valuable resources from our blog and knowledge base about digitally signing PDF documents.
Blog
Knowledge base
Knowledge base
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
A digital signature in a PDF is a way to ensure the integrity and authenticity of the document. It involves using cryptographic techniques to create a unique identifier for the document that can be verified by others.
The process typically involves generating a cryptographic key pair, signing the PDF document using the private key, and then embedding the signature into the PDF file. You would also need to ensure that the necessary certificate is available for signing.
To add a digital signature to a PDF using C#, you’ll need a digital certificate issued by a trusted certificate authority (CA). This certificate will contain a public-private key pair that you’ll use for signing the PDF document.
Using Syncfusion .NET PDF Library, you can easily create a digital signature for a PDF document in C#.
Yes, you can validate a digital signature in a PDF using C# by extracting the signature from the PDF file and then verifying it using the public key associated with the signer’s certificate.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.