PSPDFSignatureContents

Objective-C

@protocol PSPDFSignatureContents <NSObject>

Swift

protocol PDFSignatureContents : NSObjectProtocol

An interface for producing content that will be inside the Contents key of a signature dictionary.

This interface abstracts the digital signature that can be in a signature form field so that you can create your own and place it inside the document. You can call -[PSPDFSigner prepareFormElement:toBeSignedWithAppearance:contents:writingToDataSink:completion:] and pass an instance of this interface to prepare a document for digital signing.

  • Given some dataToSign, return the digital signature contents that will be placed in the PDF document. dataToSign is the raw range of the PDF document that should be covered by the signature. In a specific implementation, you may hash the data, encrypt it, and then return it serialized in PKCS#7 format (https://tools.ietf.org/html/rfc2315).

    Declaration

    Objective-C

    - (nonnull NSData *)signData:(nonnull NSData *)dataToSign;

    Swift

    func sign(_ dataToSign: Data) -> Data