Some test text!

Search
Hamburger Icon

Web / Guides / Long-Term Validation

Add Long-Term Validation (LTV) information for a signature using JavaScript

Make sure you have Full API enabled in WebViewer.

Long-term Validation (LTV) enables validating a signature on a document at the time it was signed at any time in the future, regardless of any changes made to technology specifications in the future. When LTV is added to a signature, the trusted root certificate that is used has its sign-time status captured and stored inside the PDF document. Regardless of the certificate's expiry or revocation status in the future, the LTV enabled signature guarantees the validity of the signature at the time it was signed.

To add Long-Term Validation (LTV) information for a signature (these examples assume and use an existing DocTimeStamp for LTV addition):

async function main() {
	const opts = await PDFNet.VerificationOptions.create(PDFNet.VerificationOptions.SecurityLevel.e_compatibility_and_archiving);
	await opts.addTrustedCertificateUString(in_trusted_cert_path);
	/* 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). */
	await opts.enableOnlineCRLRevocationChecking(true);
	const timestamp_verification_result = await doctimestamp_signature_field.verify(opts);
	if (!(await doctimestamp_signature_field.enableLTVOfflineVerification(timestamp_verification_result))) {
		console.log('Could not enable LTV for DocTimeStamp.');
		return false;
	}
	await doc.save(in_outpath, PDFNet.SDFDoc.SaveOptions.e_incremental);
}
PDFNet.runWithCleanup(main);

Digital signatures
Full code sample which demonstrates using the digital signature API to digitally sign, certify, and/or verify PDF documents.

Get the answers you need: Chat with us