Package eu.europa.esig.dss.pdf
Class AbstractPDFSignatureService
- java.lang.Object
-
- eu.europa.esig.dss.pdf.AbstractPDFSignatureService
-
- All Implemented Interfaces:
PDFSignatureService,PDFTimestampService
- Direct Known Subclasses:
ITextPDFSignatureService,PdfBoxSignatureService
public abstract class AbstractPDFSignatureService extends Object implements PDFSignatureService, PDFTimestampService
-
-
Field Summary
Fields Modifier and Type Field Description protected SignatureDrawerFactorysignatureDrawerFactoryprotected booleantimestamp
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPDFSignatureService(boolean timestamp, SignatureDrawerFactory signatureDrawerFactory)Constructor for the PDFSignatureService
-
Method Summary
Modifier and Type Method Description protected Map<String,Long>buildKnownObjects(List<DSSDictionaryCallback> callbacks)This method builds a Map of known Objects (extracted from previous DSS Dictionaries).protected StringgetFilter(PAdESSignatureParameters parameters)protected SignatureImageParametersgetImageParameters(PAdESSignatureParameters parameters)protected byte[]getOriginalBytes(int[] byteRange, byte[] signedContent)protected StringgetSignatureName(PAdESSignatureParameters parameters)protected abstract List<PdfSignatureOrDocTimestampInfo>getSignatures(CertificatePool validationCertPool, DSSDocument document)protected byte[]getSignatureValue(DSSDocument dssDocument, int[] byteRange)protected byte[]getSignedContent(DSSDocument dssDocument, int[] byteRange)protected StringgetSubFilter(PAdESSignatureParameters parameters)protected StringgetTokenDigest(Token token)protected StringgetType()protected booleanisContentValueEqualsByteRangeExtraction(DSSDocument document, int[] byteRange, byte[] cms, String signatureName)protected voidlinkSignatures(List<PdfSignatureOrDocTimestampInfo> signatures)This method links previous signatures to the new one.DSSDocumenttimestamp(DSSDocument document, PAdESSignatureParameters parameters, TSPSource tspSource)protected voidvalidateByteRange(int[] byteRange)voidvalidateSignatures(CertificatePool validationCertPool, DSSDocument document, SignatureValidationCallback callback)Retrieves and triggers validation of the signatures from a PDF document-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface eu.europa.esig.dss.pdf.PDFSignatureService
addDssDictionary, addNewSignatureField, digest, getAvailableSignatureFields, sign
-
-
-
-
Field Detail
-
timestamp
protected final boolean timestamp
-
signatureDrawerFactory
protected final SignatureDrawerFactory signatureDrawerFactory
-
-
Constructor Detail
-
AbstractPDFSignatureService
protected AbstractPDFSignatureService(boolean timestamp, SignatureDrawerFactory signatureDrawerFactory)Constructor for the PDFSignatureService- Parameters:
timestamp- if true, the instance is used to generate DocumentTypestamp if false, it is used to generate a signature layersignatureDrawerFactory- the factory ofSignatureDrawer
-
-
Method Detail
-
getType
protected String getType()
-
getFilter
protected String getFilter(PAdESSignatureParameters parameters)
-
getSubFilter
protected String getSubFilter(PAdESSignatureParameters parameters)
-
getImageParameters
protected SignatureImageParameters getImageParameters(PAdESSignatureParameters parameters)
-
getSignatureName
protected String getSignatureName(PAdESSignatureParameters parameters)
-
timestamp
public DSSDocument timestamp(DSSDocument document, PAdESSignatureParameters parameters, TSPSource tspSource)
- Specified by:
timestampin interfacePDFTimestampService
-
validateSignatures
public void validateSignatures(CertificatePool validationCertPool, DSSDocument document, SignatureValidationCallback callback)
Description copied from interface:PDFSignatureServiceRetrieves and triggers validation of the signatures from a PDF document- Specified by:
validateSignaturesin interfacePDFSignatureService- Parameters:
validationCertPool- the certificate pooldocument- the document to be validatedcallback- callback for signature validation
-
getSignatures
protected abstract List<PdfSignatureOrDocTimestampInfo> getSignatures(CertificatePool validationCertPool, DSSDocument document)
-
linkSignatures
protected void linkSignatures(List<PdfSignatureOrDocTimestampInfo> signatures)
This method links previous signatures to the new one. This is useful to get revision number and to know if a TSP is over the DSS dictionary
-
getSignedContent
protected byte[] getSignedContent(DSSDocument dssDocument, int[] byteRange) throws IOException
- Throws:
IOException
-
isContentValueEqualsByteRangeExtraction
protected boolean isContentValueEqualsByteRangeExtraction(DSSDocument document, int[] byteRange, byte[] cms, String signatureName)
-
getSignatureValue
protected byte[] getSignatureValue(DSSDocument dssDocument, int[] byteRange) throws IOException
- Throws:
IOException
-
getOriginalBytes
protected byte[] getOriginalBytes(int[] byteRange, byte[] signedContent)
-
validateByteRange
protected void validateByteRange(int[] byteRange)
-
buildKnownObjects
protected Map<String,Long> buildKnownObjects(List<DSSDictionaryCallback> callbacks)
This method builds a Map of known Objects (extracted from previous DSS Dictionaries). This map will be used to avoid duplicate the same objects between layers.- Parameters:
callbacks-- Returns:
-
-