Package eu.europa.esig.dss.pdf
Class AbstractPDFSignatureService
java.lang.Object
eu.europa.esig.dss.pdf.AbstractPDFSignatureService
- All Implemented Interfaces:
PDFSignatureService
- Direct Known Subclasses:
ITextPDFSignatureService,PdfBoxSignatureService
public abstract class AbstractPDFSignatureService extends Object implements PDFSignatureService
-
Field Summary
Fields Modifier and Type Field Description protected PDFServiceModeserviceModeprotected SignatureDrawerFactorysignatureDrawerFactory -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPDFSignatureService(PDFServiceMode serviceMode, 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 DigestAlgorithmgetCurrentDigestAlgorithm(PAdESSignatureParameters parameters)protected byte[]getOriginalBytes(int[] byteRange, byte[] signedContent)protected abstract List<PdfRevision>getSignatures(CertificatePool validationCertPool, DSSDocument document)protected byte[]getSignatureValue(DSSDocument dssDocument, int[] byteRange)protected byte[]getSignedContent(DSSDocument dssDocument, int[] byteRange)protected StringgetTokenDigest(Token token)protected StringgetType()protected booleanisContentValueEqualsByteRangeExtraction(DSSDocument document, int[] byteRange, byte[] cms, List<String> signatureFieldNames)protected booleanisDocTimestamp(PdfSignatureDictionary pdfSigDict)Checks if the given signature dictionary represents a DocTimeStampprotected booleanisDocumentTimestampLayer()protected booleanisSignature(PdfSignatureDictionary pdfSigDict)Checks if the given signature dictionary represents a Signatureprotected voidlinkSignatures(List<PdfRevision> signatures)This method links previous signatures to the new one.protected voidvalidateByteRange(int[] byteRange)voidvalidateSignatures(CertificatePool validationCertPool, 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
-
Constructor Details
-
AbstractPDFSignatureService
protected AbstractPDFSignatureService(PDFServiceMode serviceMode, SignatureDrawerFactory signatureDrawerFactory)Constructor for the PDFSignatureService- Parameters:
serviceMode- current instance is used to generate DocumentTypestamp or Signature signature layersignatureDrawerFactory- the factory ofSignatureDrawer
-
-
Method Details
-
isDocumentTimestampLayer
protected boolean isDocumentTimestampLayer() -
getType
-
getCurrentDigestAlgorithm
-
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<PdfRevision> getSignatures(CertificatePool validationCertPool, 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
- Throws:
IOException
-
isContentValueEqualsByteRangeExtraction
protected boolean isContentValueEqualsByteRangeExtraction(DSSDocument document, int[] byteRange, byte[] cms, List<String> signatureFieldNames) -
getSignatureValue
- Throws:
IOException
-
getOriginalBytes
protected byte[] getOriginalBytes(int[] byteRange, byte[] signedContent) -
validateByteRange
protected void validateByteRange(int[] byteRange) -
isDocTimestamp
Checks if the given signature dictionary represents a DocTimeStamp- Parameters:
pdfSigDict-PdfSignatureDictionaryto check- Returns:
- TRUE if the signature dictionary represents a DocTimeStamp, FALSE otherwise
-
isSignature
Checks if the given signature dictionary represents a Signature- Parameters:
pdfSigDict-PdfSignatureDictionaryto check- Returns:
- TRUE if the signature dictionary represents a Signature, FALSE otherwise
-
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
-