Class AbstractSignatureIdentifierBuilder

java.lang.Object
eu.europa.esig.dss.validation.AbstractSignatureIdentifierBuilder
All Implemented Interfaces:
SignatureIdentifierBuilder
Direct Known Subclasses:
CAdESSignatureIdentifierBuilder, JAdESSignatureIdentifierBuilder, PAdESSignatureIdentifierBuilder, XAdESSignatureIdentifierBuilder

public abstract class AbstractSignatureIdentifierBuilder
extends Object
implements SignatureIdentifierBuilder
The abstract SignatureIdentifier builder
  • Field Details

    • signature

      protected final AdvancedSignature signature
      The signature to build identifier for
  • Constructor Details

    • AbstractSignatureIdentifierBuilder

      protected AbstractSignatureIdentifierBuilder​(AdvancedSignature signature)
      The default constructor
      Parameters:
      signature - AdvancedSignature
  • Method Details

    • build

      public SignatureIdentifier build()
      Builds SignatureIdentifier for the provided AdvancedSignature
      Specified by:
      build in interface SignatureIdentifierBuilder
      Returns:
      SignatureIdentifier
    • buildBinaries

      protected byte[] buildBinaries()
      Builds unique binary data describing the signature object
      Returns:
      a byte array
    • writeSignedProperties

      protected void writeSignedProperties​(ByteArrayOutputStream baos) throws IOException
      Write signed properties of a signature to the given ByteArrayOutputStream
      Parameters:
      baos - ByteArrayOutputStream to enrich with the basic signature parameters
      Throws:
      IOException - if in exception has been thrown
    • writeString

      protected void writeString​(ByteArrayOutputStream baos, String str) throws IOException
      The method used to write a str into baos
      Parameters:
      baos - ByteArrayOutputStream to write String into
      str - String
      Throws:
      IOException - if in exception occurs
    • writeSignaturePosition

      protected void writeSignaturePosition​(ByteArrayOutputStream baos) throws IOException
      Writes the current signature position between other signature entries on the same level
      Parameters:
      baos - ByteArrayOutputStream to add data to
      Throws:
      IOException - if an exception occurs
    • getPositionId

      protected String getPositionId()
      Returns Id repesenting a current signature position in a file, considering its pre-siblings, master signatures when present
      Returns:
      String position id
    • getCounterSignaturePosition

      protected abstract Object getCounterSignaturePosition​(AdvancedSignature masterSignature)
      Returns a current counter signature position in its master signature
      Parameters:
      masterSignature - AdvancedSignature to analyze
      Returns:
      counter signature position
    • getSignatureFilePosition

      protected abstract Object getSignatureFilePosition()
      Returns a position of a signature in the provided file
      Returns:
      signature position in a file