Secure Exchanges SDK Documentation
Search Results for

    Show / Hide Table of Contents

    Certification PDF

    La certification PDF garantit l'intégrité du document.

    SecureExchangesSignatureSDK

    Module complémentaire du SDK principal pour la certification et la signature PDF avec PKI.

    Installation

    Choisissez le package qui correspond à votre framework cible :

    Framework cible SDK principal SDK Signature (cette page)
    .NET Framework 4.7.2+ (Windows uniquement) 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

    La variante .NetCore est requise pour un déploiement sur Linux — par exemple Azure Functions en container Linux. Voir Déploiement Azure Functions.

    Classes principales

    PkiFileHelper

    Moteur de certification PDF.

    Avec .NET Framework — le helper est IDisposable :

    using SecureExchangesSignatureSDK.Helpers;
    
    using var helper = new PkiFileHelper(
        isPreview: false,
        culture: "fr-CA"   // Langue de l'interface
    );
    
    var result = await helper.CertifyPkiPdf(args);
    

    Avec .NET 8+ / .NET Core — le helper est IAsyncDisposable. Préférer await using pour éviter tout blocage sync-over-async :

    using SecureExchangesSignatureSDK.Helpers;
    
    await using var helper = new PkiFileHelper(
        isPreview: false,
        culture: "fr-CA"   // Langue de l'interface
    );
    
    var result = await helper.CertifyPkiPdf(args);
    

    CertifyPdfArgs

    Paramètres pour la certification.

    Propriete Type Description
    File FileArgs Fichier PDF à certifier
    Recipients List Liste des signataires
    CertifyData CertificationData Métadonnées de certification
    RecipientZoneDefinitions List Zones prédéfinies
    DetectExistingFields bool Détecter champs existants
    DefineRecipients Func Distribution des zones existants

    Exemple complet

    using SecureExchangesSignatureSDK.Helpers;
    using SecureExchangesSignatureSDK.Models.Args;
    
    // Obtenir le token de certification
    var certificationTokenArgs = new GetCertificationTokenSDKArgs(
      Uri,
      Serial,
      ApiUser,
      ApiPassword,
      sha512,
      CertificationTokenType.CertifyDocument,
      "fr-CA"
    );
    
    var certificationTokenResponse = SignHelper.GetCertificationToken(certificationTokenArgs);
    
    // Créer le helper (exemple NetCore — utilisez `using var` sur .NET Framework)
    await using var helper = new PkiFileHelper(isPreview: false, culture: "fr-CA");
    
    string pdfName = "document.pdf";
    string mimeType = FileHelper.GetMimeType(pdfName);
    
    // Préparer les arguments
    var args = new CertifyPdfArgs
    {
        File = new FileArgs(pdfBytes, pdfName, mimeType),
        RecipientZoneDefinitions = manuallyCreatedZones, 
        Recipients = new List<string> { "signataire@example.com" },
        CertifyData = certificationTokenResponse.CertificationData,
        DetectExistingFields = true,
        DefineRecipients = (IReadOnlyDictionary<string, List<ZoneDetails>> zonesDictionary, IReadOnlyList<ZoneDetails> definedZones) =>
        {
            // Reçoit 2 paramètres :
            // 1: Le dictionnaire <destinataire, zones> déjà initialisé (à retourner)
            // 2: La liste des champs existants à distribuer entre les destinataires
            return zonesDictionary;
        }
    };
    
    // Certifier
    var result = await helper.CertifyPkiPdf(args);
    
    // Ajouter au message
     var mutliRecipientArgs = new MutliRecipientArgs(
       /* ... */)
     {
       CertifiedPdfs = new List<CertifiedPdfContainer>() { result },
       /* ... */
     };
    

    Voir aussi

    • Vue d'ensemble
    • Linux + Docker — Dockerfile et dépendances système de Chromium
    • Déploiement Azure Functions — déployer en tant que container Linux
    In this article
    Back to top Secure Exchanges Inc. - Documentation