Package eu.europa.esig.dss.pdf
Class AbstractPDFSignatureService
java.lang.Object
eu.europa.esig.dss.pdf.AbstractPDFSignatureService
- All Implemented Interfaces:
PDFSignatureService,PDFTimestampService
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(eu.europa.esig.dss.spi.x509.CertificatePool validationCertPool, eu.europa.esig.dss.model.DSSDocument document)protected byte[]getSignatureValue(eu.europa.esig.dss.model.DSSDocument dssDocument, int[] byteRange)protected byte[]getSignedContent(eu.europa.esig.dss.model.DSSDocument dssDocument, int[] byteRange)protected StringgetSubFilter(PAdESSignatureParameters parameters)protected StringgetTokenDigest(eu.europa.esig.dss.model.x509.Token token)protected StringgetType()protected booleanisContentValueEqualsByteRangeExtraction(eu.europa.esig.dss.model.DSSDocument document, int[] byteRange, byte[] cms, String signatureName)protected voidlinkSignatures(List<PdfSignatureOrDocTimestampInfo> signatures)This method links previous signatures to the new one.eu.europa.esig.dss.model.DSSDocumenttimestamp(eu.europa.esig.dss.model.DSSDocument document, PAdESSignatureParameters parameters, eu.europa.esig.dss.spi.x509.tsp.TSPSource tspSource)protected voidvalidateByteRange(int[] byteRange)voidvalidateSignatures(eu.europa.esig.dss.spi.x509.CertificatePool validationCertPool, eu.europa.esig.dss.model.DSSDocument document, SignatureValidationCallback callback)Retrieves and triggers validation of the signatures from a PDF documentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.europa.esig.dss.pdf.PDFSignatureService
addDssDictionary, addNewSignatureField, digest, getAvailableSignatureFields, sign
-
Field Details
-
timestamp
protected final boolean timestamp -
signatureDrawerFactory
-
-
Constructor Details
-
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 Details
-
getType
-
getFilter
-
getSubFilter
-
getImageParameters
-
getSignatureName
-
timestamp
public eu.europa.esig.dss.model.DSSDocument timestamp(eu.europa.esig.dss.model.DSSDocument document, PAdESSignatureParameters parameters, eu.europa.esig.dss.spi.x509.tsp.TSPSource tspSource)- Specified by:
timestampin interfacePDFTimestampService
-
validateSignatures
public void validateSignatures(eu.europa.esig.dss.spi.x509.CertificatePool validationCertPool, eu.europa.esig.dss.model.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(eu.europa.esig.dss.spi.x509.CertificatePool validationCertPool, eu.europa.esig.dss.model.DSSDocument document) -
linkSignatures
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(eu.europa.esig.dss.model.DSSDocument dssDocument, int[] byteRange) throws IOException- Throws:
IOException
-
isContentValueEqualsByteRangeExtraction
protected boolean isContentValueEqualsByteRangeExtraction(eu.europa.esig.dss.model.DSSDocument document, int[] byteRange, byte[] cms, String signatureName) -
getSignatureValue
protected byte[] getSignatureValue(eu.europa.esig.dss.model.DSSDocument dssDocument, int[] byteRange) throws IOException- Throws:
IOException
-
getOriginalBytes
protected byte[] getOriginalBytes(int[] byteRange, byte[] signedContent) -
validateByteRange
protected void validateByteRange(int[] byteRange) -
buildKnownObjects
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:
-
getTokenDigest
-