All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Pkcs7Signer(String, String, PdfHashAlgorithm, ITsaClient, IOcspClient, ICrlClient, PdfSignatureProfile) Constructor

Initializes a new instance of the Pkcs7Signer class with specified settings.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v20.1.Core.dll

Declaration

public Pkcs7Signer(
    string fileName,
    string password,
    PdfHashAlgorithm hashAlgorithm,
    ITsaClient tsaClient,
    IOcspClient ocspClient,
    ICrlClient crlClient,
    PdfSignatureProfile profile
)
Public Sub New(
    fileName As String,
    password As String,
    hashAlgorithm As PdfHashAlgorithm,
    tsaClient As ITsaClient,
    ocspClient As IOcspClient,
    crlClient As ICrlClient,
    profile As PdfSignatureProfile
)

Parameters

Name Type Description
fileName String

A path to a signature certificate file (.pfx file format).

password String

A password for a certificate.

hashAlgorithm PdfHashAlgorithm

Signature's hash algorithm.

tsaClient ITsaClient

An object that provides a time stamp.

ocspClient IOcspClient

An object that performs an Online Certificate Status Protocol (OCSP) request for a certificate.

crlClient ICrlClient

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

profile PdfSignatureProfile

An enumeration value type that specifies the signature's baseline profile type.

Remarks

The code sample below creates a PAdES signature:

using (var signer = new PdfDocumentSigner("Document.pdf"))
{
    IOcspClient ocspClient = new PdfOcspClient();
    ICrlClient crlClient = new PdfCrlClient();

    ITsaClient tsaClient = new PdfTsaClient(new Uri(@"https://freetsa.org/tsr"), PdfHashAlgorithm.SHA256);

    //Create a PKCS#7 signature:
    Pkcs7Signer pkcs7Signature = new Pkcs7Signer("Signing Documents//testcert.pfx", "123",
     PdfHashAlgorithm.SHA256, tsaClient, ocspClient, crlClient, PdfSignatureProfile.PAdES_BES);

    //Create a new signature field:
    var signatureFieldInfo = new PdfSignatureFieldInfo(1);
    signatureFieldInfo.Name = "SignatureField";
    signatureFieldInfo.SignatureBounds = new PdfRectangle(10, 10, 150, 150);

    //Apply a signature with a new signature:
    var signature =
    new PdfSignatureBuilder(pkcs7Signature, signatureFieldInfo);

    //Sign and save the document:
    signer.SaveDocument("SignedDocument.pdf", signature);
}
See Also