Class SignedDocumentDiagnosticDataBuilder

java.lang.Object
eu.europa.esig.dss.validation.DiagnosticDataBuilder
eu.europa.esig.dss.validation.SignedDocumentDiagnosticDataBuilder

public class SignedDocumentDiagnosticDataBuilder extends DiagnosticDataBuilder
The common class for DiagnosticData creation from a signed/timestamped document
  • Field Details

    • signedDocument

      protected eu.europa.esig.dss.model.DSSDocument signedDocument
      The signed document
    • signatures

      protected List<AdvancedSignature> signatures
      The list of signatures
    • usedTimestamps

      protected Set<TimestampToken> usedTimestamps
      The list of timestamp tokens
    • signaturePolicyProvider

      protected SignaturePolicyProvider signaturePolicyProvider
      The signature policy provider
    • signaturePolicyValidatorLoader

      protected SignaturePolicyValidatorLoader signaturePolicyValidatorLoader
      Loads a SignaturePolicyValidator
    • documentCertificateSource

      protected ListCertificateSource documentCertificateSource
      The list of all certificate sources extracted from a validating document (signature(s), timestamp(s))
    • documentCRLSource

      protected ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.crl.CRL> documentCRLSource
      The list of all CRL revocation sources extracted from a validating document (signature(s), timestamp(s))
    • documentOCSPSource

      protected ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.ocsp.OCSP> documentOCSPSource
      The list of all OCSP revocation sources extracted from a validating document (signature(s), timestamp(s))
    • xmlSignaturesMap

      protected Map<String,eu.europa.esig.dss.diagnostic.jaxb.XmlSignature> xmlSignaturesMap
      The cached map of signatures
    • xmlTimestampsMap

      protected Map<String,eu.europa.esig.dss.diagnostic.jaxb.XmlTimestamp> xmlTimestampsMap
      The cached map of timestamps
    • xmlSignedDataMap

      protected Map<String,eu.europa.esig.dss.diagnostic.jaxb.XmlSignerData> xmlSignedDataMap
      The cached map of original signed data
  • Constructor Details

    • SignedDocumentDiagnosticDataBuilder

      public SignedDocumentDiagnosticDataBuilder()
      Default constructor instantiating object with null values and empty maps
  • Method Details

    • usedCertificates

      public SignedDocumentDiagnosticDataBuilder usedCertificates(Set<eu.europa.esig.dss.model.x509.CertificateToken> usedCertificates)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set the used certificates
      Overrides:
      usedCertificates in class DiagnosticDataBuilder
      Parameters:
      usedCertificates - the used certificates
      Returns:
      the builder
    • usedRevocations

      public SignedDocumentDiagnosticDataBuilder usedRevocations(Set<RevocationToken> usedRevocations)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set the used revocation data
      Overrides:
      usedRevocations in class DiagnosticDataBuilder
      Parameters:
      usedRevocations - the used revocation data
      Returns:
      the builder
    • allCertificateSources

      public SignedDocumentDiagnosticDataBuilder allCertificateSources(ListCertificateSource trustedCertSources)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set ListCertificateSource containing all certificate sources used in the validator (including trusted certificate sources)
      Overrides:
      allCertificateSources in class DiagnosticDataBuilder
      Parameters:
      trustedCertSources - the list of trusted lists certificate sources
      Returns:
      the builder
    • validationDate

      public SignedDocumentDiagnosticDataBuilder validationDate(Date validationDate)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set the validation date
      Overrides:
      validationDate in class DiagnosticDataBuilder
      Parameters:
      validationDate - the validation date
      Returns:
      the builder
    • tokenExtractionStrategy

      public SignedDocumentDiagnosticDataBuilder tokenExtractionStrategy(eu.europa.esig.dss.enumerations.TokenExtractionStrategy tokenExtractionStrategy)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set the TokenExtractionStrategy to follow for the token extraction
      Overrides:
      tokenExtractionStrategy in class DiagnosticDataBuilder
      Parameters:
      tokenExtractionStrategy - TokenExtractionStrategy to use
      Returns:
      the builder
    • defaultDigestAlgorithm

      public SignedDocumentDiagnosticDataBuilder defaultDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Description copied from class: DiagnosticDataBuilder
      This method allows to set the default DigestAlgorithm which will be used for tokens' DigestAlgoAndValue calculation
      Overrides:
      defaultDigestAlgorithm in class DiagnosticDataBuilder
      Parameters:
      digestAlgorithm - DigestAlgorithm to set as default
      Returns:
      the builder
    • document

      public SignedDocumentDiagnosticDataBuilder document(eu.europa.esig.dss.model.DSSDocument signedDocument)
      This method allows to set the document which is analysed
      Parameters:
      signedDocument - the document which is analysed
      Returns:
      the builder
    • foundSignatures

      public SignedDocumentDiagnosticDataBuilder foundSignatures(List<AdvancedSignature> signatures)
      This method allows to set the found signatures
      Parameters:
      signatures - the found signatures
      Returns:
      the builder
    • usedTimestamps

      public SignedDocumentDiagnosticDataBuilder usedTimestamps(Set<TimestampToken> usedTimestamps)
      This method allows to set the timestamps
      Parameters:
      usedTimestamps - a set of validated TimestampTokens
      Returns:
      the builder
    • signaturePolicyProvider

      public SignedDocumentDiagnosticDataBuilder signaturePolicyProvider(SignaturePolicyProvider signaturePolicyProvider)
      This method allows to set the SignaturePolicyProvider
      Parameters:
      signaturePolicyProvider - SignaturePolicyProvider
      Returns:
      the builder
    • documentCertificateSource

      public SignedDocumentDiagnosticDataBuilder documentCertificateSource(ListCertificateSource documentCertificateSource)
      Sets a document Certificate Source containing all sources extracted from the provided signature(s)/timestamp(s)
      Parameters:
      documentCertificateSource - ListCertificateSource computed from document sources
      Returns:
      the builder
    • signaturePolicyValidatorLoader

      public SignedDocumentDiagnosticDataBuilder signaturePolicyValidatorLoader(SignaturePolicyValidatorLoader signaturePolicyValidatorLoader)
      This method allows to set the SignaturePolicyValidatorLoader
      Parameters:
      signaturePolicyValidatorLoader - SignaturePolicyValidatorLoader
      Returns:
      the builder
    • documentCRLSource

      public SignedDocumentDiagnosticDataBuilder documentCRLSource(ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.crl.CRL> documentCRLSource)
      Sets a document CRL Source containing all sources extracted from the provided signature(s)/timestamp(s)
      Parameters:
      documentCRLSource - ListRevocationSource computed from document sources
      Returns:
      the builder
    • documentOCSPSource

      public SignedDocumentDiagnosticDataBuilder documentOCSPSource(ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.ocsp.OCSP> documentCRLSource)
      Sets a document OCSP Source containing all sources extracted from the provided signature(s)/timestamp(s)
      Parameters:
      documentCRLSource - ListRevocationSource computed from document sources
      Returns:
      the builder
    • build

      public eu.europa.esig.dss.diagnostic.jaxb.XmlDiagnosticData build()
      Builds XmlDiagnosticData
      Overrides:
      build in class DiagnosticDataBuilder
      Returns:
      XmlDiagnosticData
    • linkSigningCertificateAndChains

      protected void linkSigningCertificateAndChains(Set<eu.europa.esig.dss.model.x509.CertificateToken> certificates)
      Description copied from class: DiagnosticDataBuilder
      Links the certificates and their certificate chains
      Overrides:
      linkSigningCertificateAndChains in class DiagnosticDataBuilder
      Parameters:
      certificates - a set of CertificateTokens
    • buildDetachedXmlSignature

      public eu.europa.esig.dss.diagnostic.jaxb.XmlSignature buildDetachedXmlSignature(AdvancedSignature signature)
      Builds XmlSignature
      Parameters:
      signature - AdvancedSignature
      Returns:
      XmlSignature
    • emptyToNull

      protected String emptyToNull(String text)
      If text is empty returns NULL, or original text otherwise
      Parameters:
      text - String
      Returns:
      String
    • createOrphanTokenFromRevocationIdentifier

      protected <R extends eu.europa.esig.dss.model.x509.revocation.Revocation> eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanRevocationToken createOrphanTokenFromRevocationIdentifier(eu.europa.esig.dss.model.identifier.EncapsulatedRevocationTokenIdentifier<R> revocationIdentifier)
      Creates an orphan revocation token from EncapsulatedRevocationTokenIdentifier
      Type Parameters:
      R - Revocation
      Parameters:
      revocationIdentifier - EncapsulatedRevocationTokenIdentifier
      Returns:
      XmlOrphanRevocationToken
    • buildDetachedXmlTimestamp

      protected eu.europa.esig.dss.diagnostic.jaxb.XmlTimestamp buildDetachedXmlTimestamp(TimestampToken timestampToken)
      This method builds XmlTimestamp from TimestampToken
      Parameters:
      timestampToken - TimestampToken
      Returns:
      XmlTimestamp
    • getXmlSignerInformationStore

      protected List<eu.europa.esig.dss.diagnostic.jaxb.XmlSignerInfo> getXmlSignerInformationStore(Set<SignerIdentifier> signerIdentifiers)
      Builds a list of XmlSignerInfo from SignerIdentifiers
      Parameters:
      signerIdentifiers - a set of SignerIdentifier
      Returns:
      a list of XmlSignerInfos