Table of Contents

Interface IDocumentSigner

Namespace
NuvTools.Security.Certificate.Signing
Assembly
NuvTools.Security.dll

Signs a PDF with a digital certificate whose private key stays with the person, in two steps: the server prepares the document and opens a challenge, the client signs it, and the server completes the signature.

public interface IDocumentSigner

Remarks

Whatever the application needs to know about who signed — to check it is the expected person, or to print it on the document — comes from the certificate the provider read, never from a value the client sends.

Provider failures propagate as exceptions. Signing is not an access decision, so there is no safe outcome to fall back to: the caller reports that the document was not signed.

Methods

CompleteAsync(string, CancellationToken)

Completes the signature the client signed the challenge for.

Task<SignedDocument> CompleteAsync(string token, CancellationToken cancellationToken = default)

Parameters

token string

The token of the challenge the client signed.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<SignedDocument>

The signed PDF and the certificate it was actually signed with.

GetSignersAsync(ReadOnlyMemory<byte>, CancellationToken)

Reads the certificates a document was already signed with, without validating the signatures.

Task<IReadOnlyList<CertificateDetails>> GetSignersAsync(ReadOnlyMemory<byte> signedDocument, CancellationToken cancellationToken = default)

Parameters

signedDocument ReadOnlyMemory<byte>

The signed PDF.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<IReadOnlyList<CertificateDetails>>

One entry per signature, in the order the provider reports them. Document timestamps are left out.

ReadCertificateAsync(ReadOnlyMemory<byte>, CancellationToken)

Reads who a certificate was issued to, without validating it.

Task<CertificateDetails> ReadCertificateAsync(ReadOnlyMemory<byte> certificate, CancellationToken cancellationToken = default)

Parameters

certificate ReadOnlyMemory<byte>

The certificate, DER-encoded.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<CertificateDetails>

What the certificate says about its holder and issuer.

StartAsync(DocumentSignatureRequest, CancellationToken)

Prepares the document for signing and opens the challenge the client signs.

Task<DocumentSignatureChallenge> StartAsync(DocumentSignatureRequest request, CancellationToken cancellationToken = default)

Parameters

request DocumentSignatureRequest

The PDF and, optionally, the visible stamp of this signature.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DocumentSignatureChallenge>

The challenge the client signs and sends back.