IronPDFを使用してC#でPDFファイルに署名する方法 | IronPDFチュートリアル

C#でPDFにデジタル署名するための開発者ガイド

This article was translated from English: Does it need improvement?
Translated
View the article in English

この包括的なガイドでは、C#の開発者がIronPDFを使ってPDFにデジタル署名をする方法を紹介し、証明書ベースの署名、ビジュアルスタンプ、文書の信頼性とセキュリティを確保するためのインタラクティブなフォームフィールドについて説明します。

PDFドキュメントに署名を追加することは、多くのアプリケーションにおいて一般的な要件ですが、"署名"はさまざまな意味を持つことがあります。 一部の人にとっては、セキュリティ証明書を使用して改ざん防止のデジタル署名を適用することを意味します。 他の人にとっては、書面や手書きの署名画像をドキュメントにスタンプしたり、ユーザーが電子的に署名するためのインタラクティブなフォームフィールドを追加したりすることを意味するかもしれません。

このガイドは、IronPDF for .NETライブラリを使用してこれらのタスクすべてを達成するためのC#開発者向けの包括的なウォークスルーを提供します。 私たちは、X509Certificate2デジタル署名の適用からグラフィカル署名のスタンプ、インタラクティブ署名フィールドの作成まで、PDFドキュメントが本物で、安全で、プロフェッショナルであることを保証するためにすべてをカバーします。

クイックスタート:IronPDFを使用して簡単にPDFをデジタル署名する

IronPDFを使用してPDFドキュメントにデジタル署名するためのシンプルで直感的なプロセスで迅速に開始できます。 .pfx証明書を使用してPDFファイルを認証し署名し、ドキュメントの整合性と信憑性を保証する方法を示しています。 以下の手順に従って、アプリケーションにデジタル署名をシームレスに統合してください。

Nuget Icon今すぐ NuGet で PDF を作成してみましょう:

  1. NuGet パッケージ マネージャーを使用して IronPDF をインストールします

    PM > Install-Package IronPdf

  2. このコード スニペットをコピーして実行します。

    new IronPdf.Signing.PdfSignature("certificate.pfx", "password").SignPdfFile("input.pdf");
  3. 実際の環境でテストするためにデプロイする

    今すぐ無料トライアルでプロジェクトに IronPDF を使い始めましょう
    arrow pointer

証明書を使用してPDFにデジタル署名を適用するにはどうすればよいですか?

.pfx.p12などのデジタル証明書ファイルを使用してPDFドキュメントにデジタル署名を適用し、ドキュメントの真実性と整合性を保証できます。 このプロセスは、署名されてからドキュメントが変更されていないことを保証します。 デジタル署名機能の完全な概要については、包括的なデジタル署名ガイドをご覧ください。

IronPDFはこの目的のためのシンプルなAPIを提供し、デジタル署名を適用するための複数の方法をサポートしています。 この機能の核となるのはPdfSignatureクラスであり、証明書と署名に関連するすべてのメタデータを含んでいます。

署名方法翻訳内容
<コード>サインPdfSignatureオブジェクトでPDFに署名します。
<コード>SignWithFileディスク上にある電子署名証明書ファイル(.pfxまたは.p12)を使ってPDFに署名します。
<コード>SignWithStore拇印IDで識別される、コンピュータの証明書ストアからのデジタル署名でPDFに署名します。

X509Certificate2オブジェクトを使用する

最大の制御を得るために、証明書ファイルからX509Certificate2オブジェクトを作成できます。IronPDFはX509Certificate2標準に完全に準拠し、デジタル署名実装のための堅牢で安全な方法を提供します。 証明書オブジェクトを作成するときは、X509KeyStorageFlagsExportableに設定されていることを確認してください。実用的なデジタル署名の例をコード・リポジトリでチェックしてください。

Install-Package IronPdf
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Create a new PDF from an HTML string for demonstration.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Signed Document</h1><p>This document has been digitally signed.</p>");

// Load the certificate from a .pfx file with its password.
// The X509KeyStorageFlags.Exportable flag is crucial for allowing the private key to be used in the signing process.
var cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create a PdfSignature object using the loaded certificate.
var signature = new PdfSignature(cert);

// Apply the signature to the PDF document.
pdf.Sign(signature);

