Module jpms_dss_spi

Class AbstractEmbeddedEvidenceRecordHelper

java.lang.Object
eu.europa.esig.dss.spi.validation.evidencerecord.AbstractEmbeddedEvidenceRecordHelper
All Implemented Interfaces:
EmbeddedEvidenceRecordHelper

public abstract class AbstractEmbeddedEvidenceRecordHelper extends Object implements EmbeddedEvidenceRecordHelper
Abstract implementation of InternalEvidenceRecordHelper containing common implementation methods
  • Field Details

    • signature

      protected final AdvancedSignature signature
      Master signature
    • evidenceRecordAttribute

      protected final SignatureAttribute evidenceRecordAttribute
      Unsigned signature attribute embedding the evidence record
  • Constructor Details

  • Method Details

    • getMasterSignature

      public AdvancedSignature getMasterSignature()
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Gets a master signature, enveloping the current evidence record
      Specified by:
      getMasterSignature in interface EmbeddedEvidenceRecordHelper
      Returns:
      AdvancedSignature
    • getEvidenceRecordAttribute

      public SignatureAttribute getEvidenceRecordAttribute()
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Gets the unsigned attribute property embedding the evidence record. NOTE: can be null in case of a not yet embedded evidence record.
      Specified by:
      getEvidenceRecordAttribute in interface EmbeddedEvidenceRecordHelper
      Returns:
      SignatureAttribute
    • getOrderOfAttribute

      public Integer getOrderOfAttribute()
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Gets position of the evidence record carrying attribute within the signature NOTE: can be null in case of a not yet embedded evidence record.
      Specified by:
      getOrderOfAttribute in interface EmbeddedEvidenceRecordHelper
      Returns:
      Integer
    • setOrderOfAttribute

      public void setOrderOfAttribute(Integer orderOfAttribute)
      Sets position of the evidence record carrying attribute within the signature
      Parameters:
      orderOfAttribute - position of the attribute
    • getOrderWithinAttribute

      public Integer getOrderWithinAttribute()
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Gets position of the evidence record within its carrying attribute NOTE: can be null in case of a not yet embedded evidence record.
      Specified by:
      getOrderWithinAttribute in interface EmbeddedEvidenceRecordHelper
      Returns:
      Integer
    • setOrderWithinAttribute

      public void setOrderWithinAttribute(Integer orderWithinAttribute)
      Sets position of the evidence record within its carrying attribute
      Parameters:
      orderWithinAttribute - position of the evidence record within the attribute
    • getDetachedContents

      public List<eu.europa.esig.dss.model.DSSDocument> getDetachedContents()
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Gets a list of detached documents
      Specified by:
      getDetachedContents in interface EmbeddedEvidenceRecordHelper
      Returns:
      a list of DSSDocuments
    • setDetachedContents

      public void setDetachedContents(List<eu.europa.esig.dss.model.DSSDocument> detachedContents)
      Sets a list of documents used for validation of a detached signature
      Parameters:
      detachedContents - list of DSSDocuments
    • getMasterSignatureDigest

      public eu.europa.esig.dss.model.Digest getMasterSignatureDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Builds digest for the embedded evidence record for the given DigestAlgorithm. This method uses an existing coding of a signature for hash generation.
      Specified by:
      getMasterSignatureDigest in interface EmbeddedEvidenceRecordHelper
      Parameters:
      digestAlgorithm - DigestAlgorithm
      Returns:
      Digest
    • getMasterSignatureDigest

      public eu.europa.esig.dss.model.Digest getMasterSignatureDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, boolean derEncoded)
      Description copied from interface: EmbeddedEvidenceRecordHelper
      Builds digest for the embedded evidence record for the given DigestAlgorithm using a specified encoding. The method can be called only for a CAdES signature implementation. NOTE: please use the method #isEncodingSelectionSupported to check whether the encoding choice is supported by the current implementation. Use #getMasterSignatureDigest(digestAlgorithm) method otherwise.
      Specified by:
      getMasterSignatureDigest in interface EmbeddedEvidenceRecordHelper
      Parameters:
      digestAlgorithm - DigestAlgorithm
      derEncoded - whether the signature shall be DER-encoded
      Returns:
      Digest
    • getDigestBuilder

      protected abstract SignatureEvidenceRecordDigestBuilder getDigestBuilder(AdvancedSignature signature, SignatureAttribute evidenceRecordAttribute, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Gets implementation of the signature digest builder for the given evidence record
      Parameters:
      signature - AdvancedSignature
      evidenceRecordAttribute - SignatureAttribute
      digestAlgorithm - DigestAlgorithm
      Returns:
      SignatureEvidenceRecordDigestBuilder
    • setDEREncoding

      protected abstract void setDEREncoding(SignatureEvidenceRecordDigestBuilder digestBuilder, boolean derEncoded)
      Sets the encoding to be used on the hash computation to the SignatureEvidenceRecordDigestBuilder whether applicable
      Parameters:
      digestBuilder - SignatureEvidenceRecordDigestBuilder
      derEncoded - whether signature shall be DER encoded