푸터 콘텐츠로 바로가기
IRONPDF 사용

x509certificate2 Add Digital Signature to PDF Programmatically

x509certificate2 can be used to get important information about an existing certificate (valid dates, issuer, etc.). IronPDF allows you to digitally sign a PDF using C#. You can create a new document or sign an existing PDF file. It requires just a single line of code, as illustrated in the simple steps below.


Step 1

1. Get IronPDF

First, install IronPDF to your Visual Studio project. Get it in whichever way is easier for you, either from DLL download or on the NuGet website. Access the C# Library in Visual Studio and let's add a signature.

# Product Installation using NuGet
nuget install IronPdf
# Product Installation using NuGet
nuget install IronPdf
SHELL

How to Tutorial

2. Understanding Digital Signatures

A Digital Signature is like an electronic driver's license or passport that proves your identity. A digital ID typically contains your name and email address, the name of the organization that issued it, a serial number, and an expiration date. Digital IDs are used for certificate security and digital signatures. This will need to be created with Adobe Acrobat for it to work.


3. Digitally Sign a PDF

Now, let's see the steps for creating an x509certificate2 to digitally sign a PDF using C#.

Today, the IronPDF library offers a simple way to apply signatures, saving time and effort with just a single line of code. You can use it for free during development to test your work. Then, decide on your project. Will you be creating a new document or signing an existing PDF?

In the code example below, a C# form is used to allow the user to select their desired PDF, which can receive a digital signature with a single click.

A .pfx file (Personal Information Exchange Format) should be prepared, which is used to transfer a certificate with the help of a private key.

The SignPdfFile(FileName) method from the PdfSignature class is the main method for a digital signature. Simply select the desired file.

using System.Drawing;
using System.Windows.Forms;
using IronPdf;

namespace DigitalSign
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent(); 
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            // Open a dialog to select the desired PDF file
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName; // Display selected PDF path in the textbox
            }
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            // Use PdfSignature method to digitally sign the selected PDF
            new PdfSignature("Ironpdf.pfx", "123456").SignPdfFile(textBox1.Text);

            // Provide user feedback that signing is complete
            label3.Text = "Completed!";
            label3.BackColor = Color.LightGreen;
            label3.ForeColor = Color.Black;
        }
    }
}
using System.Drawing;
using System.Windows.Forms;
using IronPdf;

namespace DigitalSign
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent(); 
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            // Open a dialog to select the desired PDF file
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName; // Display selected PDF path in the textbox
            }
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            // Use PdfSignature method to digitally sign the selected PDF
            new PdfSignature("Ironpdf.pfx", "123456").SignPdfFile(textBox1.Text);

            // Provide user feedback that signing is complete
            label3.Text = "Completed!";
            label3.BackColor = Color.LightGreen;
            label3.ForeColor = Color.Black;
        }
    }
}
$vbLabelText   $csharpLabel

The above C# code represents a Windows Form application, where:

  • A button is used to open a file dialog for selecting a PDF file.
  • A second button triggers the signing of the selected PDF using a predefined `.pfx` file and password.
  • Labels are updated to confirm the completion of the signing process.

4. Review Document Signature

As you can see in the output below, as long as a PDF file is selected and the Import Signature button is clicked, it successfully digitally signs the document. With IronPDF, it only took a single line of code.

x509certificate2 Add Digital Signature to PDF Programmatically, Figure 1:


x509certificate2 Add Digital Signature to PDF Programmatically, Figure 2:


IronPDF is the perfect tool for PDF-related tasks using C#. IronPDF offers developers methods to render PDF documents into images and extract text and content from a PDF. Additionally, IronPDF is capable of rendering charts in PDFs, adding barcodes using the IronBarcode library, enhancing security with passwords, watermarking, and even handling PDF forms programmatically.


Library Quick Access

Documentation related to Library Quick Access
### API Reference

Read the IronPDF documentation and full list of functions.

API Reference

자주 묻는 질문

C#에서 프로그래밍 방식으로 PDF에 디지털 서명을 추가하려면 어떻게 해야 하나요?

C#에서 PDF에 디지털 서명을 추가하려면 IronPDF를 사용하세요. 먼저 NuGet을 통해 IronPDF를 설치하거나 DLL을 다운로드합니다. 그런 다음 `x509certificate2` 클래스를 사용하여 인증서를 처리하고 `PdfSignature` 클래스를 사용하여 `.pfx` 파일과 비밀번호로 서명을 적용하고 `SignPdfFile` 메서드를 사용하여 서명을 적용합니다.

PDF에서 디지털 서명의 중요성은 무엇인가요?

PDF의 디지털 서명은 전자여권처럼 발신자의 신원을 확인하여 추가적인 보호 계층을 제공합니다. 문서의 진본성과 무결성을 보장하여 무단 수정을 방지합니다.

IronPDF를 사용하여 PDF에 쉽게 서명할 수 있나요?

예, IronPDF로 PDF에 서명하는 것은 간단합니다. SignPdfFile` 메서드를 사용하여 단 한 줄의 코드만 입력하면 PDF 파일에 디지털 서명을 간편하게 통합할 수 있습니다.

디지털 서명에서 `x509certificate2` 클래스는 어떤 역할을 하나요?

C#의 `x509certificate2` 클래스는 디지털 서명을 적용하는 데 중요한 X.509 인증서를 관리하고 처리하는 데 사용됩니다. 이 클래스는 인증서에 대한 정보를 제공하며 IronPDF와 함께 PDF를 서명하는 데 사용됩니다.

구매하기 전에 IronPDF를 무료로 사용해 볼 수 있나요?

예, 구매 결정을 내리기 전에 디지털 서명을 포함한 기능을 테스트하기 위해 개발 중에 IronPDF를 무료로 사용할 수 있습니다.

디지털 서명을 위해 개인 키가 포함된 인증서를 전송하려면 어떤 파일 형식을 사용해야 하나요?

개인 키가 있는 인증서를 전송할 때는 개인 정보 교환 형식이라고 하는 '.pfx' 파일 형식을 사용합니다.

내 Visual Studio 프로젝트에 IronPDF를 설치하려면 어떻게 하나요?

DLL을 직접 다운로드하거나 NuGet을 사용하여 `nuget install IronPdf` 명령으로 Visual Studio 프로젝트에 IronPDF를 설치하세요.

SignPdfFile` 메서드의 목적은 무엇인가요?

IronPDF의 `SignPdfFile` 메서드는 지정된 인증서와 개인 키로 PDF 파일에 디지털 서명하여 문서의 보안을 강화하는 데 사용됩니다.

IronPDF는 디지털 서명을 추가할 때 .NET 10을 완벽하게 지원하나요?

예. IronPDF는 .NET 10과 완벽하게 호환되며, `PdfSignature`, `x509certificate2`, `Sign` 및 `SignPdfFile` 메서드를 포함한 모든 디지털 서명 기능이 추가 구성 없이 작동합니다. IronPDF는 다른 많은 .NET 버전(예: .NET 9, 8, 7 등) 중 .NET 10을 지원합니다.

IronPDF의 디지털 서명 기능을 사용하기 전에 필요한 전제 조건이나 .NET 버전 요구 사항이 있나요?

IronPDF의 디지털 서명 기능을 사용하려면 .NET 10, .NET 9, .NET Core 및 .NET Standard를 포함한 .NET 버전 5 이상이 필요합니다. 이전 프레임워크 또는 지원되지 않는 버전의 경우 라이브러리가 완전한 호환성을 제공하지 않거나 추가 종속성이 필요할 수 있습니다.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.