Class JAdESService

java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
eu.europa.esig.dss.jades.signature.JAdESService
All Implemented Interfaces:
eu.europa.esig.dss.signature.CounterSignatureService<JAdESCounterSignatureParameters>, eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>, eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>, Serializable

public class JAdESService extends eu.europa.esig.dss.signature.AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters> implements eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>, eu.europa.esig.dss.signature.CounterSignatureService<JAdESCounterSignatureParameters>
Contains methods for JAdES signature creation/extension
See Also:
  • Field Summary

    Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService

    certificateVerifier, tspSource
  • Constructor Summary

    Constructors
    Constructor
    Description
    JAdESService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
    This is the constructor to create an instance of the JAdESService.
  • Method Summary

    Modifier and Type
    Method
    Description
    eu.europa.esig.dss.model.DSSDocument
    addSignaturePolicyStore(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.SignaturePolicyStore signaturePolicyStore)
    Incorporates a Signature Policy Store as a base64Url-encoded unsigned property into the JAdES Signature
    eu.europa.esig.dss.model.DSSDocument
    addSignaturePolicyStore(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance)
    Incorporates a Signature Policy Store as an unsigned property into the JAdES Signature
    protected void
    assertSigningCertificateValid(eu.europa.esig.dss.signature.AbstractSignatureParameters<?> parameters)
     
    eu.europa.esig.dss.model.DSSDocument
    counterSignSignature(eu.europa.esig.dss.model.DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
     
    eu.europa.esig.dss.model.DSSDocument
    extendDocument(eu.europa.esig.dss.model.DSSDocument toExtendDocument, JAdESSignatureParameters parameters)
     
    eu.europa.esig.dss.spi.x509.tsp.TimestampToken
    getContentTimestamp(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters)
     
    eu.europa.esig.dss.spi.x509.tsp.TimestampToken
    getContentTimestamp(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)
    This methods allows to create a TimestampToken for a detached JAdES (with a 'sigD' parameter).
    eu.europa.esig.dss.model.ToBeSigned
    getDataToBeCounterSigned(eu.europa.esig.dss.model.DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters)
     
    eu.europa.esig.dss.model.ToBeSigned
    getDataToSign(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters)
     
    eu.europa.esig.dss.model.ToBeSigned
    getDataToSign(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)
     
    protected JAdESBuilder
    getJAdESBuilder(JAdESSignatureParameters parameters, List<eu.europa.esig.dss.model.DSSDocument> documentsToSign)
    Returns the JAdESBuilder to be used
    boolean
    isValidSignatureValue(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.model.SignatureValue signatureValue, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate)
     
    eu.europa.esig.dss.model.DSSDocument
    signDocument(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
     
    eu.europa.esig.dss.model.DSSDocument
    signDocument(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
     
    eu.europa.esig.dss.model.DSSDocument
    timestamp(List<eu.europa.esig.dss.model.DSSDocument> toTimestampDocuments, JAdESTimestampParameters parameters)
     

    Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService

    ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, getFinalFileName, getFinalFileName, setTspSource, timestamp

    Methods 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.signature.CounterSignatureService

    setTspSource
  • Constructor Details

    • JAdESService

      public JAdESService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
      This is the constructor to create an instance of the JAdESService. 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

    • getContentTimestamp

      public eu.europa.esig.dss.spi.x509.tsp.TimestampToken getContentTimestamp(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters)
      Specified by:
      getContentTimestamp in interface eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • getContentTimestamp

      public eu.europa.esig.dss.spi.x509.tsp.TimestampToken getContentTimestamp(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)
      This methods allows to create a TimestampToken for a detached JAdES (with a 'sigD' parameter). NOTE: The toSignDocuments must be present in the same order they will be passed to signature computation process
      Specified by:
      getContentTimestamp in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
      Parameters:
      toSignDocuments - a list of DSSDocuments to be timestamped
      parameters - JAdESSignatureParameters
      Returns:
      content TimestampToken
    • getDataToSign

      public eu.europa.esig.dss.model.ToBeSigned getDataToSign(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters)
      Specified by:
      getDataToSign in interface eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • getDataToSign

      public eu.europa.esig.dss.model.ToBeSigned getDataToSign(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)
      Specified by:
      getDataToSign in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • signDocument

      public eu.europa.esig.dss.model.DSSDocument signDocument(eu.europa.esig.dss.model.DSSDocument toSignDocument, JAdESSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
      Specified by:
      signDocument in interface eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • signDocument

      public eu.europa.esig.dss.model.DSSDocument signDocument(List<eu.europa.esig.dss.model.DSSDocument> toSignDocuments, JAdESSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
      Specified by:
      signDocument in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • getJAdESBuilder

      protected JAdESBuilder getJAdESBuilder(JAdESSignatureParameters parameters, List<eu.europa.esig.dss.model.DSSDocument> documentsToSign)
      Returns the JAdESBuilder to be used
      Parameters:
      parameters - JAdESSignatureParameters
      documentsToSign - a list of DSSDocuments
      Returns:
      JAdESBuilder
    • extendDocument

      public eu.europa.esig.dss.model.DSSDocument extendDocument(eu.europa.esig.dss.model.DSSDocument toExtendDocument, JAdESSignatureParameters parameters)
      Specified by:
      extendDocument in interface eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
      Specified by:
      extendDocument in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • timestamp

      public eu.europa.esig.dss.model.DSSDocument timestamp(List<eu.europa.esig.dss.model.DSSDocument> toTimestampDocuments, JAdESTimestampParameters parameters)
      Specified by:
      timestamp in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • addSignaturePolicyStore

      public eu.europa.esig.dss.model.DSSDocument addSignaturePolicyStore(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.SignaturePolicyStore signaturePolicyStore)
      Incorporates a Signature Policy Store as a base64Url-encoded unsigned property into the JAdES Signature
      Parameters:
      document - DSSDocument containing a JAdES Signature to add a SignaturePolicyStore to
      signaturePolicyStore - SignaturePolicyStore to add
      Returns:
      DSSDocument JAdESSignature with an incorporates SignaturePolicyStore
    • addSignaturePolicyStore

      public eu.europa.esig.dss.model.DSSDocument addSignaturePolicyStore(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance)
      Incorporates a Signature Policy Store as an unsigned property into the JAdES Signature
      Parameters:
      document - DSSDocument containing a JAdES Signature to add a SignaturePolicyStore to
      signaturePolicyStore - SignaturePolicyStore to add
      base64UrlInstance - defines if the SignaturePolicyStore shall be incorporated in its corresponding base64Url representation, otherwise if FALSE incorporates in the clear JSON representation
      Returns:
      DSSDocument JAdESSignature with an incorporates SignaturePolicyStore
    • getDataToBeCounterSigned

      public eu.europa.esig.dss.model.ToBeSigned getDataToBeCounterSigned(eu.europa.esig.dss.model.DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters)
      Specified by:
      getDataToBeCounterSigned in interface eu.europa.esig.dss.signature.CounterSignatureService<JAdESCounterSignatureParameters>
    • counterSignSignature

      public eu.europa.esig.dss.model.DSSDocument counterSignSignature(eu.europa.esig.dss.model.DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
      Specified by:
      counterSignSignature in interface eu.europa.esig.dss.signature.CounterSignatureService<JAdESCounterSignatureParameters>
    • 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)
      Specified by:
      isValidSignatureValue in interface eu.europa.esig.dss.signature.DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
      Specified by:
      isValidSignatureValue in interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
      Overrides:
      isValidSignatureValue in class eu.europa.esig.dss.signature.AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
    • assertSigningCertificateValid

      protected void assertSigningCertificateValid(eu.europa.esig.dss.signature.AbstractSignatureParameters<?> parameters)
      Overrides:
      assertSigningCertificateValid in class eu.europa.esig.dss.signature.AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>