Embedded Timestamp Tokens with custom signing API using JavaScript

The custom signing API also allows the creation and insertion of embedded secure (signed) timestamp tokens, which is a requirement of certain higher levels of PAdES-format signature conformance.

It is necessary to add to the VerificationOptions a trusted root certificate corresponding to the chain used by the timestamp authority to sign the timestamp token, in order for the timestamp response to be verifiable during embedded timestamp creation.

By default, we only check online for revocation of certificates using the newer and lighter OCSP protocol as opposed to CRL, due to lower resource usage and greater reliability. However, it may be necessary to enable online CRL revocation checking in order to verify some timestamps (i.e. those that do not have an OCSP responder URL for all non-trusted certificates).

JavaScript (v8.0+)

1const tst_config = await new PDFNet.TimestampingConfiguration(in_timestamp_authority_url);
2const opts = await new PDFNet.VerificationOptions(PDFNet.VerificationOptions.SecurityLevel.e_compatibility_and_archiving);
3await opts.addTrustedCertificate(in_timestamp_authority_root_certificate_path);
4await opts.enableOnlineCRLRevocationChecking(true);
5const result = await digsig_field.generateContentsWithEmbeddedTimestamp(tst_config, opts);
6
7if (!(await result.getStatus()))
8{
9 console.log(await result.getString());
10 throw new Error();
11}
12const buf = await doc.saveCustomSignature(await result.getData(), digsig_field);

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales