module HexaPDF::DigitalSignature::Signing

This module contains everything related to the signing of a PDF document, i.e. signing handlers and the actual code for signing.

  • The DefaultHandler is the standard signing handler and should be sufficient for most cases.

  • The TimestampHandler is used for timestamping purposes.

  • The SignedDataCreator provides the functionality to create custom CMS signed data objects.

Public Class Methods

embed_signature(io, signature)

Embeds the given signature into the /Contents value of the newest signature dictionary of the PDF document given by the io argument.

This functionality can be used together with the support for external signing (see DefaultHandler and DefaultHandler#external_signing) to implement asynchronous signing.

Note: This will, most probably, only work on documents prepared for external signing by HexaPDF and not by other libraries.

locate_signature_dict(xref_section, start_xref_position, signature_oid)

Uses the information in the given cross-reference section as well as the byte offset of the cross-reference section to calculate the offset and length of the signature dictionary with the given object id.

replace_signature_contents(signature_data, contents)

Replaces the value of the /Contents key in the serialized signature_data with the value of contents.