// Save the securely signed PDF document.
pdf.SaveAs("Signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Create a new PDF from an HTML string for demonstration.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Signed Document</h1><p>This document has been digitally signed.</p>");

// Load the certificate from a .pfx file with its password.
// The X509KeyStorageFlags.Exportable flag is crucial for allowing the private key to be used in the signing process.
var cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create a PdfSignature object using the loaded certificate.
var signature = new PdfSignature(cert);

// Apply the signature to the PDF document.
pdf.Sign(signature);

// Save the securely signed PDF document.
pdf.SaveAs("Signed.pdf");
$vbLabelText   $csharpLabel

上記のコードは、最初にシンプルなPDFを生成します。 その後、.pfx証明書ファイルをX509Certificate2オブジェクトに読み込みます。 このオブジェクトはデジタルアイデンティティを表し、PdfSignatureコンストラクタに渡されます。 最後に、pdf.Signメソッドがこの署名をドキュメントに適用し、保存します。 For more information on the X509Certificate2 class, you can refer to the official Microsoft documentation.

デジタル署名に詳細を追加する

デジタル署名には証明書だけでなく、リッチなメタデータを埋め込むことができます。 これには署名の場所、理由、連絡先情報、信頼できる機関からのタイムスタンプが含まれます。 これにより、文書の監査証跡が改善され、検証者に貴重な情報が提供されます。 また、set and edit metadata for additional document properties(メタデータの設定と編集)も可能です。

IronPDFはまた、最新のSHA256およびSHA512ハッシュアルゴリズムを使用したタイムスタンピングサーバーもサポートしています。 IronPDFは、現代のSHA256およびSHA512ハッシュアルゴリズムを使用するタイムスタンプサーバーもサポートしています。

using IronPdf;
using IronPdf.Signing;
using IronSoftware.Drawing;
using System;

// Load an existing PDF document to be signed.
var pdf = PdfDocument.FromFile("invoice.pdf");

// Create a PdfSignature object directly from the certificate file and password.
var signature = new PdfSignature("IronSoftware.pfx", "123456");

// Add detailed metadata to the signature for a comprehensive audit trail.
// These properties enhance the signature's credibility and provide context
signature.SignatureDate = DateTime.Now;
signature.SigningContact = "legal@ironsoftware.com";
signature.SigningLocation = "Chicago, USA";
signature.SigningReason = "Contractual Agreement";

// Add a secure timestamp from a trusted Time Stamp Authority (TSA).
// This provides cryptographic proof of the signing time.
signature.TimeStampUrl = new Uri("[http://timestamp.digicert.com](http://timestamp.digicert.com)");
signature.TimestampHashAlgorithm = TimestampHashAlgorithms.SHA256;

// Apply a visual appearance to the signature. (More on this in the next section)
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, new Rectangle(350, 750, 200, 100));

// Sign the PDF document with the configured signature object.
pdf.Sign(signature);

// Save the final, signed PDF document.
pdf.SaveAs("DetailedSignature.pdf");
using IronPdf;
using IronPdf.Signing;
using IronSoftware.Drawing;
using System;

// Load an existing PDF document to be signed.
var pdf = PdfDocument.FromFile("invoice.pdf");

// Create a PdfSignature object directly from the certificate file and password.
var signature = new PdfSignature("IronSoftware.pfx", "123456");

// Add detailed metadata to the signature for a comprehensive audit trail.
// These properties enhance the signature's credibility and provide context
signature.SignatureDate = DateTime.Now;
signature.SigningContact = "legal@ironsoftware.com";
signature.SigningLocation = "Chicago, USA";
signature.SigningReason = "Contractual Agreement";

// Add a secure timestamp from a trusted Time Stamp Authority (TSA).
// This provides cryptographic proof of the signing time.
signature.TimeStampUrl = new Uri("[http://timestamp.digicert.com](http://timestamp.digicert.com)");
signature.TimestampHashAlgorithm = TimestampHashAlgorithms.SHA256;

// Apply a visual appearance to the signature. (More on this in the next section)
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, new Rectangle(350, 750, 200, 100));

// Sign the PDF document with the configured signature object.
pdf.Sign(signature);

// Save the final, signed PDF document.
pdf.SaveAs("DetailedSignature.pdf");
$vbLabelText   $csharpLabel

