Table of Contents

Class CadesSigner

Namespace
SimpleSign.CAdES
Assembly
SimpleSign.CAdES.dll

Creates standalone CAdES digital signatures (ETSI EN 319 122) as detached CMS/PKCS#7 SignedData — no PDF wrapper.

public static class CadesSigner
Inheritance
CadesSigner
Inherited Members

Methods

Document(byte[], ILogger?)

Creates a new fluent builder for signing data with CAdES.

public static CadesSignerBuilder Document(byte[] data, ILogger? logger = null)

Parameters

data byte[]

The original document bytes to sign.

logger ILogger

Optional logger.

Returns

CadesSignerBuilder

A CadesSignerBuilder configured with defaults.

SignAsync(byte[], X509Certificate2, CadesSigningOptions?, ILogger?, CancellationToken)

Signs the provided data and returns a DER-encoded CAdES signature.

public static Task<byte[]> SignAsync(byte[] data, X509Certificate2 certificate, CadesSigningOptions? options = null, ILogger? logger = null, CancellationToken cancellationToken = default)

Parameters

data byte[]

The original document bytes to sign.

certificate X509Certificate2

Certificate with private key.

options CadesSigningOptions

Optional signing configuration.

logger ILogger

Optional logger.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<byte[]>

DER-encoded CMS/PKCS#7 SignedData (detached).

SignAsync(byte[], X509Certificate2, Func<byte[], Task<byte[]>>, string, CadesSigningOptions?, ILogger?, CancellationToken)

Signs the provided data using an external signing delegate. Use for HSMs, cloud KMS, or A3 tokens where the private key is not directly accessible.

public static Task<byte[]> SignAsync(byte[] data, X509Certificate2 certificate, Func<byte[], Task<byte[]>> externalSigner, string signatureAlgorithmOid, CadesSigningOptions? options = null, ILogger? logger = null, CancellationToken cancellationToken = default)

Parameters

data byte[]

The original document bytes to sign.

certificate X509Certificate2

The signer's public certificate (private key NOT required).

externalSigner Func<byte[], Task<byte[]>>

Delegate that receives signed attributes and returns raw signature bytes.

signatureAlgorithmOid string

OID of the signature algorithm used by the external signer.

options CadesSigningOptions

Optional signing configuration.

logger ILogger

Optional logger.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<byte[]>

DER-encoded CMS/PKCS#7 SignedData (detached).