Secure Exchanges SDK Documentation
Search Results for

    Show / Hide Table of Contents

    PDF Certification

    PDF certification guarantees the document's integrity.

    SecureExchangesSignatureSDK

    Add-on module for the main SDK for PDF certification and signing with PKI.

    Installation

    Choose the package that matches your target framework:

    Target framework Main SDK Signature SDK (this page)
    .NET Framework 4.7.2+ (Windows only) SecureExchanges SecureExchanges.Signature
    .NET 8+ (Windows + Linux) SecureExchanges.NetCore SecureExchanges.Signature.NetCore

    .NET Framework

    Install-Package SecureExchanges.Signature
    

    .NET 8+ / .NET Core

    Install-Package SecureExchanges.Signature.NetCore
    
    Note

    The .NetCore variant is required to deploy on Linux — for example Azure Functions Linux containers. See Azure Functions Deployment.

    Main Classes

    PkiFileHelper

    PDF certification engine.

    With .NET Framework — the helper is IDisposable:

    using SecureExchangesSignatureSDK.Helpers;
    
    using var helper = new PkiFileHelper(
        isPreview: false,
        culture: "en-CA"   // Interface language
    );
    
    var result = await helper.CertifyPkiPdf(args);
    

    With .NET 8+ / .NET Core — the helper is IAsyncDisposable. Prefer await using to avoid sync-over-async blocking:

    using SecureExchangesSignatureSDK.Helpers;
    
    await using var helper = new PkiFileHelper(
        isPreview: false,
        culture: "en-CA"   // Interface language
    );
    
    var result = await helper.CertifyPkiPdf(args);
    

    CertifyPdfArgs

    Parameters for certification.

    Property Type Description
    File FileArgs PDF file to certify
    Recipients List List of signers
    CertifyData CertificationData Certification metadata
    RecipientZoneDefinitions List Predefined zones
    DetectExistingFields bool Detect existing fields
    DefineRecipients Func Distribution of existing zones

    Complete Example

    using SecureExchangesSignatureSDK.Helpers;
    using SecureExchangesSignatureSDK.Models.Args;
    
    // Get the certification token
    var certificationTokenArgs = new GetCertificationTokenSDKArgs(
      Uri,
      Serial,
      ApiUser,
      ApiPassword,
      sha512,
      CertificationTokenType.CertifyDocument,
      "en-CA"
    );
    
    var certificationTokenResponse = SignHelper.GetCertificationToken(certificationTokenArgs);
    
    // Create the helper (NetCore example — use `using var` instead on .NET Framework)
    await using var helper = new PkiFileHelper(isPreview: false, culture: "en-CA");
    
    string pdfName = "document.pdf";
    string mimeType = FileHelper.GetMimeType(pdfName);
    
    // Prepare arguments
    var args = new CertifyPdfArgs
    {
        File = new FileArgs(pdfBytes, pdfName, mimeType),
        RecipientZoneDefinitions = manuallyCreatedZones, 
        Recipients = new List<string> { "signer@example.com" },
        CertifyData = certificationTokenResponse.CertificationData,
        DetectExistingFields = true,
        DefineRecipients = (IReadOnlyDictionary<string, List<ZoneDetails>> zonesDictionary, IReadOnlyList<ZoneDetails> definedZones) =>
        {
            // Receives 2 parameters:
            // 1: The <recipient, zones> dictionary already initialized (to return)
            // 2: The list of existing fields to distribute among recipients
            return zonesDictionary;
        }
    };
    
    // Certify
    var result = await helper.CertifyPkiPdf(args);
    
    // Add to message
    var mutliRecipientArgs = new MutliRecipientArgs(
      /* ... */)
    {
      CertifiedPdfs = new List<CertifiedPdfContainer>() { result },
      /* ... */
    };
    

    See Also

    • Overview
    • Linux + Docker — Dockerfile and Chromium system dependencies
    • Azure Functions Deployment — deploy as a Linux container
    In this article
    Back to top Secure Exchanges Inc. - Documentation