Click or drag to resize

PdfSignatureFieldSign(String, String) Method

Initiate signing of a PDF file with a digital ID available as a file with the specified file name and the password protecting the private key.

The most common format for such files is a PKCS#12 file, which uses .pfx or .p12 file extension and is a password protected storage container for digital IDs containing the public key (Certificate) and the associated private key.

The name of the preferred signature handler to use when validating the signature (Filter entry) is Adobe.PPKLite, the Format of the returned PdfSignature instance is PKCS7 and the ContentsLength is set to the internally estimated size.

To finish the signing, call any of the Save. Next signing cannot be initiated before the current one is not finished.

The returned PdfSignature is set to the Value thus automatically updating the Appearance.

If your project doesn't target Windows platform, to use this method, make sure your project references NuGet package System.Security.Cryptography.Pkcs.

Note  Note
If the Value is not , then the method re-signs the PDF file directly and the Save should not be called. This behavior enables delay-sign and re-sign scenarios.

Namespace: SautinSoft.Pdf.Forms
Assembly: SautinSoft.Pdf (in SautinSoft.Pdf.dll) Version: 2025.3.13
Syntax
public PdfSignature Sign(
	string digitalIdFileName,
	string digitalIdPassword
)

Parameters

digitalIdFileName  String
The name of a digital ID file that contains the public key (Certificate) and the associated private key.
digitalIdPassword  String
The password protecting the private key.

Return Value

PdfSignature
A PdfSignature instance that contains signature properties (the time of signing, the name of the person or authority signing the document, the reason for the signing, the CPU host name or physical location of the signing); key information (the signing certificate used to verify the signature value and, optionally, other certificates used to verify the authenticity of the signing certificate); reference (describes the exact byte range for the digest calculation); and signature value (usually a DER-encoded PKCS#7 binary data object that conforms to RFC 5652 Cryptographic Message Syntax).
Exceptions
ExceptionCondition
InvalidOperationExceptionThis PdfSignatureField is not contained in the Fields of this PDF document. -or- Signing/timestamping of the PDF file has already been initiated on some PdfSignatureField in this PDF document. Finish that signing/timestamping by calling any of the Save before initiating a new signing/timestamping on this PdfSignatureField.
See Also