java.lang.Object | ||
↳ | com.pspdfkit.signatures.signers.Signer | |
↳ | com.pspdfkit.signatures.signers.ContainedSignaturesSigner |
Signer for contained signatures workflow. Contained digital signatures are especially useful when the cryptographic material to sign a document (keys, certificates) is not available on the local device.
To use contained signatures:
prepareFormFieldForSigningAsync(SignerOptions)
. This method stamps a custom signature
appearance and reserves space in the PDF for the digital signature.
embedSignatureInFormFieldAsync(SignatureFormField, SignatureContents, OutputStream)
. The end result is a digitally signed document.
The recommended way to use this API is to override prepareSignatureContents(SignerOptions, File, PdfDocument, SignatureFormField)
and return a
valid digital signature in the cryptographic PKCS#7 format for the prepared document. The signFormFieldAsync(SignerOptions)
already encapsulates the whole
contained signatures flow.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ContainedSignaturesSigner(String displayName)
Create the signer.
| |||||||||||
ContainedSignaturesSigner(Context context, String displayName)
Create the signer with a digital signature subfilter type set as
ADOBE_PKCS7_DETACHED . | |||||||||||
ContainedSignaturesSigner(Context context, String displayName, FilterSubtype filterSubtype)
Create the signer with a specific digital signature subfilter type.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Completable |
signFormFieldAsync(SignerOptions signerOptions)
Signs a
SignatureFormField form element (and with that, the document) asynchronously on a background thread. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract SignatureContents |
prepareSignatureContents(SignerOptions signerOptions, File preparedDocumentFile, PdfDocument preparedDocument, SignatureFormField preparedFormField)
Implement this method to return a custom implementation of
SignatureContents that should embedded as a digital signature when
signing. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Create the signer.
displayName | The human readable name of this signer. |
---|
Create the signer with a digital signature subfilter type set as ADOBE_PKCS7_DETACHED
.
context | Context to use during the contained signatures flow. |
---|---|
displayName | The human readable name of this signer. |
Create the signer with a specific digital signature subfilter type.
context | Context to use during the contained signatures flow. |
---|---|
displayName | The human readable name of this signer. |
filterSubtype | Signature "SubFilter" type in the PDF. |
Signs a SignatureFormField
form element (and with that, the document) asynchronously on a background thread.
signerOptions | The SignerOptions to use for signing this document. |
---|
Implement this method to return a custom implementation of SignatureContents
that should embedded as a digital signature when
signing.
You are responsible for generating a valid digital signature in the cryptographic PKCS#7
format for the prepared document. In order to do that, return a custom implementation of SignatureContents
. You'll receive
the part of the document that you need to hash, encrypt, and package into a digital signature in signData(byte[])
. You can use getHashForDocumentRange(List, HashAlgorithm)
to help you
calculate the hash value of signed parts of a PDF document. You can generate the PKCS7 signature container with the help of our
PKCS7
class or use PKCS7SignatureContents
directly.
signerOptions | Signer options used for signing passed to signFormFieldAsync(SignerOptions) . |
---|---|
preparedDocumentFile | File with the document prepared via prepareFormFieldForSigningAsync(SignerOptions) |
preparedDocument | Document prepared via prepareFormFieldForSigningAsync(SignerOptions) |
preparedFormField | Signature form field in the prepared document. |
SignatureContents
that should be embedded as a signature.