Package eu.europa.esig.dss.pdf
Interface PDFSignatureService
- All Known Implementing Classes:
AbstractPDFSignatureService,ITextPDFSignatureService,PdfBoxSignatureService
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 TypeMethodDescriptionaddDssDictionary(DSSDocument document, PdfValidationDataContainer validationDataForInclusion) This method adds the DSS dictionary (Baseline-LT) to a document without password-protection and without VRI dictionary.addDssDictionary(DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd) This method adds the DSS dictionary (Baseline-LT) to a password-protected document without inclusion of VRI dictionary.addDssDictionary(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.addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters) This method allows to add a new signature field to an existing pdf documentaddNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, char[] pwd) This method allows to add a new signature field to an existing encrypted pdf documentvoidanalyzePdfModifications(DSSDocument document, List<AdvancedSignature> signatures, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for signaturesvoidanalyzeTimestampPdfModifications(DSSDocument document, List<TimestampToken> timestamps, char[] pwd) Analyze the PDF revision and try to detect any modification (shadow attacks) for PDf document timestampsgetAvailableSignatureFields(DSSDocument document) This method returns not signed signature-fieldsgetAvailableSignatureFields(DSSDocument document, char[] pwd) Returns not-signed signature fields from an encrypted documentgetRevisions(DSSDocument document, char[] pwd) Retrieves revisions from a PDF documentmessageDigest(DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns the message-digest computed on PDF signature revision's ByteRangepreviewPageWithVisualSignature(DSSDocument toSignDocument, PAdESCommonParameters parameters) Returns a page preview with the visual signaturepreviewSignatureField(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(DSSResourcesHandlerBuilder resourcesHandlerBuilder) SetsDSSResourcesFactoryBuilderto be used for aDSSResourcesHandlercreation in internal methods.sign(DSSDocument toSignDocument, byte[] cmsSignedData, PAdESCommonParameters parameters) Signs a PDF document
-
Method Details
-
messageDigest
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
DSSDocument sign(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
DSSDocument addDssDictionary(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
DSSDocument addDssDictionary(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
DSSDocument addDssDictionary(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
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
DSSDocument addNewSignatureField(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
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(DSSDocument document, List<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
DSSDocument previewPageWithVisualSignature(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
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
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
-