Egov.MServices.DataSigning 10.0.1

Prefix Reserved
dotnet add package Egov.MServices.DataSigning --version 10.0.1
                    
NuGet\Install-Package Egov.MServices.DataSigning -Version 10.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Egov.MServices.DataSigning" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Egov.MServices.DataSigning" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Egov.MServices.DataSigning" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Egov.MServices.DataSigning --version 10.0.1
                    
#r "nuget: Egov.MServices.DataSigning, 10.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Egov.MServices.DataSigning@10.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Egov.MServices.DataSigning&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Egov.MServices.DataSigning&version=10.0.1
                    
Install as a Cake Tool

Egov.MServices.DataSigning

NuGet License: MIT

A .NET library that signs PDF documents through a remote HSM (Hardware Security Module) SOAP service. It is built for ASP.NET Core 10.0+ applications and integrates with the eGov platform's shared certificate configuration.


Table of Contents


Features

  • PDF signing via a remote HSM service over SOAP
  • Mutual TLS with client certificate and intermediate certificate chain support
  • A no-op signer for local development and test environments
  • Built-in ASP.NET Core health check
  • Async-first API design

Prerequisites

  • .NET 10.0 SDK or later
  • Network access to the HSM signing endpoint
  • A client certificate (.pfx) authorized by the HSM service

Installation

dotnet add package Egov.MServices.DataSigning

Configuration

Add a PdfSigner section to appsettings.json:

{
  "PdfSigner": {
    "Disabled": false,
    "EndpointAddress": "https://hsm.example.gov.md/SigningService.svc",
    "SignerEntity": "My Institution",
    "SignerIdentity": "1002600000000",
    "ClientCertificatePath": "certs/client.pfx",
    "ClientCertificatePassword": "<password>"
  }
}
Setting Type Description
Disabled bool When true, signing is skipped and the input document is returned unchanged.
EndpointAddress string Absolute URL of the HSM signing endpoint.
SignerEntity string? Name of the signing entity recorded in the signature.
SignerIdentity string? Identifier (IDNO/IDNP) of the signing entity.
ClientCertificatePath string? Path to the client .pfx used for mutual TLS.
ClientCertificatePassword string? Password for the client certificate.
ClientCertificate X509Certificate2? Set in code instead of ClientCertificatePath.
ClientCertificateIntermediaries X509Certificate2? Intermediate certificates for the chain.

Store the certificate password in a secret store (user secrets, Key Vault, or environment variables) rather than in appsettings.json.


Usage

Registering the signer

using Egov.MServices.DataSigning;

builder.Services.AddPdfSigner(builder.Configuration.GetSection("PdfSigner"));

Or configure in code:

builder.Services.AddPdfSigner(options =>
{
    options.EndpointAddress = "https://hsm.example.gov.md/SigningService.svc";
    options.SignerEntity = "My Institution";
});

Signing a document

public class ReportService(IPdfSigner signer)
{
    public async Task<byte[]> SignAsync(byte[] pdf)
    {
        if (!signer.Enabled)
        {
            return pdf;
        }

        return await signer.Sign(pdf);
    }
}

Health Checks

builder.Services.AddHealthChecks()
    .AddPdfSignerHealthCheck();

The check is registered under the name PdfSigner.


Disabling Signing

For local development and integration tests where no HSM is reachable, register the no-op signer:

builder.Services.AddNoopPdfSigner();

Alternatively, set PdfSigner:Disabled to trueIPdfSigner.Enabled then reports false and documents pass through unsigned.


Contributing

See CONTRIBUTING.md.

Code of Conduct

See CODE_OF_CONDUCT.md.

AI Assistance

See AGENTS.md for guidance aimed at AI coding assistants.

License

Distributed under the MIT License. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 97 9/2/2026