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
<PackageReference Include="Egov.Integrations.MSign.Soap" Version="10.0.2" />
<PackageVersion Include="Egov.Integrations.MSign.Soap" Version="10.0.2" />
<PackageReference Include="Egov.Integrations.MSign.Soap" />
paket add Egov.Integrations.MSign.Soap --version 10.0.2
#r "nuget: Egov.Integrations.MSign.Soap, 10.0.2"
#:package Egov.Integrations.MSign.Soap@10.0.2
#addin nuget:?package=Egov.Integrations.MSign.Soap&version=10.0.2
#tool nuget:?package=Egov.Integrations.MSign.Soap&version=10.0.2
Egov.Integrations.MSign.Soap
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
- Prerequisites
- Installation
- Configuration
- Usage
- Supported Content Types
- Error Handling
- Testing
- Contributing
- Code of Conduct
- AI Assistance
- License
Features
- Full support for MSign SOAP API operations
- Seamless integration with
Egov.Extensions.Configurationfor 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
Using Dependency Injection (Recommended)
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.) |
| 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 | Versions 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. |
-
net10.0
- Egov.Extensions.Configuration (>= 10.0.4)
- System.ServiceModel.Http (>= 10.0.652802)
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.