Module jpms_dss_document
Package eu.europa.esig.dss.signature
Class AbstractSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<SP,TP>
- Type Parameters:
SP- SignatureParametersTP- TimestampParameters
- All Implemented Interfaces:
DocumentSignatureService<SP,,TP> Serializable
public abstract class AbstractSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
extends Object
implements DocumentSignatureService<SP,TP>
The abstract class containing the main methods for a signature creation/extension
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final eu.europa.esig.dss.spi.validation.CertificateVerifierThe CertificateVerifier used for a certificate chain validationprotected eu.europa.esig.dss.spi.x509.tsp.TSPSourceThe TSPSource to use for timestamp requests -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSignatureService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier) To construct a signature service theCertificateVerifiermust be set and cannot be null. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertSigningCertificateValid(AbstractSignatureParameters<?> parameters) This method raises an exception if the signing rules forbid the use the certificate.protected eu.europa.esig.dss.model.SignatureValueensureSignatureValue(eu.europa.esig.dss.enumerations.SignatureAlgorithm targetSignatureAlgorithm, eu.europa.esig.dss.model.SignatureValue signatureValue) This method ensures the providedsignatureValuehas the expectedtargetSignatureAlgorithmprotected StringgetFinalDocumentName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.MimeType containerMimeType) Generates and returns a final name for the document to createprotected StringgetFinalDocumentName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.SignaturePackaging packaging, eu.europa.esig.dss.enumerations.MimeType containerMimeType) Generates and returns a final name for the document to createprotected StringgetFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation) Returns the final name for the document to createprotected StringgetFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level) Returns the final name for the document to createprotected StringgetFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.SignaturePackaging packaging) Returns the final name for the document to createbooleanisValidSignatureValue(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.model.SignatureValue signatureValue, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Verifies the signature value against aToBeSignedand aCertificateTokenvoidsetTspSource(eu.europa.esig.dss.spi.x509.tsp.TSPSource tspSource) This setter allows to define the TSP (timestamp provider) source.eu.europa.esig.dss.model.DSSDocumentThis method allows to add a timestamp to an unsigned 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.signature.DocumentSignatureService
extendDocument, getContentTimestamp, getDataToSign, signDocument
-
Field Details
-
certificateVerifier
protected final eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifierThe CertificateVerifier used for a certificate chain validation -
tspSource
protected eu.europa.esig.dss.spi.x509.tsp.TSPSource tspSourceThe TSPSource to use for timestamp requests
-
-
Constructor Details
-
AbstractSignatureService
protected AbstractSignatureService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier) To construct a signature service theCertificateVerifiermust be set and cannot be null.- Parameters:
certificateVerifier-CertificateVerifierprovides information on the sources to be used in the validation process in the context of a signature.
-
-
Method Details
-
setTspSource
public void setTspSource(eu.europa.esig.dss.spi.x509.tsp.TSPSource tspSource) Description copied from interface:DocumentSignatureServiceThis setter allows to define the TSP (timestamp provider) source.- Specified by:
setTspSourcein interfaceDocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters> - Parameters:
tspSource- The time stamp source which is used when timestamping the signature.
-
assertSigningCertificateValid
This method raises an exception if the signing rules forbid the use the certificate.- Parameters:
parameters- set of driving signing parameters
-
ensureSignatureValue
protected eu.europa.esig.dss.model.SignatureValue ensureSignatureValue(eu.europa.esig.dss.enumerations.SignatureAlgorithm targetSignatureAlgorithm, eu.europa.esig.dss.model.SignatureValue signatureValue) This method ensures the providedsignatureValuehas the expectedtargetSignatureAlgorithm- Parameters:
targetSignatureAlgorithm-SignatureAlgorithmto convert the signatureValue tosignatureValue-SignatureValueobtained from a signing token- Returns:
SignatureValuewith the definedSignatureAlgorithmin parameters
-
getFinalDocumentName
protected String getFinalDocumentName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.SignaturePackaging packaging, eu.europa.esig.dss.enumerations.MimeType containerMimeType) Generates and returns a final name for the document to create- Parameters:
originalFile-DSSDocumentoriginal signed/extended documentoperation-SigningOperationthe performed signing operationlevel-SignatureLevelthe final signature levelpackaging-SignaturePackagingthe used packaging to create original signaturecontainerMimeType-MimeTypethe expected mimeType- Returns:
Stringthe document filename
-
getFinalFileName
protected String getFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation) Returns the final name for the document to create- Parameters:
originalFile-DSSDocumentoriginal signed/extended documentoperation-SigningOperationthe performed signing operation- Returns:
Stringthe document filename
-
getFinalFileName
protected String getFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level) Returns the final name for the document to create- Parameters:
originalFile-DSSDocumentoriginal signed/extended documentoperation-SigningOperationthe performed signing operationlevel-SignatureLevelthe final signature level- Returns:
Stringthe document filename
-
getFinalFileName
protected String getFinalFileName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.SignaturePackaging packaging) Returns the final name for the document to create- Parameters:
originalFile-DSSDocumentoriginal signed/extended documentoperation-SigningOperationthe performed signing operationlevel-SignatureLevelthe final signature levelpackaging-SignaturePackagingthe used packaging to create original signature- Returns:
Stringthe document filename
-
getFinalDocumentName
protected String getFinalDocumentName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.SignatureLevel level, eu.europa.esig.dss.enumerations.MimeType containerMimeType) Generates and returns a final name for the document to create- Parameters:
originalFile-DSSDocumentoriginal signed/extended documentoperation-SigningOperationthe performed signing operationlevel-SignatureLevelthe final signature levelcontainerMimeType-MimeTypethe expected mimeType- Returns:
Stringthe document filename
-
timestamp
public eu.europa.esig.dss.model.DSSDocument timestamp(eu.europa.esig.dss.model.DSSDocument toTimestampDocument, TP parameters) Description copied from interface:DocumentSignatureServiceThis method allows to add a timestamp to an unsigned document- Specified by:
timestampin interfaceDocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters> - Parameters:
toTimestampDocument- the document to be timestampedparameters- set of the driving timestamping parameters- Returns:
- the timestamped document
-
isValidSignatureValue
public boolean isValidSignatureValue(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.model.SignatureValue signatureValue, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Description copied from interface:DocumentSignatureServiceVerifies the signature value against aToBeSignedand aCertificateToken- Specified by:
isValidSignatureValuein interfaceDocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters> - Parameters:
toBeSigned- the signed datasignatureValue- the signature valuesigningCertificate- the used certificate to create the signature value- Returns:
- true if the signature value is valid
-