PDF Signer
The PDF signer has the class name: org.signserver.module.PDFSigner.
Overview
The main purpose of the PDF signer is to add digital signatures to PDF documents.
The signer supports the addition of visible or invisible signatures. Both visible and invisible signatures serve the same purpose of signing document, and technically are equivalent in that sense. The difference is that when visible signature is applied to a document, signature image (in shape of rectangle) is placed at the specified place in the document, clicking on which will allow seeing properties of the signature (Adobe Acrobat Reader).
On the other hand when invisible signature is applied, signature properties are accessed through menu items. For visible signatures properties such as : custom signature image, signature rectangle, page at which signature rectangle to be drawn and others can be specified (see Available Properties below)
PDF Signer can also apply timestamp to a signature. If the signature is timestamped, it can be viewable through signature properties in Adobe Acrobat Reader. Timestamping is used to prove that document was signed before the time specified by timestamp token. If the signature is not timestamped then the signature time specified in the signature properties is not considered to be trusted. It is strongly advised to apply timestamp to a signature, and the TSA module can be used for this purpose.
Also CRL or OCSP Response of the signer's certificate can be embedded inside the signature package. Embedding CRL or OCSP response with the package will help validate signature even after the signer's certificate is expired. (Though it will not totally guarantee the long term signature preservation. Topic of long term signature preservation for archival purposes is a large one and is discussed to be implemented in future versions of SignServer).
The PDF Signer can also be configured to enforce that certain PDF permissions are not available in the signed document and/or that certain permissions should be removed.
PDF passwords
PDF documents can optionally be protected by a password. There are two different types of passwords:
-
User password: Also sometimes referred to as "open password" or "document password". Can be used for reading an encrypted document.
-
Owner password: Also sometimes referred to as "permission password" or "security restriction password". It can be used for reading an encrypted document and making changes to a document that has permissions.
If a document is protected by an Owner password, it has to be supplied with the request for SignServer to sign the document. If the document is protected by a User password, either the User password or the Owner password has to be supplied with the request for SignServer to sign the document.
PDFSigner Requests
PDF signing requests can be served using either web services or the web server interface (HTTP). See Integration for general information about the different interfaces.
For the web server interface the GenericProcessServlet can be used. The PDFSigner supports the extra request field "pdfPassword" letting the client supply a PDF password to be used for opening the PDF for signing (not required unless the PDF is already password protected).
For the old web services interface the request should contain an encoded GenericProcessesRequest and the response will be an GenericProcessResponse. It is possible to supply a PDF password by including it in the requestMetaData with the key "pdfPassword".
Worker Properties
The following properties can be configured with the signer:
Property |
Description |
||||||||||||
REASON |
The reason included in the PDF signature and displayed by the PDF reader. |
||||||||||||
LOCATION |
The location included in the PDF signature and displayed by the PDF reader. |
||||||||||||
ADD_VISIBLE_SIGNATURE |
Setting that control whether signature to be added should be visible or invisible. |
||||||||||||
VISIBLE_SIGNATURE_PAGE |
Specifies the page on which the visible signature will be drawn. This property is ignored if ADD_VISIBLE_SIGNATURE is set to False. Possible values:
Default: First. |
||||||||||||
VISIBLE_SIGNATURE_RECTANGLE |
Specifies the rectangle signature is going to be drawn in. Default: "400,700,500,800". |
||||||||||||
VISIBLE_SIGNATURE_CUSTOM_IMAGE_BASE64 & VISIBLE_SIGNATURE_CUSTOM_IMAGE_PATH |
If we want the visible signature to contain custom image, specify image as base64 encoded byte array. Alternatively, the custom image can be specified by giving a path to image on file system. If specifying a path to an image, "\" should be escaped (thus C:\photo.jpg => "C:\\photo.jpg"). If specifying image as base64 encoded byte array, "=" should be escaped (thus "BBCXMI==" => "BBCXMI\=\="). If both of properties are set, VISIBLE_SIGNATURE_CUSTOM_IMAGE_BASE64 will take priority. To disable the feature, do not set the properties. Note that in a clustered environment, it is advised to specify image as base64 string, since image data will be stored in a central database. Otherwise, each node should contain copy of the image, and each image managed separately (e.g. on image updates, or insertion of new image for different worker). |
||||||||||||
VISIBLE_SIGNATURE_CUSTOM_IMAGE_SCALE_TO_RECTANGLE |
If we want our custom image to be resized to specified rectangle (set by VISIBLE_SIGNATURE_RECTANGLE), then set to True. If set to True, the image might look different than the original (as an effect of resizing). If set to False, the rectangle drawn will be resized to specified image's sizes. |
||||||||||||
CERTIFICATION_LEVEL |
Set this property to have the document certified with a certifying signature. |
||||||||||||
TSA_URL |
If we want to timestamp document signature, specify timestamp authority URL. iI path contains characters "\" or "=" , these characters should be escaped (thus "\" = "\\", "=" =>"\="). Cannot be set at the same time as TSA_WORKER. Default: not set (no timestamping). |
||||||||||||
TSA_WORKER |
Specify a worker ID or worker name for a time stamp signer Use instead of TSA_URL when using a time stamp signer running in the same SignServer instance to avoid thread deadlocks under high load. Cannot be set at the same time as TSA_URL. Default: Not set (no timestamping). |
||||||||||||
TSA_USERNAME & TSA_PASSWORD |
If the TSA requires authentication for timestamping, specify username and password. If the TSA does not require authentication, do not set these properties. These properties are ignored if TSA_URL is not set (no timestamping). |
||||||||||||
TSA_DIGESTALGORITHM |
Algorithm for timestamp digests. Optional, default: SHA-256. |
||||||||||||
EMBED_OCSP_RESPONSE |
To embed the OCSP response for the signer certificate inside the signature package, set to True, otherwise set to False.
Issuer certificate (of signing certificate) should be in certificate chain. Default: False. |
||||||||||||
ARCHIVETODISK |
If we want the produced signed document to be stored in the local file system set this property to true and add the ARCHIVETODISK_PATH_BASE property explained below. |
||||||||||||
ARCHIVETODISK_PATH_BASE |
The file path to the folder to store the signed documents in. |
||||||||||||
ARCHIVETODISK_PATH_PATTERN |
Pattern used for creating sub-folders under the ARCHIVETODISK_PATH_BASE folder.
Default: "${DATE:yyyy/MM/dd}". |
||||||||||||
ARCHIVETODISK_FILENAME_PATTERN |
Pattern used for creating the filename. The same fields and syntax as for the ARCHIVETODISK_PATH_PATTERN property can be used. |
||||||||||||
REFUSE_DOUBLE_INDIRECT_OBJECTS |
True if PDF documents containing multiple indirect objects with the same name should be refused. Used to mitigate a collision signature vulnerability described in http://pdfsig-collision.florz.de/. Default: False. |
||||||||||||
REJECT_PERMISSIONS |
Reject signing of the document if any of the permissions in the comma separated list would be in the document.
Default: Unset/empty (no permissions are rejected) |
||||||||||||
SET_PERMISSIONS |
Replace the current permissions (if any) with the permissions specified in this comma separated list of permissions. Available permissions: The same permission names as for the property REJECT_PERMISSIONS. |
||||||||||||
REMOVE_PERMISSIONS |
Remove all permissions specified in this comma separated list from the document. Available permissions: The same permission names as for the property REJECT_PERMISSIONS. |
||||||||||||
SET_OWNERPASSWORD |
Sets the specified password as owner password in the document. |
||||||||||||
DIGESTALGORITHM |
Sets the hash algorithm used for the message digest and signature hash.
Default setting is SHA256. |