public abstract class

Signer

extends Object
java.lang.Object
   ↳ com.pspdfkit.signatures.signers.Signer
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Represents a signer (person and algorithm) used to digitally sign a document. Implementations of this class are, for example, MemorySigner and Pkcs12Signer. Subclasses need to implement prepareSigningParameters(OnSigningParametersReadyCallback) which will be called by the signer whenever a digital signing operation is initiated.

Summary

Nested Classes
interface Signer.OnSigningCompleteCallback Called by the Signer whenever it completed digitally signing a PDF or an error occurred while trying. 
interface Signer.OnSigningParametersReadyCallback Callback passed to prepareSigningParameters(OnSigningParametersReadyCallback) whenever a signing process was initiated and the signer needs to load its SignatureProvider
Protected Constructors
Signer(String displayName)
Create the Signer.
Public Methods
final String getDisplayName()
Gets the display name of this signer for use in the UI.
final void signFormField(SignatureFormField signatureFormField, BiometricSignatureData biometricSignatureData, OutputStream destination, Signer.OnSigningCompleteCallback callback)
Signs a SignatureFormField form element (and with that, the document).
final Completable signFormFieldAsync(SignatureFormField signatureFormField, BiometricSignatureData biometricSignatureData, OutputStream destination)
Signs a SignatureFormField form element (and with that, the document) asynchronously on a background thread.
Protected Methods
abstract void prepareSigningParameters(Signer.OnSigningParametersReadyCallback callback)
Called by Signer whenever the implementation should prepare required signing parameters.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected Signer (String displayName)

Create the Signer.

Parameters
displayName The human readable name of this signer.

Public Methods

public final String getDisplayName ()

Gets the display name of this signer for use in the UI. This is usually the name of the person that is signing the document.

Returns
  • A string representing the name of this signer.

public final void signFormField (SignatureFormField signatureFormField, BiometricSignatureData biometricSignatureData, OutputStream destination, Signer.OnSigningCompleteCallback callback)

Signs a SignatureFormField form element (and with that, the document).

NOTE: Signing a document requires reading it in full and will take a lot of time. Do not attempt to invoke that on main thread. Prefer to use signFormFieldAsync(SignatureFormField, BiometricSignatureData, OutputStream) if possible.

Parameters
signatureFormField Signature form field to be signed.
biometricSignatureData BiometricSignatureData that will be written to the digital signature. May be null.
destination Destination where the signed document will be written. @throws SigningFailedException thrown when signing has failed.

public final Completable signFormFieldAsync (SignatureFormField signatureFormField, BiometricSignatureData biometricSignatureData, OutputStream destination)

Signs a SignatureFormField form element (and with that, the document) asynchronously on a background thread.

Parameters
signatureFormField Signature form field to be signed.
biometricSignatureData BiometricSignatureData that will be written to the digital signature. May be null.
destination Destination where the signed document will be written.
Returns

Protected Methods

protected abstract void prepareSigningParameters (Signer.OnSigningParametersReadyCallback callback)

Called by Signer whenever the implementation should prepare required signing parameters. This is an asynchronous operation, which is completed by the implementation handing over the signing parameters using the given Signer.OnSigningParametersReadyCallback. Signing parameters include:

  • A SignatureProvider that implements the actual data signing logic (i.e. signing and hashing PDF data).
  • The X509Certificate that is embedded to the PDF document while signing.

Parameters
callback An Signer.OnSigningParametersReadyCallback that should be called by the implementation to hand over all required signing parameters.