public abstract class

PrivateKeySigner

extends Signer
implements InteractiveSigner
java.lang.Object
   ↳ com.pspdfkit.signatures.signers.Signer
     ↳ com.pspdfkit.signatures.signers.PrivateKeySigner
Known Direct Subclasses

Class Overview

A Signer implementation for digitally signing PDFs using a KeyStore.PrivateKeyEntry. Subclasses have to provide the private key whenever loadPrivateKey(String, LoadingFeedbackListener, OnPrivateKeyLoadedCallback) is called. This class implements InteractiveSigner which can be used to retrieve a password from the user if required while loading the private key.

Summary

Nested Classes
interface PrivateKeySigner.OnPrivateKeyLoadedCallback Callback for subclasses to provide the private key used for signing. 
Protected Constructors
PrivateKeySigner(String displayName)
Create the signer using the given displayName.
Public Methods
final void setLoadingFeedbackListener(InteractiveSigner.LoadingFeedbackListener listener)
Sets a listener for being notified of important events that require user interaction.
final void unlockPrivateKeyWithPassword(String password)
Can be used to provide a password to the signer, which might be used to unlock a private key (or similar).
Protected Methods
abstract void loadPrivateKey(String password, InteractiveSigner.LoadingFeedbackListener feedbackListener, PrivateKeySigner.OnPrivateKeyLoadedCallback onPrivateKeyLoadedCallback)
Loads the KeyStore.PrivateKeyEntry used by this signer.
final void prepareSigningParameters(Signer.OnSigningParametersReadyCallback callback)
Called by Signer whenever the implementation should prepare required signing parameters.
[Expand]
Inherited Methods
From class com.pspdfkit.signatures.signers.Signer
From class java.lang.Object
From interface com.pspdfkit.signatures.signers.InteractiveSigner

Protected Constructors

protected PrivateKeySigner (String displayName)

Create the signer using the given displayName.

Parameters
displayName Human readable name of this signer.

Public Methods

public final void setLoadingFeedbackListener (InteractiveSigner.LoadingFeedbackListener listener)

Sets a listener for being notified of important events that require user interaction.

Parameters
listener A LoadingFeedbackListener for receiving important events.

public final void unlockPrivateKeyWithPassword (String password)

Can be used to provide a password to the signer, which might be used to unlock a private key (or similar).

Parameters
password A password that should be used by the signer, or null if no password is required.

Protected Methods

protected abstract void loadPrivateKey (String password, InteractiveSigner.LoadingFeedbackListener feedbackListener, PrivateKeySigner.OnPrivateKeyLoadedCallback onPrivateKeyLoadedCallback)

Loads the KeyStore.PrivateKeyEntry used by this signer. Subclasses have to override this and have to make sure to call the provided PrivateKeySigner.OnPrivateKeyLoadedCallback whenever private key is ready. The method might be called with a LoadingFeedbackListener which should be used by the implementation to notify of important events (e.g. password required, key loading complete, etc.).

Parameters
password An optional password that should be used to load the private key.
feedbackListener A LoadingFeedbackListener to be notified of important loading events, or null.
onPrivateKeyLoadedCallback An PrivateKeySigner.OnPrivateKeyLoadedCallback that should be called once the private key has been loaded.

protected final 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 OnSigningParametersReadyCallback that should be called by the implementation to hand over all required signing parameters.