Secure Exchanges SDK Documentation
Search Results for

    Show / Hide Table of Contents

    Class PkiFileHelper

    Helper class for PKI (Public Key Infrastructure) PDF certification and digital signature operations. Uses Puppeteer to render and process PDF documents for certification. Implements IDisposable to properly release browser resources.

    Inheritance
    object
    PkiFileHelper
    Implements
    IDisposable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: SecureExchangesSignatureSDK.Helpers
    Assembly: SecureExchangesSignatureSDK.dll
    Syntax
    public class PkiFileHelper : IDisposable
    Remarks

    This class provides functionality to certify PDF documents with digital signatures using the Secure Exchanges PKI infrastructure. It uses a headless browser to process PDF files and add certification data.

    Examples
    using var helper = new PkiFileHelper(isPreview: false, culture: "en-CA");
    
    var args = new CertifyPdfArgs
    {
        File = new FileArgs(pdfBytes, "document.pdf", "application/pdf"),
        Recipients = new List<string> { "signer@example.com" },
        CertifyData = certificationData,
        DetectExistingFields = true
    };
    
    var result = await helper.CertifyPkiPdf(args);
    byte[] certifiedPdf = result.File.Binary;

    Constructors

    PkiFileHelper(bool, string)

    Initializes a new instance of the PkiFileHelper class.

    Declaration
    public PkiFileHelper(bool isPreview = false, string culture = "fr-CA")
    Parameters
    Type Name Description
    bool isPreview

    If set to true, uses the preview environment; otherwise uses production.

    string culture

    The culture code for the interface language (e.g., "fr-CA", "en-CA").

    Methods

    CertifyPkiPdf(CertifyPdfArgs)

    Certifies a PDF document with PKI digital signature infrastructure. This method processes a PDF file, adds certification data, and prepares it for signature collection.

    Declaration
    public Task<CertifiedPdfContainer> CertifyPkiPdf(CertifyPdfArgs args)
    Parameters
    Type Name Description
    CertifyPdfArgs args

    The certification arguments containing the PDF file, recipients, and certification data.

    Returns
    Type Description
    Task<CertifiedPdfContainer>

    A CertifiedPdfContainer containing the certified PDF and zone definitions.

    Examples
    var args = new CertifyPdfArgs
    {
        File = new FileArgs(pdfBytes, "contract.pdf", "application/pdf"),
        Recipients = new List<string> { "john@example.com", "jane@example.com" },
        CertifyData = new CertificationData
        {
            // Certification configuration
        },
        DetectExistingFields = true,
        DefineRecipients = (recipients, zones) =>
        {
            // Assign zones to recipients
            return assignedZones;
        }
    };
    
    var result = await helper.CertifyPkiPdf(args);
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when required arguments are null or empty.

    Exception

    Thrown when PDF processing fails.

    Dispose()

    Releases all resources used by the PkiFileHelper instance. Closes the browser and page, and terminates the browser process if still running.

    Declaration
    public void Dispose()

    Implements

    IDisposable

    Extension Methods

    ExtensionHelper.CopySameNameAndTypeProperties<T, S>(T, S)
    In this article
    Back to top Secure Exchanges Inc. - Documentation