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 PDFServiceMode
serviceMode
protected SignatureDrawerFactory
signatureDrawerFactory
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPDFSignatureService(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 DigestAlgorithm
getCurrentDigestAlgorithm(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 String
getTokenDigest(Token token)
protected String
getType()
protected boolean
isContentValueEqualsByteRangeExtraction(DSSDocument document, int[] byteRange, byte[] cms, List<String> signatureFieldNames)
protected boolean
isDocTimestamp(PdfSignatureDictionary pdfSigDict)
Checks if the given signature dictionary represents a DocTimeStampprotected boolean
isDocumentTimestampLayer()
protected boolean
isSignature(PdfSignatureDictionary pdfSigDict)
Checks if the given signature dictionary represents a Signatureprotected void
linkSignatures(List<PdfRevision> signatures)
This method links previous signatures to the new one.protected void
validateByteRange(int[] byteRange)
void
validateSignatures(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, wait
Methods 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:PDFSignatureService
Retrieves and triggers validation of the signatures from a PDF document- Specified by:
validateSignatures
in 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
-PdfSignatureDictionary
to check- Returns:
- TRUE if the signature dictionary represents a DocTimeStamp, FALSE otherwise
-
isSignature
Checks if the given signature dictionary represents a Signature- Parameters:
pdfSigDict
-PdfSignatureDictionary
to 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
-