緑のチェックマークを得るには、証明書をビューアの信頼されたIDに追加する必要があります。 緑のチェックマークを得るためには、証明書をビューワの信頼されたアイデンティティに追加する必要があります。

デジタル署名に視覚的表現を追加するにはどうすればよいですか?

デジタル署名はPDFに暗号的に埋め込まれていますが、ページ上に視覚的表現を持つことはしばしば便利です。 これは、不可視の暗号的セキュリティと見えるドキュメント承認のギャップを埋めます。 IronPDFを使用すると、PdfSignatureオブジェクトに画像を追加するのが簡単です。

サポートされている画像フォーマットにはPNG、JPEG、GIF、BMP、TIFF、WebPがあります。 サポートしている画像形式は、PNG、JPEG、GIF、BMP、TIFF、WebPです。このテクニックは、PDF文書にテキストや画像をスタンプする方法に似ています。

using IronPdf.Signing;
using IronSoftware.Drawing;

// This example demonstrates various ways to add a visual image to a PDF signature.

// Create a PdfSignature object.
var signature = new PdfSignature("IronSoftware.pfx", "123456");

// Define the position and size for the signature image on the first page (index 0).
// Rectangle parameters: x position, y position, width, height
var signatureRectangle = new Rectangle(350, 750, 200, 100);

// Option 1: Set the SignatureImage property directly.
// This is the most straightforward approach
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, signatureRectangle);

// Option 2: Use the LoadSignatureImageFromFile method.
// This method provides the same functionality with a different syntax
signature.LoadSignatureImageFromFile("assets/visual-signature.png", 0, signatureRectangle);

// Option 3: Load an image from a stream. This is useful for images generated in memory.
// Perfect for scenarios where images are retrieved from databases or web services
AnyBitmap image = AnyBitmap.FromFile("assets/visual-signature.png");
using (var imageStream = image.ToStream())
{
    signature.LoadSignatureImageFromStream(imageStream, 0, signatureRectangle);
}

// After configuring the signature image, apply it to a PDF.
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.Sign(signature);
pdf.SaveAs("VisualSignature.pdf");
using IronPdf.Signing;
using IronSoftware.Drawing;

// This example demonstrates various ways to add a visual image to a PDF signature.

// Create a PdfSignature object.
var signature = new PdfSignature("IronSoftware.pfx", "123456");

// Define the position and size for the signature image on the first page (index 0).
// Rectangle parameters: x position, y position, width, height
var signatureRectangle = new Rectangle(350, 750, 200, 100);

// Option 1: Set the SignatureImage property directly.
// This is the most straightforward approach
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, signatureRectangle);

// Option 2: Use the LoadSignatureImageFromFile method.
// This method provides the same functionality with a different syntax
signature.LoadSignatureImageFromFile("assets/visual-signature.png", 0, signatureRectangle);

// Option 3: Load an image from a stream. This is useful for images generated in memory.
// Perfect for scenarios where images are retrieved from databases or web services
AnyBitmap image = AnyBitmap.FromFile("assets/visual-signature.png");
using (var imageStream = image.ToStream())
{
    signature.LoadSignatureImageFromStream(imageStream, 0, signatureRectangle);
}

// After configuring the signature image, apply it to a PDF.
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.Sign(signature);
pdf.SaveAs("VisualSignature.pdf");
$vbLabelText   $csharpLabel

ディスク上やメモリ上に画像を持っている場合でも、簡単にそれをPDFにスタンプとして押すことができます。 これにより、不可視の暗号的セキュリティと可視的なドキュメント承認との間のギャップが埋まります。 ## 署名後にドキュメントの権限を制御するにはどうすればよいですか?

署名後に文書の権限を制御するにはどうすればよいですか?

たとえば、ドキュメントを完全にロックしたり、ユーザーがフォームフィールドに入力することのみを許可したりするかもしれません。 これは、文書が複数の承認ステージを経るワークフローにおいて重要です。 IronPDFでは、SignaturePermissions列挙体を使用してこれらの権限を設定できます。 より高度な権限制御については、setting PDF passwords and permissionsのガイドをご覧ください。

それにより、署名が適用された後のドキュメントの整合性があなたのルールに従って維持されます。 ユーザーが許可されていないアクションを実行した場合、署名は無効になります。 ユーザーが許可されていないアクションを実行した場合、その署名は無効になります。

