Class ValidationProcessUtils

java.lang.Object
eu.europa.esig.dss.validation.process.ValidationProcessUtils

public class ValidationProcessUtils extends Object
Contains utils for a validation process
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    buildStringMessage(eu.europa.esig.dss.i18n.I18nProvider i18nProvider, eu.europa.esig.dss.i18n.MessageTag messageTag, Object... args)
    Builds a String message from the provided messageTag
    static List<eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper>
    getAcceptableRevocationDataForPSVIfExistOrReturnAll(eu.europa.esig.dss.diagnostic.TokenProxy token, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, Date currentTime, Map<String,eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks> bbbs, POEExtraction poe, eu.europa.esig.dss.model.policy.LevelRule revocationIssuerSunsetDateConstraint)
    This method verifies if there is an acceptable revocation data according to rules defined in 5.6.2.4 step 1) and returns a list of the revocation data.
    static eu.europa.esig.dss.i18n.MessageTag
    getCertificateChainCryptoPosition(eu.europa.esig.dss.enumerations.Context context)
    Returns the message tag for the certificate chain of the given context
    static eu.europa.esig.dss.model.policy.LevelRule
    getConstraintOrMaxLevel(eu.europa.esig.dss.model.policy.LevelRule constraint, eu.europa.esig.dss.enumerations.Level maxLevel)
    This method is used to return the current level with a max limit of the maxLevel
    static eu.europa.esig.dss.i18n.MessageTag
    getContextPosition(eu.europa.esig.dss.enumerations.Context context)
    Returns the message tag for the given context
    static eu.europa.esig.dss.i18n.MessageTag
    getCryptoPosition(eu.europa.esig.dss.enumerations.Context context)
    Returns the message tag for the given context (signature creation,...)
    static eu.europa.esig.dss.i18n.MessageTag
    getDigestMatcherCryptoPosition(eu.europa.esig.dss.diagnostic.jaxb.XmlDigestMatcher digestMatcher)
    Returns crypto position MessageTag for the given XmlDigestMatcher
    static eu.europa.esig.dss.i18n.MessageTag
    getDigestMatcherCryptoPosition(Collection<eu.europa.esig.dss.diagnostic.jaxb.XmlDigestMatcher> digestMatchers)
    Returns crypto position MessageTag for the given collection of XmlDigestMatchers
    static String
    This method returns a domain name for any given valid URI
    static String
    Returns a formatted String representation of a given Date
    static eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper
    getLatestAcceptableRevocationData(eu.europa.esig.dss.diagnostic.TokenProxy token, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, Collection<eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper> revocationData, Date controlTime, Map<String,eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks> bbbs, POEExtraction poe)
    Returns a revocation data used for basic signature validation
    static eu.europa.esig.dss.model.policy.LevelRule
    getLevelRule(eu.europa.esig.dss.enumerations.Level level)
    Generates an anonymous implementation of the LevelRule with the given Level
    static eu.europa.esig.dss.detailedreport.jaxb.XmlRAC
    getRevocationAcceptanceCheckerResult(eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks bbb, String certificateId, String revocationDataId)
    Return a corresponding XmlRAC result for the given certificate and revocationData
    static eu.europa.esig.dss.i18n.MessageTag
    getSubContextPosition(eu.europa.esig.dss.enumerations.SubContext subContext)
    Returns the message tag for the given subContext
    static eu.europa.esig.dss.i18n.MessageTag
    getTimestampTypeMessageTag(eu.europa.esig.dss.enumerations.TimestampType timestampType)
    Returns MessageTag associated with the given timestamp type
    static eu.europa.esig.dss.i18n.MessageTag
    getValidationTimeMessageTag(eu.europa.esig.dss.enumerations.ValidationTime validationTime)
    Returns a MessageTag corresponding to the given ValidationTime type
    static boolean
    isAllowedBasicRevocationDataValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
    Checks if the given conclusion is allowed as a basic revocation validation in order to continue the validation process with Long-Term Validation Data
    static boolean
    isAllowedBasicSignatureValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
    Checks if the given conclusion is allowed as a basic signature validation in order to continue the validation process with Long-Term Validation Data
    static boolean
    isAllowedBasicTimestampValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
    Checks if the given conclusion is allowed as a basic timestamp validation in order to continue the validation process with Archival Data
    static boolean
    isAllowedValidationWithLongTermData(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
    Checks if the given conclusion is allowed as a validation process with a long-term validation data in order to continue the validation process with Archival Data
    static boolean
    isLongTermAvailabilityAndIntegrityMaterialPresent(eu.europa.esig.dss.diagnostic.SignatureWrapper signature)
    This method verifies if the signature contains long-term availability and integrity material within its structure
    static boolean
    isRevocationDataAcceptable(eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks bbb, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, eu.europa.esig.dss.diagnostic.RevocationWrapper revocationData)
    This method verifies if a revocation data is acceptable for the given certificate according to the validation performed within bbb
    static boolean
    isTrustAnchor(eu.europa.esig.dss.diagnostic.CertificateWrapper certificateWrapper, Date currentTime, eu.europa.esig.dss.model.policy.LevelRule certificateSunsetDateConstraint)
    This method verifies whether the given certificateWrapper can be considered as a trust anchor at the currentTime
    static boolean
    processValueCheck(String value, List<String> expectedValues)
    Checks the value against the list of expected values
    static boolean
    processValuesCheck(List<String> values, List<String> expectedValues)
    Checks the values against the expected values
    static String
    Transforms the given OID to a URN format as per RFC 3061 e.g. "1.2.3" to "urn:oid:1.2.3"

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isAllowedBasicSignatureValidation

      public static boolean isAllowedBasicSignatureValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
      Checks if the given conclusion is allowed as a basic signature validation in order to continue the validation process with Long-Term Validation Data
      Parameters:
      conclusion - XmlConclusion to validate
      Returns:
      TRUE if the result is allowed to continue the validation process, FALSE otherwise
    • isAllowedBasicRevocationDataValidation

      public static boolean isAllowedBasicRevocationDataValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
      Checks if the given conclusion is allowed as a basic revocation validation in order to continue the validation process with Long-Term Validation Data
      Parameters:
      conclusion - XmlConclusion to validate
      Returns:
      TRUE if the result is allowed to continue the validation process, FALSE otherwise
    • isAllowedBasicTimestampValidation

      public static boolean isAllowedBasicTimestampValidation(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
      Checks if the given conclusion is allowed as a basic timestamp validation in order to continue the validation process with Archival Data
      Parameters:
      conclusion - XmlConclusion to validate
      Returns:
      TRUE if the result is allowed to continue the validation process, FALSE otherwise
    • isAllowedValidationWithLongTermData

      public static boolean isAllowedValidationWithLongTermData(eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion conclusion)
      Checks if the given conclusion is allowed as a validation process with a long-term validation data in order to continue the validation process with Archival Data
      Parameters:
      conclusion - XmlConclusion to validate
      Returns:
      TRUE if the result is allowed to continue the validation process, FALSE otherwise
    • getLatestAcceptableRevocationData

      public static eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper getLatestAcceptableRevocationData(eu.europa.esig.dss.diagnostic.TokenProxy token, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, Collection<eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper> revocationData, Date controlTime, Map<String,eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks> bbbs, POEExtraction poe)
      Returns a revocation data used for basic signature validation
      Parameters:
      token - TokenProxy used in the validation process
      certificate - CertificateWrapper to get a latest applicable revocation data for
      revocationData - a collection of CertificateRevocationWrapper to return revocation from
      controlTime - Date validation time
      bbbs - a map of executed Basic Building Blocks
      poe - POEExtraction a set of POEs
      Returns:
      CertificateRevocationWrapper
    • getAcceptableRevocationDataForPSVIfExistOrReturnAll

      public static List<eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper> getAcceptableRevocationDataForPSVIfExistOrReturnAll(eu.europa.esig.dss.diagnostic.TokenProxy token, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, Date currentTime, Map<String,eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks> bbbs, POEExtraction poe, eu.europa.esig.dss.model.policy.LevelRule revocationIssuerSunsetDateConstraint)
      This method verifies if there is an acceptable revocation data according to rules defined in 5.6.2.4 step 1) and returns a list of the revocation data. If none of the revocation data found, the method returns all the available revocation data
      Parameters:
      token - TokenProxy used in the validation process
      certificate - CertificateWrapper to get acceptable revocation data for
      currentTime - Date
      bbbs - a map of XmlBasicBuildingBlocks
      poe - POEExtraction
      revocationIssuerSunsetDateConstraint - LevelRule
      Returns:
      a list of CertificateRevocationWrappers
    • isTrustAnchor

      public static boolean isTrustAnchor(eu.europa.esig.dss.diagnostic.CertificateWrapper certificateWrapper, Date currentTime, eu.europa.esig.dss.model.policy.LevelRule certificateSunsetDateConstraint)
      This method verifies whether the given certificateWrapper can be considered as a trust anchor at the currentTime
      Parameters:
      certificateWrapper - CertificateWrapper trust anchor candidate
      currentTime - Date to verify certificate's sunset date, when applicable
      certificateSunsetDateConstraint - LevelRule
      Returns:
      TRUE if the certificate is a trust anchor at the given time, FALSE otherwise
    • isRevocationDataAcceptable

      public static boolean isRevocationDataAcceptable(eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks bbb, eu.europa.esig.dss.diagnostic.CertificateWrapper certificate, eu.europa.esig.dss.diagnostic.RevocationWrapper revocationData)
      This method verifies if a revocation data is acceptable for the given certificate according to the validation performed within bbb
      Parameters:
      bbb - XmlBasicBuildingBlocks of the validating token
      certificate - CertificateWrapper concerned certificate
      revocationData - RevocationWrapper to check
      Returns:
      TRUE if the revocation data is acceptable, FALSE otherwise
    • isLongTermAvailabilityAndIntegrityMaterialPresent

      public static boolean isLongTermAvailabilityAndIntegrityMaterialPresent(eu.europa.esig.dss.diagnostic.SignatureWrapper signature)
      This method verifies if the signature contains long-term availability and integrity material within its structure
      Parameters:
      signature - SignatureWrapper to verify
      Returns:
      TRUE if the long-term availability and integrity material is present, FALSE otherwise
    • getRevocationAcceptanceCheckerResult

      public static eu.europa.esig.dss.detailedreport.jaxb.XmlRAC getRevocationAcceptanceCheckerResult(eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks bbb, String certificateId, String revocationDataId)
      Return a corresponding XmlRAC result for the given certificate and revocationData
      Parameters:
      bbb - XmlBasicBuildingBlocks of the validating token
      certificateId - String concerned certificate id
      revocationDataId - String revocation data id to check
      Returns:
      XmlRAC
    • getFormattedDate

      public static String getFormattedDate(Date date)
      Returns a formatted String representation of a given Date
      Parameters:
      date - Date to be pretty-printed
      Returns:
      String formatted date
    • buildStringMessage

      public static String buildStringMessage(eu.europa.esig.dss.i18n.I18nProvider i18nProvider, eu.europa.esig.dss.i18n.MessageTag messageTag, Object... args)
      Builds a String message from the provided messageTag
      Parameters:
      i18nProvider - I18nProvider to build a message
      messageTag - MessageTag defining the message to be build
      args - the arguments to fill the message
      Returns:
      final message String
    • getCryptoPosition

      public static eu.europa.esig.dss.i18n.MessageTag getCryptoPosition(eu.europa.esig.dss.enumerations.Context context)
      Returns the message tag for the given context (signature creation,...)
      Parameters:
      context - the context
      Returns:
      the related message tag
    • getCertificateChainCryptoPosition

      public static eu.europa.esig.dss.i18n.MessageTag getCertificateChainCryptoPosition(eu.europa.esig.dss.enumerations.Context context)
      Returns the message tag for the certificate chain of the given context
      Parameters:
      context - the context
      Returns:
      the related message tag
    • getDigestMatcherCryptoPosition

      public static eu.europa.esig.dss.i18n.MessageTag getDigestMatcherCryptoPosition(eu.europa.esig.dss.diagnostic.jaxb.XmlDigestMatcher digestMatcher)
      Returns crypto position MessageTag for the given XmlDigestMatcher
      Parameters:
      digestMatcher - XmlDigestMatcher to get crypto position for
      Returns:
      MessageTag position
    • getDigestMatcherCryptoPosition

      public static eu.europa.esig.dss.i18n.MessageTag getDigestMatcherCryptoPosition(Collection<eu.europa.esig.dss.diagnostic.jaxb.XmlDigestMatcher> digestMatchers)
      Returns crypto position MessageTag for the given collection of XmlDigestMatchers
      Parameters:
      digestMatchers - a collection of XmlDigestMatchers to get crypto position for
      Returns:
      MessageTag position
    • getTimestampTypeMessageTag

      public static eu.europa.esig.dss.i18n.MessageTag getTimestampTypeMessageTag(eu.europa.esig.dss.enumerations.TimestampType timestampType)
      Returns MessageTag associated with the given timestamp type
      Parameters:
      timestampType - TimestampType to get related MessageTag for
      Returns:
      MessageTag
    • getContextPosition

      public static eu.europa.esig.dss.i18n.MessageTag getContextPosition(eu.europa.esig.dss.enumerations.Context context)
      Returns the message tag for the given context
      Parameters:
      context - Context
      Returns:
      MessageTag
    • getSubContextPosition

      public static eu.europa.esig.dss.i18n.MessageTag getSubContextPosition(eu.europa.esig.dss.enumerations.SubContext subContext)
      Returns the message tag for the given subContext
      Parameters:
      subContext - SubContext
      Returns:
      MessageTag
    • getValidationTimeMessageTag

      public static eu.europa.esig.dss.i18n.MessageTag getValidationTimeMessageTag(eu.europa.esig.dss.enumerations.ValidationTime validationTime)
      Returns a MessageTag corresponding to the given ValidationTime type
      Parameters:
      validationTime - ValidationTime
      Returns:
      MessageTag
    • toUrnOid

      public static String toUrnOid(String oid)
      Transforms the given OID to a URN format as per RFC 3061 e.g. "1.2.3" to "urn:oid:1.2.3"
      Parameters:
      oid - String
      Returns:
      String urn
    • getDomainName

      public static String getDomainName(String uri)
      This method returns a domain name for any given valid URI
      Parameters:
      uri - String representing URI
      Returns:
      String representing the extracted domain name, if applicable
    • processValueCheck

      public static boolean processValueCheck(String value, List<String> expectedValues)
      Checks the value against the list of expected values
      Parameters:
      value - String to check
      expectedValues - a list of String expected values
      Returns:
      TRUE if the value is allowed by the list of expected values, FALSE otherwise
    • processValuesCheck

      public static boolean processValuesCheck(List<String> values, List<String> expectedValues)
      Checks the values against the expected values
      Parameters:
      values - String to check
      expectedValues - Strings to check against
      Returns:
      TRUE if the values are allowed by the list of expected values, FALSE otherwise
    • getConstraintOrMaxLevel

      public static eu.europa.esig.dss.model.policy.LevelRule getConstraintOrMaxLevel(eu.europa.esig.dss.model.policy.LevelRule constraint, eu.europa.esig.dss.enumerations.Level maxLevel)
      This method is used to return the current level with a max limit of the maxLevel
      Parameters:
      constraint - LevelRule to check
      maxLevel - Level
      Returns:
      LevelRule
    • getLevelRule

      public static eu.europa.esig.dss.model.policy.LevelRule getLevelRule(eu.europa.esig.dss.enumerations.Level level)
      Generates an anonymous implementation of the LevelRule with the given Level
      Parameters:
      level - Level
      Returns:
      LevelRule