Table of Contents

Class PdfSharpDefaultSigner

Namespace
PdfSharp.Pdf.Signatures
Assembly
PdfSharp.Cryptography.dll

Signer implementation that uses .NET classes only. FreePDF: Format selects a PAdES baseline signature, and TimeStampClient replaces the HTTP call to the time-stamp authority. Time-stamps need .NET 8 or later.

public class PdfSharpDefaultSigner : IDigitalSigner, IDigitalSignerFormat
Inheritance
object
PdfSharpDefaultSigner
Implements

Constructors

PdfSharpDefaultSigner(X509Certificate2, PdfMessageDigestType, Uri?)

Creates a new instance of the PdfSharpDefaultSigner class.

Properties

CertificateName

Gets the name of the certificate.

Format

Gets the format of the signatures; set it when creating the signer. The default, Pkcs7Detached, writes the CMS as before 7.10. Pades writes a PAdES baseline signature (ETSI.CAdES.detached): B-B, or B-T with a time-stamp authority. PAdES needs SHA-256 or a stronger digest.

TimeStampClient

Gets the function that sends an RFC 3161 time-stamp request (a DER-encoded TimeStampReq) to a time-stamp authority and returns its reply (a DER-encoded TimeStampResp); set it when creating the signer. When it is set, the signature gets a signature time-stamp from it instead of an HTTP POST to the URI given to the constructor, for example to add authentication or to use a test authority. It is called once per signature. Time-stamps need .NET 8 or later. The synchronous Save waits for it: use SaveAsync, or ConfigureAwait(false) inside it, in applications with a synchronization context (WinForms, WPF).

TimeStampReserve

Gets the number of bytes reserved for the signature time-stamp token; set it when creating the signer. The default, 16384, holds a token with its authority's certificate chain. Saving fails if a token is larger.

Methods

GetSignatureAsync(Stream)

Creates the signature for a stream containing the PDF file.

GetSignatureSizeAsync()

Determines the size of the contents to be reserved in the PDF file for the signature.