SignaturePermissionsメンバ定義
変更を許可しないいかなる変更も許されません。文書は事実上ロックされています。
<コード>FormFillingAllowed既存のフォームフィールドへの入力と署名のみ可能です。
AnnotationsAndFormFillingAllowedフォーム入力、署名、注釈の作成または変更が可能です。

Saving and Signing a Specific PDF Revision

PDFs can store a history of changes, much like a version control system. This is known as incremental saving. When you sign a PDF, the signature applies to a specific revision of the document. This is crucial for workflows where a document goes through multiple stages of approval. Learn more about managing PDF revision history in our detailed guide.

In the following example, we load a PDF, make edits, and then sign the current revision while allowing only form-filling as a future change. We use SaveAsRevision to commit the current state to the document's history before saving the file.

using IronPdf.Signing;

// Load a PDF file with change tracking enabled.
// This enables incremental save functionality for revision management
var pdf = PdfDocument.FromFile("annual_census.pdf", ChangeTrackingModes.EnableChangeTracking);

// Placeholder for edits: You might add text, fill forms, or add annotations here.
// For example: pdf.Annotations.Add(new TextAnnotation(...));
// Or: pdf.Form["fieldName"].Value = "New Value";

// Sign the current state of the document using SignWithFile for convenience.
// We set permissions to allow further signatures and form filling.
pdf.SignWithFile(
    "assets/IronSignature.p12", 
    "password", 
    SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);

// Save the current state as a distinct revision within the PDF's history.
// This creates a snapshot that can be referenced later
PdfDocument pdfWithRevision = pdf.SaveAsRevision();

// Save the final PDF with its full revision history to a new file.
pdfWithRevision.SaveAs("annual_census_signed.pdf");
using IronPdf.Signing;

// Load a PDF file with change tracking enabled.
// This enables incremental save functionality for revision management
var pdf = PdfDocument.FromFile("annual_census.pdf", ChangeTrackingModes.EnableChangeTracking);

// Placeholder for edits: You might add text, fill forms, or add annotations here.
// For example: pdf.Annotations.Add(new TextAnnotation(...));
// Or: pdf.Form["fieldName"].Value = "New Value";

// Sign the current state of the document using SignWithFile for convenience.
// We set permissions to allow further signatures and form filling.
pdf.SignWithFile(
    "assets/IronSignature.p12", 
    "password", 
    SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);

// Save the current state as a distinct revision within the PDF's history.
// This creates a snapshot that can be referenced later
PdfDocument pdfWithRevision = pdf.SaveAsRevision();

// Save the final PDF with its full revision history to a new file.
pdfWithRevision.SaveAs("annual_census_signed.pdf");
$vbLabelText   $csharpLabel

Understanding incremental saves is key to advanced PDF workflows. While a simple viewer might only show the latest version, a tool like Adobe Acrobat can reveal the entire revision history, showing who signed which version and what changes were made between signatures. IronPDF gives you full programmatic control over this process.

For businesses managing complex document workflows that require high security and compliance, a comprehensive solution may be needed. Iron Software offers Iron Suite, which includes IronPDF for signing and manipulation, plus other libraries for a wide range of document processing tasks, available for a single one-time payment.

How Can I Manage and Verify Signatures Across Revisions?

A PDF document can have multiple signatures applied across its various revisions. IronPDF provides tools to manage this history effectively.

  • Roll Back to a Previous Revision: You can revert a document to an earlier state using the GetRevision method. This will discard all changes and signatures made after that revision.
  • Verify All Signatures: The VerifySignatures method checks the validity of all signatures across all revisions of the document. It returns true only if every signature is valid and no unauthorized changes have been made.
  • Remove Signatures: The RemoveSignatures method will strip all digital signatures from every revision of the document, creating a clean, unsigned version.
// Load a PDF with a complex signature history.
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");

// Verify all signatures across all revisions.
// This ensures document integrity throughout its entire history
bool allSignaturesValid = pdf.VerifySignatures();
Console.WriteLine($"All signatures are valid: {allSignaturesValid}");

// Roll back to the first revision (index 0).
// Useful for reviewing the original document state
if (pdf.RevisionCount &gt; 1)
{
    PdfDocument firstRevision = pdf.GetRevision(0);
    firstRevision.SaveAs("report_first_revision.pdf");
}

