Skip to main content
All docs
V23.2

PdfDocumentSigner.AddToDss(String, ICrlClient, IOcspClient, ICertificateStoreProvider) Method

Adds information about the specified signature to the Document Security Store (DSS).

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public void AddToDss(
    string signatureFieldName,
    ICrlClient crl,
    IOcspClient ocsp,
    ICertificateStoreProvider provider
)

Parameters

Name Type Description
signatureFieldName String

The name of the form field that contains the target signature.

crl ICrlClient

An object that contains a Certificate Revocation List (CRL) request for a certificate chain.

ocsp IOcspClient

An object that returns Online Certificate Status Protocol (OCSP) responce for a certificate chain.

provider ICertificateStoreProvider

Provides certificates used to build a certificate chain.

Exceptions

Type Description
ArgumentException

Occurs if the specified form field is not signed.

Remarks

The signatureFieldName parameter is mandatory. Other parameters can be null.

The code sample below retrieves the name of the first signature field, adds the related signature’s information to the DSS, and applies a timestamp to the document.

using (var signer = new PdfDocumentSigner(@"signed.pdf"))
{
    ITsaClient tsaClient = new TsaClient(new Uri(@"https://freetsa.org/tsr"), HashAlgorithmType.SHA256);

    string signatureName = signer.GetSignatureFieldNames(false)[0];

   // Create a provider that retrieves certificates from a store:
    using (var certificateStoreProvider =
        new CertificateStoreProvider(new X509Store(StoreLocation.CurrentUser), true))
    {
        // Add the signature to the security store
        // and specify the CrlClient and OcspClient objects
        // used to check the certificates' revocation status:
        signer.AddToDss(signatureName, new CrlClient(), new OcspClient(), certificateStoreProvider);
    }
    signer.SaveDocument(@"signedLTV.pdf", new[] { new PdfSignatureBuilder(new PdfTimeStamp(tsaClient)) });
}
See Also