.NET libraryVersion 2.0.4

Xades.Components

XAdES-BES electronic signatures in your .NET application – with a certificate from a file, the Windows store, a smart card or a token. Proven with Polish government gateways: e-Deklaracje, KSeF and PUESC.

dotnet add package Xades.Components

Every signature mode

Enveloped, Enveloping, and external (detached) or internal signatures of Base64 data.

Ready for DI

AddXadesComponents and IXadesSigner: configuration from appsettings.json, injection in ASP.NET Core and Worker Services.

SHA-256 and SHA-1

RSA-SHA256 and RSA-SHA1, XAdES 1.3.2 with signing time and signing certificate reference.

Smart cards and tokens

Keys in a classic CSP and in a CNG KSP – including smart cards and USB tokens.

.NET Framework and .NET

netstandard2.0: .NET Framework 4.6.2+ and .NET 8 or later.

Gateway-ready

Keeps the document formatting and comments; saving the file does not break the signature.

Used by

Using the components

Register the components in DI – the licence number or defaults from environment variables. Use IXadesSigner to sign.

appsettings.jsonJSON
{
  "XadesComponents": {
    "SerialNumber": "YOUR-SERIAL-NUMBER",
    "CryptType": "SHA256",
    "EnvelopeType": "Enveloped"
  }
}
Program.csC#
builder.Services.AddXadesComponents(
    builder.Configuration.GetSection(XadesOptions.SectionName));
DeclarationService.csC#
public class DeclarationService(IXadesSigner signer)
{
    // CryptType and EnvelopeType come from the configuration
    public XmlDocument Sign(XmlDocument declaration, X509Certificate2 cert) =>
        signer.Sign(declaration, cert);
}

IXadesSigner is registered as a singleton. An invalid licence number is reported when the signer is first resolved from the container, not on the first signature. Sign(document, cert, cryptType, envelopeType) overrides the defaults for a single call.

Commercial licence

The library is available under a commercial licence. After purchase you receive a licence number that unlocks full operation.

  • Without a licence number it runs in trial mode: up to 4 signatures per process, with a notice on standard error.
  • The licence includes technical support with the integration.