// Create a completely unsigned version of the document.
// This removes all digital signatures while preserving content
pdf.RemoveSignatures();
pdf.SaveAs("report_unsigned.pdf");
// Load a PDF with a complex signature history.
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");

// Verify all signatures across all revisions.
// This ensures document integrity throughout its entire history
bool allSignaturesValid = pdf.VerifySignatures();
Console.WriteLine($"All signatures are valid: {allSignaturesValid}");

// Roll back to the first revision (index 0).
// Useful for reviewing the original document state
if (pdf.RevisionCount &gt; 1)
{
    PdfDocument firstRevision = pdf.GetRevision(0);
    firstRevision.SaveAs("report_first_revision.pdf");
}

// Create a completely unsigned version of the document.
// This removes all digital signatures while preserving content
pdf.RemoveSignatures();
pdf.SaveAs("report_unsigned.pdf");
$vbLabelText   $csharpLabel

How Do I Stamp a Handwritten Signature onto a PDF?

Sometimes, you don't need the cryptographic security of a digital signature but simply want to apply a visual, electronic signature, like a scanned handwritten signature. This is often referred to as stamping. IronPDF can do this using its Watermark or Stamp features. For more advanced watermarking options, explore our custom watermarks guide.

Let's start with a sample invoice PDF and a .png image of a handwritten signature.

The original invoice PDF before stamping a signature.

Here is the signature image we will apply:

Handwritten signature sample showing 'IRON' in black ink for PDF stamping tutorial A sample handwritten signature image.

The following code uses the Watermark property to stamp this image onto the bottom-right corner of the PDF.

using IronPdf.Editing;

// Load the existing PDF document.
var pdf = PdfDocument.FromFile("invoice.pdf");

// Create an HtmlStamp containing our signature image.
// HtmlStamp allows us to position HTML content precisely on the page
var signatureStamp = new HtmlStamp("&lt;img src='assets/signature.png'/&gt;")
{
    // Configure the stamp's position and appearance.
    VerticalAlignment = VerticalAlignment.Bottom,
    HorizontalAlignment = HorizontalAlignment.Right,
    Margin = 10,  // Add some space from the edge.
    Opacity = 90  // Make it slightly transparent for a more authentic look.
};

// Apply the stamp to all pages of the PDF.
// You can also specify specific page numbers if needed
pdf.ApplyStamp(signatureStamp);

// Save the modified PDF document.
pdf.SaveAs("official_invoice.pdf");
using IronPdf.Editing;

// Load the existing PDF document.
var pdf = PdfDocument.FromFile("invoice.pdf");

// Create an HtmlStamp containing our signature image.
// HtmlStamp allows us to position HTML content precisely on the page
var signatureStamp = new HtmlStamp("&lt;img src='assets/signature.png'/&gt;")
{
    // Configure the stamp's position and appearance.
    VerticalAlignment = VerticalAlignment.Bottom,
    HorizontalAlignment = HorizontalAlignment.Right,
    Margin = 10,  // Add some space from the edge.
    Opacity = 90  // Make it slightly transparent for a more authentic look.
};

// Apply the stamp to all pages of the PDF.
// You can also specify specific page numbers if needed
pdf.ApplyStamp(signatureStamp);

// Save the modified PDF document.
pdf.SaveAs("official_invoice.pdf");
$vbLabelText   $csharpLabel

What Does the Stamped PDF Result Look Like?

After running the code, the signature image is stamped onto the document, creating a visually signed invoice.

The final PDF with the handwritten signature image stamped in the bottom-right corner.

How Can I Add an Interactive Signature Field to a PDF?

For documents that need to be signed by an end-user in a PDF viewer like Adobe Acrobat, you can add an interactive signature form field. This creates an empty, clickable area that prompts the user to apply their own digital signature. For a complete guide on PDF forms, see our creating PDF forms tutorial.

You can create a SignatureFormField and add it to the PDF's form collection. You have precise control over its location and size on the page. This is particularly useful for documents that require multiple signatures or when you need to collect signatures from external parties.

using IronPdf.Forms;
using IronSoftware.Drawing;

// Create a new PDF to add the signature field to.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>以下に署名してください</h1>");

