Products Technologies Demo Docs Blog Support Company

Sign Documents with a Self-Signed Digital ID From Adobe Acrobat Reader in .NET C#

This article shows how to create a self-signed digital ID using Adobe Acrobat Reader and how to use it to sign documents in .NET C#. The article also shows how to create a PDF document with a signature field that can be signed using the created digital ID.

Sign Documents with a Self-Signed Digital ID From Adobe Acrobat Reader in .NET C#

TX Text Control provides all the necessary components to create and deploy documents in various formats, including MS Word DOCX, to capture electronic signatures and digitally sign these finished documents. To sign a document, a valid certificate is required that can be obtained by trust centers or certificate authorities. The certificate is used to sign the document and to verify the signature. The signature is embedded in the document and can be verified by any recipient of the document.

Self-Signed Certificates

For testing purposes, you can create a self-signed certificate using the following PowerShell command in Windows:

New-SelfSignedCertificate -Type Custom -Subject "CN=Text Control, O=Text Control, C=US" -KeyUsage DigitalSignature -FriendlyName "TextControlSelf" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")

If you are interested in learning more about this, the whole process is explained in another article.

Learn More

TX Text Control can be used to digitally sign PDF and PDF/A documents with X.509 certificates. This article describes how to create a self-signed certificate and how to use it to sign documents.

Digitally Sign PDF/A Documents with Self-Signed Certificates

Adobe Digital IDs

This article focuses on using Adobe digital IDs to sign documents that can be viewed as valid when opened in Acrobat Reader. A digital ID is a unique identifier that is used to sign documents. It is a digital certificate that includes a private key and a public key. The private key is used to sign the document and the public key is used to verify the signature. The digital ID is stored in a file with the extension *.pfx which can be directly used in TX Text Control to sign documents.

Creating a Digital ID

Adobe Acrobat can be used to create a digital ID.

  1. Open Acrobat Reader and choose Preferences from the main menu.

    Acrobat Reader Digital ID

  2. In the Preferences dialog, choose Signatures and click on More... in the Identities & Trusted Certificates section.

    Acrobat Reader Digital ID

  3. In the Identities & Trusted Certificates dialog, click the Add icon to create a new digital ID.

    Acrobat Reader Digital ID

  4. Choose A new digital ID I want to create now and click Next.
  5. Choose New PKCS#12 digital ID file and click Next.
  6. Enter your personal information, choose Digital Signatures for Use digital ID for and click Next.

    Acrobat Reader Digital ID

  7. Select the location where the digital ID should be saved and enter a password to protect the digital ID. Click Finish.

    Acrobat Reader Digital ID

The *.pfx should have been created and saved to the specified location. This file can be used to sign documents in TX Text Control.

Signing a Document

A .NET 8 console application is created for the purposes of this demo.

Prerequisites

The following tutorial requires a trial version of TX Text Control .NET Server.

Creating the Application

  1. In Visual Studio, create a new Console App using .NET 8.

  2. In the Solution Explorer, select your created project and choose Manage NuGet Packages... from the Project main menu.

    Select Text Control Offline Packages from the Package source drop-down.

    Install the latest versions of the following package:

    • TXTextControl.TextControl.ASP.SDK

    Create PDF

Adding the Code

  1. Create a new folder in your project called data and copy the *.pfx file into this folder.
  2. Copy any document that you want to sign into the data folder.
  3. Add the following code to your Program.cs file:
    using System.Security.Cryptography.X509Certificates;
    using TXTextControl;
    
    using (ServerTextControl tx = new ServerTextControl())
    {
        tx.Create();
    
        // load the document
        tx.Load("data/document.docx", StreamType.WordprocessingML);
    
        SaveSettings saveSettings = new SaveSettings()
        {
            DigitalSignature = new DigitalSignature(
                new X509Certificate2("data/TimTyper.pfx", "TimTyper$TX"), null)
        };
    
        tx.Save("data/signed.pdf", StreamType.AdobePDFA, saveSettings);
    }

Running the Application

Run the application and the signed document will be saved in the same folder as the original document. Opened in Acrobat Reader, the document will show the signature as valid.

Create PDF

This code signs the complete document. It is also possible to sign individual signature fields in a document. This is explained in another article.

Learn More

With TX Text Control, adding digital and electronic signatures to documents is a simple task. This article shows how to sign the entire document with a digital certificate and how to sign individual signature fields.

Adding Digital Signatures to PDF Documents in C#

Conclusion

Using Adobe digital IDs to sign documents is an easy and secure way to test the integration of digital signatures in your applications. TX Text Control provides a simple, but complete API to sign documents with digital certificates.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETASP.NET CoreDOCX

Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux

This article explains how to use TX Text Control .NET Server to convert a Microsoft Word DOCX document to a PDF file on a Linux system using .NET C#. This conversion process includes text reflow,…


ASP.NETASP.NET CoreDOCX

Use MailMerge in .NET on Linux to Generate Pixel-Perfect PDFs from DOCX…

This article explores how to use the TX Text Control MailMerge feature in .NET applications on Linux to generate pixel-perfect PDFs from DOCX templates. This powerful combination enables…


ASP.NETASP.NET CoreConvert

Programmatically Convert MS Word DOCX Documents to PDF in .NET C#

This article shows how to convert MS Word DOCX documents to PDF in .NET C# using the ServerTextControl component. The example shows how to load a DOCX file from a file or from a variable and how…


ASP.NETASP.NET CoreElectronic Signature

Whitepaper: Integrate On-Premise Electronic Signature Processes into Web…

We published a whitepaper that gives an overview of how to integrate on-premises electronic signature processes into web applications. Download the full whitepaper and learn how Text Control can…


ASP.NETASP.NET CoreDOCX

Why HTML is not a Substitute for Page-Oriented Formats like DOCX

In this blog post, we will discuss the limitations of HTML as a document format and explain why page-oriented formats, such as DOCX, remain essential for certain use cases. We will explore the…