Egov.Integrations.MSign.Soap 10.0.2

Prefix Reserved
dotnet add package Egov.Integrations.MSign.Soap --version 10.0.2
                    
NuGet\Install-Package Egov.Integrations.MSign.Soap -Version 10.0.2
                    
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.Integrations.MSign.Soap" Version="10.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Egov.Integrations.MSign.Soap" Version="10.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Egov.Integrations.MSign.Soap" />
                    
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.Integrations.MSign.Soap --version 10.0.2
                    
#r "nuget: Egov.Integrations.MSign.Soap, 10.0.2"
                    
#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.Integrations.MSign.Soap@10.0.2
                    
#: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.Integrations.MSign.Soap&version=10.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Egov.Integrations.MSign.Soap&version=10.0.2
                    
Install as a Cake Tool

Egov.Integrations.MSign.Soap

NuGet License: MIT

A .NET library that provides a reusable client for connecting with MSign digital signature service using the SOAP protocol. It is built for ASP.NET Core 10.0+ applications and integrates seamlessly with the eGov platform's shared configuration and certificate management.


Table of Contents


Features

  • Full support for MSign SOAP API operations
  • Seamless integration with Egov.Extensions.Configuration for certificate management
  • Built-in helper for building MSign redirect addresses
  • Async-first API design
  • Automatic handling of certificate chains and intermediate certificates

Prerequisites

  • .NET 10.0 or later
  • A valid Service Provider certificate registered in MSign (issued by STISC)
  • Access to MSign SOAP API endpoints

Installation

Install the package from NuGet:

dotnet add package Egov.Integrations.MSign.Soap

Or via the Package Manager Console:

Install-Package Egov.Integrations.MSign.Soap

Note: This package depends on Egov.Extensions.Configuration.


Configuration

Add the following sections to your appsettings.json:

{
  "Certificate": {
    "Path": "Files/Certificates/your-certificate.pfx",
    "Password": "your-certificate-password"
  },
  "MSignSoap": {
    "ApiAddress": "https://msign.staging.egov.md:8443/MSign.svc",
    "FrontendAddress": "https://msign.staging.egov.md",
    "ServiceRootUrl": "https://localhost:44379"
  }
}
  • ApiAddress: The endpoint of the MSign SOAP service.
  • FrontendAddress: The base URL of the MSign user interface.
  • ServiceRootUrl: The base URL of your application (must be HTTPS).

Usage

Register the services in Program.cs:

builder.Services.AddSystemCertificate(builder.Configuration.GetSection("Certificate"));
builder.Services.AddMSignSoapClient(builder.Configuration.GetSection("MSignSoap"));

Creating Signature Requests

Inject IMSignSoapClient into your controller or service:

public class HomeController : ControllerBase
{
    private readonly IMSignSoapClient _msignClient;

    public HomeController(IMSignSoapClient msignClient)
    {
        _msignClient = msignClient;
    }

    public async Task<IActionResult> Sign()
    {
        var requestID = await _msignClient.PostSignRequestAsync(new SignRequest
        {
            ShortContentDescription = "Sample HASH signature",
            ContentType = ContentType.Hash,
            Contents = new[]
            {
                new SignContent
                {
                    Content = SHA1.HashData(new byte[] { 0xDE, 0xAD, 0xBE, 0xEF })
                }
            }
        });

        var relayState = Guid.NewGuid().ToString();
        var redirectUrl = _msignClient.BuildRedirectAddress(requestID, Url.Action(nameof(Callback))!, relayState);
        
        return Redirect(redirectUrl);
    }
}

Handling Responses

public async Task<IActionResult> Callback(string requestID, string relayState)
{
    var response = await _msignClient.GetSignResponseAsync(requestID, null);

    if (response.Status == SignStatus.Success)
    {
        // Process successful signature
        return Ok();
    }

    return BadRequest(response.Message);
}

Supported Content Types

Content Type Description
Hash Signature on a provided hash (SHA-1, SHA-256, etc.)
PDF Native PDF signature
XML XML Digital Signature (XAdES)
Binary Generic binary data signature

Error Handling

Exception Scenario
ArgumentNullException requestID or relativeReturnUrl is missing
CommunicationException Network or SOAP communication issues
SecurityNegotiationException Certificate authentication failures

Testing

The solution includes a test project Test/ that demonstrates usage and can be used for integration testing.

dotnet test

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to get started.


Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.


AI Assistance

This repository contains an AGENTS.md file with instructions and context for AI coding agents to assist in development, ensuring consistency in code style and project structure.


License

This project is licensed under the MIT 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 (1)

Showing the top 1 NuGet packages that depend on Egov.Integrations.MSign.Soap:

Package Downloads
Egov.Fod.BackComponents

Standard backend components for FOD integrations including MDocs, MNotify, MSign, and MPower.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.2 197 4/9/2026
8.0.21 145 12/12/2025
8.0.20 144 12/11/2025
8.0.19 142 12/11/2025