[]
The implementation of Pkcs7SignerBase, generates a detached PKCS#7 signature using:
The first certificate in the chain must be the end-entity (signing) certificate, followed by any intermediate certificates required to build a trust chain.
The private key is used to produce the signature value, while the certificate chain is embedded into the resulting signature container.
This class provides a built-in signing implementation. For custom signing scenarios (e.g., remote signing with external services such as HSM or cloud key providers), extend Pkcs7SignerBase.
new Pkcs7Signer(): Pkcs7Signer;
Creates a new Pkcs7SignerBase.
Pkcs7Signer
get certificateChainPem(): string[];
Gets the certificate chain to embed into the PKCS#7 (CMS) signature.
The chain may contain only the signer's (end-entity) certificate or a full chain including intermediate CA certificates and the root CA certificate.
Providing more certificates increases the likelihood that verifiers can successfully build and validate the trust chain without fetching missing certificates from external sources.
When multiple certificates are provided, they should be ordered from the end-entity (signer) certificate up to the root CA certificate.
string[]
set certificateChainPem(value): void;
Sets the certificate chain to embed into the PKCS#7 (CMS) signature.
The chain may contain only the signer's (end-entity) certificate or a full chain including intermediate CA certificates and the root CA certificate.
Providing more certificates increases the likelihood that verifiers can successfully build and validate the trust chain without fetching missing certificates from external sources.
When multiple certificates are provided, they should be ordered from the end-entity (signer) certificate up to the root CA certificate.
string[]
void
get contactInfo(): string;
Gets the information provided by the signer to enable a recipient to contact the signer to verify the signature (for example, a phone number).
string
set contactInfo(value): void;
Sets the information provided by the signer to enable a recipient to contact the signer to verify the signature (for example, a phone number).
string
void
get crls(): (string | ArrayBuffer)[];
Gets the collection of certificate revocation lists (CRLs) to use. Items in this collection may be of the following types: ArrayBuffer An encoded CRL list. string The URL of a CRL (e.g. http://crl.cacert.org/revoke.crl).
(string | ArrayBuffer)[]
set crls(value): void;
Sets the collection of certificate revocation lists (CRLs) to use. Items in this collection may be of the following types: ArrayBuffer An encoded CRL list. string The URL of a CRL (e.g. http://crl.cacert.org/revoke.crl).
(string | ArrayBuffer)[]
void
get documentAccessPermissions(): AccessPermissions;
Gets the information provided by the signer to enable a recipient to contact the signer to verify the signature (for example, a phone number).
set documentAccessPermissions(value): void;
Sets the information provided by the signer to enable a recipient to contact the signer to verify the signature (for example, a phone number).
void
Pkcs7SignerBase.documentAccessPermissions
get externalResourcesOptions(): ExternalResourcesOptions;
Gets configuration options used to retrieve external X.509-related resources.
These options control how resources such as CRLs, OCSP responses, and TSA data are resolved and fetched, including URL rewriting, custom network handling, and request lifecycle hooks.
The current external resources configuration, or undefined
if default behavior is used.
set externalResourcesOptions(value): void;
Sets configuration options used to retrieve external X.509-related resources.
This allows customizing how external resources are accessed, for example:
The external resources configuration to apply,
or undefined to use the default behavior.
void
Pkcs7SignerBase.externalResourcesOptions
get format(): Pkcs7SignatureFormat;
Gets or sets the PKCS#7 signature format.
get hashAlgorithmOID(): HashAlgorithm;
Gets the object identifier (OID) of hash algorithm used to generate the signature. Note! If format Pkcs7SignatureFormat#adbe_pkcs7_sha1 then this property is ignored and always SHA-1 used.
OID.HashAlgorithms
const signer.hashAlgorithm = OID.HashAlgorithms.SHA512;
set hashAlgorithmOID(value): void;
Sets the object identifier (OID) of hash algorithm used to generate the signature. Note! If format Pkcs7SignatureFormat#adbe_pkcs7_sha1 then this property is ignored and always SHA-1 used.
OID.HashAlgorithms
const signer.hashAlgorithm = OID.HashAlgorithms.SHA512;
void
get includeOcsp(): boolean;
Gets a value indicating whether to include OCSP information into the signature.
boolean
set includeOcsp(value): void;
Sets a value indicating whether to include OCSP information into the signature.
boolean
void
get location(): string;
Gets the CPU host name or physical location of the signing.
string
set location(value): void;
Sets the CPU host name or physical location of the signing.
string
void
get privateKeyPem(): string;
Gets the private key used to generate the digital signature for the PDF document.
The private key must correspond to the public key contained in the signer's certificate included in the PKCS#7 (CMS) signature.
The key is expected to be provided in PEM format (e.g., PKCS#8 PEM). It should be handled securely and never exposed or persisted in an unprotected form.
string
set privateKeyPem(value): void;
Sets the private key used to generate the digital signature for the PDF document.
The private key must correspond to the public key contained in the signer's certificate included in the PKCS#7 (CMS) signature.
The key is expected to be provided in PEM format (e.g., PKCS#8 PEM). It should be handled securely and never exposed or persisted in an unprotected form.
string
void
get reason(): string;
Gets the reason for the signing, such as "I agree...".
string
set reason(value): void;
Sets the reason for the signing, such as "I agree...".
string
void
get signatureAppearance(): SignatureAppearance;
Gets a SignatureAppearance object defining the visual appearance of the generated signature. By default this property is initialized with a default instance of the SignatureAppearance class. If null, the appearance streams of the signature field's widget are left as is (not regenerated during signing).
set signatureAppearance(value): void;
Sets a SignatureAppearance object defining the visual appearance of the generated signature. By default this property is initialized with a default instance of the SignatureAppearance class. If null, the appearance streams of the signature field's widget are left as is (not regenerated during signing).
void
Pkcs7SignerBase.signatureAppearance
get signatureField(): Field;
Gets an AcroForm field used to store a digital signature. If SignatureField.Widget is not null, a visual appearance will be generated based on values of the properties signingDateTime, location etc.
set signatureField(value): void;
Sets an AcroForm field used to store a digital signature. If SignatureField.Widget is not null, a visual appearance will be generated based on values of the properties signingDateTime, location etc.
void
Pkcs7SignerBase.signatureField
get signerName(): string;
Gets the name of the person or authority signing the document. NOTE: This value is used only if it is not possible to extract the name from the signature, for example from the certificate of the signer. By default this property is initialized with: process.env.USER || process.env.USERNAME.
string
set signerName(value): void;
Sets the name of the person or authority signing the document. NOTE: This value is used only if it is not possible to extract the name from the signature, for example from the certificate of the signer. By default this property is initialized with: process.env.USER || process.env.USERNAME.
string
void
get signingDateTime(): PdfDateTime;
Gets the time of signing. NOTE: This value is used only if the time of signing is not available in the signature. For example, a time stamp can be embedded in a PKCS#7 binary data object. By default this property is initialized with the current date and time.
set signingDateTime(value): void;
Sets the time of signing. NOTE: This value is used only if the time of signing is not available in the signature. For example, a time stamp can be embedded in a PKCS#7 binary data object. By default this property is initialized with the current date and time.
void
Pkcs7SignerBase.signingDateTime
get timeStampProvider(): TimeStampProviderBase;
Gets the TimeStampProviderBase object that is used to generate the time-stamp token included in the digital signature of the document.
set timeStampProvider(value): void;
Sets the TimeStampProviderBase object that is used to generate the time-stamp token included in the digital signature of the document.
void
Pkcs7SignerBase.timeStampProvider
buildSignatureContainer(docHash, signParams): Promise<Uint8Array<ArrayBufferLike>>;
Builds a PKCS#7 (CMS) signature container for the specified document byte ranges.
This method implements the third stage of the signing process. It constructs a complete detached signature container by:
The resulting container can be embedded into a PDF signature field.
Uint8Array
The document hash used to calculate signature
Parameters produced by Pkcs7SignerBase.getSignParams, including certificate chain, revocation data, and additional signing configuration.
Promise<Uint8Array<ArrayBufferLike>>
A DER-encoded PKCS#7 (CMS) signature container as a Uint8Array.
May throw if signature generation fails or if the timestamp provider (when configured) fails to produce a valid timestamp token.
Pkcs7SignerBase.buildSignatureContainer
getSignParams(): Promise<SignParams>;
Prepares parameters required for the first stage of the signing process.
This method performs validation, initializes signing-related data, and collects all inputs required for building the final signature container. It corresponds to the "preparation stage" of signing.
Promise<SignParams>
A SignParams object containing:
If the configured signature format is invalid or unsupported.