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
tokenstringThe token of the challenge the client signed.
cancellationTokenCancellationTokenToken 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
signedDocumentReadOnlyMemory<byte>The signed PDF.
cancellationTokenCancellationTokenToken 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
certificateReadOnlyMemory<byte>The certificate, DER-encoded.
cancellationTokenCancellationTokenToken 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
requestDocumentSignatureRequestThe PDF and, optionally, the visible stamp of this signature.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DocumentSignatureChallenge>
The challenge the client signs and sends back.