Class PAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<PAdESSignatureParameters,PAdESTimestampParameters>
eu.europa.esig.dss.pades.signature.PAdESService
- All Implemented Interfaces:
DocumentSignatureService<PAdESSignatureParameters,PAdESTimestampParameters>
,Serializable
public class PAdESService extends AbstractSignatureService<PAdESSignatureParameters,PAdESTimestampParameters>
PAdES implementation of the DocumentSignatureService
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
Constructors Constructor Description PAdESService(CertificateVerifier certificateVerifier)
This is the constructor to create an instance of thePAdESService
. -
Method Summary
Modifier and Type Method Description DSSDocument
addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters)
This method allows to add a new signature field to an existing pdf documentDSSDocument
addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String passwordProtection)
This method allows to add a new signature field to an encrypted pdf documentprotected byte[]
computeDocumentDigest(DSSDocument toSignDocument, PAdESSignatureParameters parameters)
DSSDocument
extendDocument(DSSDocument toExtendDocument, PAdESSignatureParameters parameters)
Extends the level of the signatures in thetoExtendDocument
protected byte[]
generateCMSSignedData(DSSDocument toSignDocument, PAdESSignatureParameters parameters, SignatureValue signatureValue)
List<String>
getAvailableSignatureFields(DSSDocument document)
This method returns not signed signature-fieldsList<String>
getAvailableSignatureFields(DSSDocument document, String passwordProtection)
This method returns not signed signature-fields from an encrypted documentTimestampToken
getContentTimestamp(DSSDocument toSignDocument, PAdESSignatureParameters parameters)
This method allows to compute a content-timestamp (which is added in the signed properties)ToBeSigned
getDataToSign(DSSDocument toSignDocument, PAdESSignatureParameters parameters)
Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
.void
setPdfObjFactory(IPdfObjFactory pdfObjFactory)
Set the IPdfObjFactory.DSSDocument
signDocument(DSSDocument toSignDocument, PAdESSignatureParameters parameters, SignatureValue signatureValue)
Signs the toSignDocument with the provided signatureValue.DSSDocument
timestamp(DSSDocument toTimestampDocument, PAdESTimestampParameters parameters)
This method allows to add a timestamp to an unsigned documentMethods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningDateInCertificateValidityRange, getFinalArchiveName, getFinalFileName, setTspSource
-
Constructor Details
-
PAdESService
This is the constructor to create an instance of thePAdESService
. A certificate verifier must be provided.- Parameters:
certificateVerifier
-CertificateVerifier
provides information on the sources to be used in the validation process in the context of a signature.
-
-
Method Details
-
setPdfObjFactory
Set the IPdfObjFactory. Allow to set the used implementation. Cannot be null.- Parameters:
pdfObjFactory
- the implementation to be used.
-
getContentTimestamp
public TimestampToken getContentTimestamp(DSSDocument toSignDocument, PAdESSignatureParameters parameters)Description copied from interface:DocumentSignatureService
This method allows to compute a content-timestamp (which is added in the signed properties)- Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- set of the driving signing parameters- Returns:
- a timestamp token
-
getDataToSign
public ToBeSigned getDataToSign(DSSDocument toSignDocument, PAdESSignatureParameters parameters) throws DSSExceptionDescription copied from interface:DocumentSignatureService
Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
. WhentoSignDocument
contains an already existing signature the returned bytes are related to a new parallel signature. - Enveloped signature (XML): a new signature is added and the signed data corresponds to that pointed by the first signature; - Enveloping signature: - - XML: The parallel signature is not possible - - CMS: A new parallel signature is added - Detached signature: - - XML: The parallel signature is added - - CMS: A new parallel signature is added- Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- set of the driving signing parameters- Returns:
- the data to be signed
- Throws:
DSSException
-
computeDocumentDigest
protected byte[] computeDocumentDigest(DSSDocument toSignDocument, PAdESSignatureParameters parameters) -
signDocument
public DSSDocument signDocument(DSSDocument toSignDocument, PAdESSignatureParameters parameters, SignatureValue signatureValue) throws DSSExceptionDescription copied from interface:DocumentSignatureService
Signs the toSignDocument with the provided signatureValue.- Parameters:
toSignDocument
- document to signparameters
- set of the driving signing parameterssignatureValue
- the signature value to incorporate- Returns:
- the signed document (
toSignDocument
with the incorporated signature or the detached signature) - Throws:
DSSException
-
generateCMSSignedData
protected byte[] generateCMSSignedData(DSSDocument toSignDocument, PAdESSignatureParameters parameters, SignatureValue signatureValue) -
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, PAdESSignatureParameters parameters) throws DSSExceptionDescription copied from interface:DocumentSignatureService
Extends the level of the signatures in thetoExtendDocument
- Parameters:
toExtendDocument
- document to extendparameters
- set of the driving signing parameters- Returns:
- the extended signature
- Throws:
DSSException
-
getAvailableSignatureFields
This method returns not signed signature-fields- Parameters:
document
- the pdf document- Returns:
- the list of empty signature fields
-
getAvailableSignatureFields
This method returns not signed signature-fields from an encrypted document- Parameters:
document
- the pdf documentpasswordProtection
- the password protection used to create the encrypted document- Returns:
- the list of empty signature fields
-
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
public DSSDocument addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String passwordProtection)This method allows to add a new signature field to an encrypted pdf document- Parameters:
document
- the pdf documentparameters
- the parameters with the coordinates,... of the signature fieldpasswordProtection
- the password protection used to create the encrypted document- Returns:
- the pdf document with the new added signature field
-
timestamp
Description copied from interface:DocumentSignatureService
This method allows to add a timestamp to an unsigned document- Specified by:
timestamp
in interfaceDocumentSignatureService<PAdESSignatureParameters,PAdESTimestampParameters>
- Overrides:
timestamp
in classAbstractSignatureService<PAdESSignatureParameters,PAdESTimestampParameters>
- Parameters:
toTimestampDocument
- the document to be timestampedparameters
- set of the driving timestamping parameters- Returns:
- the timestamped document
-