// Define the properties for the signature form field.
string fieldName = "ClientSignature";  // Unique identifier for the field
int pageIndex = 0;  // Add to the first page (zero-indexed)
var fieldRect = new Rectangle(50, 200, 300, 100);  // Position: (x, y), Size: (width, height)

// Create the SignatureFormField object.
// This creates an interactive field that users can click to sign
var signatureField = new SignatureFormField(fieldName, pageIndex, fieldRect);

// Add the signature field to the PDF's form.
pdf.Form.Add(signatureField);

// Save the PDF with the new interactive signature field.
pdf.SaveAs("interactive_signature.pdf");
using IronPdf.Forms;
using IronSoftware.Drawing;

// Create a new PDF to add the signature field to.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>以下に署名してください</h1>");

// Define the properties for the signature form field.
string fieldName = "ClientSignature";  // Unique identifier for the field
int pageIndex = 0;  // Add to the first page (zero-indexed)
var fieldRect = new Rectangle(50, 200, 300, 100);  // Position: (x, y), Size: (width, height)

// Create the SignatureFormField object.
// This creates an interactive field that users can click to sign
var signatureField = new SignatureFormField(fieldName, pageIndex, fieldRect);

// Add the signature field to the PDF's form.
pdf.Form.Add(signatureField);

// Save the PDF with the new interactive signature field.
pdf.SaveAs("interactive_signature.pdf");
$vbLabelText   $csharpLabel

When a user opens this PDF, they will see a clickable field, allowing them to complete the signing process using their own digital ID. You can learn more about creating and managing interactive forms in our How-To guide on creating PDF forms.

PDF editor showing unsigned signature field with 'Click to sign' prompt in document titled 'testing' An unsigned, interactive signature field added programmatically to a PDF document.

How Do I Retrieve the Signer Name from Verified Signatures?

To obtain the common name of the certificate owner who signed a signature, we can use the VerifiedSignature class to access the SignerName property. Below is a code snippet demonstrating how to accomplish this.

:path=/static-assets/pdf/content-code-examples/how-to/signing-find-signer-name.cs
using IronPdf;
using System;

// Import the Signed PDF report
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");

// Using GetVerifiedSignatures() obtain a list of `VerifiedSignature` objects from the PDF
pdf.GetVerifiedSignatures().ForEach(signature =>
{
    // Print out the SignerName of each `VerifiedSignature` object
    Console.WriteLine($"SignatureName: {signature.SignerName}");
});
$vbLabelText   $csharpLabel

署名されたPDFファイルをインポートした後、GetVerifiedSignaturesメソッドを使用して、レポート内のVerifiedSignatureオブジェクトのリストを取得し、各署名のSignerNameを表示します。

この値は証明書のサブジェクト識別名(SubjectDN)から抽出され、CNフィールドが存在しない場合はNULLを返すことに注意してください。

IronPDFによるPDF署名の次のステップは?

このガイドではIronPDFの強力で柔軟なPDF署名機能を紹介しました。詳細なメタデータを含むセキュアな電子署名の適用、文書のリビジョン管理、ビジュアル署名のスタンプ、インタラクティブなフォームの作成など、IronPDFは包括的で開発者に優しいAPIを提供しています。

IronPDF library for .NET をダウンロードし、無料トライアルライセンスを取得することで、あなたのプロジェクトですべての機能を試すことができます。注釈の追加やフォームフィールドの操作など、より高度な文書操作のテクニックについては、豊富なドキュメントやチュートリアルをご覧ください。

他に何ができるかを見る準備はできましたか?チュートリアルのページをご覧ください:署名とセキュリティで保護された PDF をご覧ください。

よくある質問

C# で証明書を使っ て PDF に電子署名す る 方法は?

IronPdfを使えば、PdfSignatureクラスを使ってたった1行のコードでPDFにデジタル署名することができます。証明書ファイル(.pfxまたは.p12)とパスワードを使って新しいPdfSignatureオブジェクトを作成し、SignPdfFile()メソッドを呼び出すだけです。例えば: new IronPdf.Signing.PdfSignature("certificate.pfx", "password").SignPdfFile("input.pdf").これにより、X509Certificate2を用いた改ざん防止の電子署名が適用され、ドキュメントの真正性が保証されます。

