- All Known Implementing Classes:
AbstractPDFSignatureService
public interface PDFSignatureService
The usage of this interface permits the user to choose the underlying PDF library used to create PDF signatures.
-
Method Summary
Modifier and TypeMethodDescriptioneu.europa.esig.dss.model.DSSDocumentaddDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion) This method adds the DSS dictionary (Baseline-LT) to a document without password-protection and without VRI dictionary.eu.europa.esig.dss.model.DSSDocumentaddDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd) This method adds the DSS dictionary (Baseline-LT) to a password-protected document without inclusion of VRI dictionary.eu.europa.esig.dss.model.DSSDocumentaddDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd, boolean includeVRIDict) This method adds the DSS dictionary (Baseline-LT) to a password-protected document with a VRI dictionary if defined.eu.europa.esig.dss.model.DSSDocumentaddNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters) This method allows to add a new signature field to an existing pdf documenteu.europa.esig.dss.model.DSSDocumentaddNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters, char[] pwd) This method allows to add a new signature field to an existing encrypted pdf documentvoidanalyzePdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.validation.AdvancedSignature> signatures, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for signaturesvoidanalyzeTimestampPdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> timestamps, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for PDf document timestampsgetAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document) This method returns not signed signature-fieldsgetAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document, char[] pwd) Returns not-signed signature fields from an encrypted documentgetRevisions(eu.europa.esig.dss.model.DSSDocument document, char[] pwd) Retrieves revisions from a PDF documenteu.europa.esig.dss.model.DSSMessageDigestmessageDigest(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns the message-digest computed on PDF signature revision's ByteRangeeu.europa.esig.dss.model.DSSDocumentpreviewPageWithVisualSignature(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns a page preview with the visual signatureeu.europa.esig.dss.model.DSSDocumentpreviewSignatureField(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns a preview of the signature fieldvoidsetPdfDifferencesFinder(PdfDifferencesFinder pdfDifferencesFinder) Sets thePdfDifferencesFinderused to find the differences on pages between given PDF revisions.voidsetPdfObjectModificationsFinder(PdfObjectModificationsFinder pdfObjectModificationsFinder) Sets thePdfObjectModificationsFinderused to find the differences between internal PDF objects occurred between given PDF revisions.voidsetPdfPermissionsChecker(PdfPermissionsChecker pdfPermissionsChecker) Sets thePdfPermissionsCheckerused to verify the PDF document rules for a new signature creationvoidsetPdfSignatureFieldPositionChecker(PdfSignatureFieldPositionChecker pdfSignatureFieldPositionChecker) Sets thePdfSignatureFieldPositionCheckerused to verify the validity of new signature field placement.voidsetResourcesHandlerBuilder(eu.europa.esig.dss.signature.resources.DSSResourcesHandlerBuilder resourcesHandlerBuilder) SetsDSSResourcesFactoryBuilderto be used for aDSSResourcesHandlercreation in internal methods.eu.europa.esig.dss.model.DSSDocumentsign(eu.europa.esig.dss.model.DSSDocument toSignDocument, byte[] cmsSignedData, PAdESCommonParameters parameters) Signs a PDF document
-
Method Details
-
messageDigest
eu.europa.esig.dss.model.DSSMessageDigest messageDigest(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns the message-digest computed on PDF signature revision's ByteRange- Parameters:
toSignDocument- the document to be signedparameters- the signature/timestamp parameters- Returns:
DSSMessageDigest
-
sign
eu.europa.esig.dss.model.DSSDocument sign(eu.europa.esig.dss.model.DSSDocument toSignDocument, byte[] cmsSignedData, PAdESCommonParameters parameters) Signs a PDF document- Parameters:
toSignDocument- the pdf document to be signedcmsSignedData- the encoded CMS Signed dataparameters- the signature/timestamp parameters- Returns:
DSSDocument
-
getRevisions
Retrieves revisions from a PDF document- Parameters:
document- the document to extract revisions frompwd- the password protection phrase used to encrypt the PDF document use 'null' value for not an encrypted document- Returns:
- list of extracted
PdfRevisions
-
addDssDictionary
eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion) This method adds the DSS dictionary (Baseline-LT) to a document without password-protection and without VRI dictionary.- Parameters:
document- the document to be extendedvalidationDataForInclusion-PdfValidationDataContainer- Returns:
- the pdf document with the added dss dictionary
-
addDssDictionary
eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd) This method adds the DSS dictionary (Baseline-LT) to a password-protected document without inclusion of VRI dictionary.- Parameters:
document- the document to be extendedvalidationDataForInclusion-PdfValidationDataContainerpwd- the password protection used to create the encrypted document (optional)- Returns:
- the pdf document with the added dss dictionary
-
addDssDictionary
eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd, boolean includeVRIDict) This method adds the DSS dictionary (Baseline-LT) to a password-protected document with a VRI dictionary if defined.- Parameters:
document- the document to be extendedvalidationDataForInclusion-PdfValidationDataContainerpwd- the password protection used to create the encrypted document (optional)includeVRIDict- defines whether VRI dictionary should be included to the created DSS dictionary- Returns:
- the pdf document with the added dss dictionary
-
getAvailableSignatureFields
This method returns not signed signature-fields- Parameters:
document- the pdf document- Returns:
- the list of empty signature fields
-
getAvailableSignatureFields
Returns not-signed signature fields from an encrypted document- Parameters:
document- the pdf documentpwd- the password protection phrase used to encrypt the document- Returns:
- the list of not signed signature field names
-
addNewSignatureField
eu.europa.esig.dss.model.DSSDocument addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters) This method allows to add a new signature field to an existing pdf document- Parameters:
document- the pdf documentparameters- the parameters with the coordinates,... of the signature field- Returns:
- the pdf document with the new added signature field
-
addNewSignatureField
eu.europa.esig.dss.model.DSSDocument addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters, char[] pwd) This method allows to add a new signature field to an existing encrypted pdf document- Parameters:
document- the pdf documentparameters- the parameters with the coordinates,... of the signature fieldpwd- the password protection used to create the encrypted document (optional)- Returns:
- the pdf document with the new added signature field
-
analyzePdfModifications
void analyzePdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.validation.AdvancedSignature> signatures, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for signatures- Parameters:
document-DSSDocumentthe documentsignatures- the different signatures to be analysedpwd-Stringpassword protection
-
analyzeTimestampPdfModifications
void analyzeTimestampPdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> timestamps, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for PDf document timestamps- Parameters:
document-DSSDocumentthe documenttimestamps- the detached document timestamps to be analysedpwd-Stringpassword protection
-
previewPageWithVisualSignature
eu.europa.esig.dss.model.DSSDocument previewPageWithVisualSignature(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns a page preview with the visual signature- Parameters:
toSignDocument- the document to be signedparameters- the signature/timestamp parameters- Returns:
- a DSSDocument with the PNG picture
-
previewSignatureField
eu.europa.esig.dss.model.DSSDocument previewSignatureField(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns a preview of the signature field- Parameters:
toSignDocument- the document to be signedparameters- the signature/timestamp parameters- Returns:
- a DSSDocument with the PNG picture
-
setResourcesHandlerBuilder
void setResourcesHandlerBuilder(eu.europa.esig.dss.signature.resources.DSSResourcesHandlerBuilder resourcesHandlerBuilder) SetsDSSResourcesFactoryBuilderto be used for aDSSResourcesHandlercreation in internal methods.DSSResourcesHandlerdefines a way to operate with OutputStreams and createDSSDocuments. Default :eu.europa.esig.dss.signature.resources.InMemoryResourcesHandler. Works with data in memory.- Parameters:
resourcesHandlerBuilder-DSSResourcesHandlerBuilder
-
setPdfDifferencesFinder
Sets thePdfDifferencesFinderused to find the differences on pages between given PDF revisions. Default :eu.europa.esig.dss.pdf.modifications.DefaultPdfDifferencesFinder- Parameters:
pdfDifferencesFinder-PdfDifferencesFinder
-
setPdfObjectModificationsFinder
Sets thePdfObjectModificationsFinderused to find the differences between internal PDF objects occurred between given PDF revisions. Default :eu.europa.esig.dss.pdf.modifications.DefaultPdfObjectModificationsFinder- Parameters:
pdfObjectModificationsFinder-PdfObjectModificationsFinder
-
setPdfPermissionsChecker
Sets thePdfPermissionsCheckerused to verify the PDF document rules for a new signature creation- Parameters:
pdfPermissionsChecker-PdfPermissionsChecker
-
setPdfSignatureFieldPositionChecker
void setPdfSignatureFieldPositionChecker(PdfSignatureFieldPositionChecker pdfSignatureFieldPositionChecker) Sets thePdfSignatureFieldPositionCheckerused to verify the validity of new signature field placement. For example to ensure the new signature field lies within PDF page borders and/or it does not overlap with existing signature fields.- Parameters:
pdfSignatureFieldPositionChecker-PdfPermissionsChecker
-