PSPDFExternalSignature

Objective-C

@protocol PSPDFExternalSignature <NSObject>

Swift

protocol ExternalSignature : NSObjectProtocol

The PSPDFExternalSignature protocol is adopted by an object that provides an external signature for a PDF document. You set the externalSignatureDelegate property in a PSPDFSigner class or subclass when you want to control the digital signing process with an external signature (for example, a signature that is implemented by a hardware device or by an external webservice).

  • This callback method is invoked when the digital signing process needs to cryptographically sign a hash of a PDF document. Read the digital signature guides for more information about the digital signing process.

    Declaration

    Objective-C

    - (nonnull NSData *)signData:(nonnull NSData *)data
                   hashAlgorithm:(PSPDFSignatureHashAlgorithm)hashAlgorithm;

    Swift

    func sign(_ data: Data, hashAlgorithm: PDFSignatureHashAlgorithm) -> Data

    Parameters

    data

    The part of the document that needs to be hashed and signed before creating the digital signature.

    hashAlgorithm

    The hash algorithm that must be used to digest the data parameter.

    Return Value

    The signed data. Note that you must sign the data using the correspondent private key to the certificate that was used when the signing process was started (see in PSPDFSigner the signFormElement: family of methods). Otherwise, the digital signature will be invalid.

  • The encryption algorithm to use in the digital signing process.

    Declaration

    Objective-C

    - (PSPDFSignatureEncryptionAlgorithm)encryptionAlgorithm;

    Swift

    func encryptionAlgorithm() -> PDFSignatureEncryptionAlgorithm