どのような種類のPDF署名に対応していますか?

IronPdfは主に3種類のPDF署名をサポートしています:1) 認証と改ざん防止のためのX509Certificate2証明書を使用したデジタル署名、2) グラフィカルまたは手書きの署名イメージを文書に追加するビジュアル署名スタンプ、3) ユーザーがPDFに電子的に署名できるインタラクティブ署名フォームフィールド。各タイプは、文書のセキュリティやワークフロー要件に対して、それぞれ異なる目的を果たします。

デジタル署名に使用できる証明書の形式は?

IronPdfは.pfx (Personal Information Exchange)や.p12ファイルを含む一般的なデジタル証明書フォーマットに対応しています。これらの証明書ファイルには電子署名に必要な公開鍵と秘密鍵の両方が含まれています。IronPDFのPdfSignatureクラスは任意のX509Certificate2オブジェクトを扱うことができ、署名証明書のロードや管理方法に柔軟性を提供します。

デジタル署名にビジュアル表現を追加できますか?

はい、IronPDFでは電子署名にビジュアル要素を追加することができます。手書きの署名画像、会社のロゴ、カスタムスタンプなどのグラフィカルな表現を暗号化署名と一緒に含めることができます。これにより、デジタル証明書のセキュリティと視覚的な確認が組み合わされ、署名された文書が安全でプロフェッショナルなものになります。

ユーザーが電子署名するためのインタラクティブな署名フィールドを作成するにはどうすればよいですか?

IronPDFはPDFドキュメントにインタラクティブな署名フォームフィールドを追加することができます。これらのフィールドにより、ユーザーはクリックして署名を描いたり、署名画像をアップロードすることで文書に電子的に署名することができます。この機能は、契約書や複数の当事者が署名する必要のあるフォームのような、署名収集が必要なドキュメントを作成するのに最適な機能です。

PDFに署名することで、文書の完全性は保証されますか?

X509Certificate2を使ってIronPDFでPDFに電子署名をすると、文書の完全性を保証する改ざん防止シールが作成されます。電子署名は署名後に文書が変更されていないことを保証します。署名後にPDFに変更が加えられた場合、署名は無効となり、受信者に文書が改ざんされた可能性があることを知らせます。

Jacob Mellor、Ironチームの最高技術責任者(CTO)
最高技術責任者(CTO)

Jacob Mellorは、Iron Softwareの最高技術責任者であり、C# PDF技術の開拓者としてその先進的な役割を担っています。Iron Softwareのコアコードベースのオリジナルデベロッパーである彼は、創業時から製品のアーキテクチャを形作り、CEOのCameron Rimingtonと協力してNASA、Tesla、全世界の政府機関を含む50人以上の会社に成長させました。

Jacobは、1998年から2001年にかけてマンチェスター大学で土木工学の第一級優等学士号(BEng)を取得しました。1999年にロンドンで最初のソフトウェアビジネスを立ち上げ、2005年には最初の.NETコンポーネントを作成し、Microsoftエコシステムにおける複雑な問題の解決を専門にしました。

彼の旗艦製品であるIronPDFとIronSuite .NETライブラリは、全世界で3000万以上のNuGetインストールを達成しており、彼の基本コードが世界中で使用されている開発者ツールを支えています。商業的な経験を25年間積み、コードを書くことを41年間続けるJacobは、企業向けのC#、Java、およびPython PDF技術の革新を推進し続け、次世代の技術リーダーを指導しています。

レビュー済み
Jeff Fritz
Jeffrey T. Fritz
プリンシパルプログラムマネージャー - .NETコミュニティチーム
Jeffはまた、.NETとVisual Studioチームのプリンシパルプログラムマネージャーです。彼は.NET Conf仮想会議シリーズのエグゼクティブプロデューサーであり、週に二回放送される開発者向けライブストリーム『Fritz and Friends』のホストを務め、テクノロジーについて話すことや視聴者と一緒にコードを書くことをしています。Jeffはワークショップ、プレゼンテーション、およびMicrosoft Build、Microsoft Ignite、.NET Conf、Microsoft MVPサミットを含む最大のMicrosoft開発者イベントのコンテンツを企画しています。
準備はできましたか?
Nuget ダウンロード 17,012,929 | バージョン: 2025.12 リリース