Class ValidationProcessUtils

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

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

    • isAllowedBasicSignatureValidation

      public static boolean isAllowedBasicSignatureValidation(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(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(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(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 CertificateRevocationWrapper getLatestAcceptableRevocationData(TokenProxy token, CertificateWrapper certificate, Collection<CertificateRevocationWrapper> revocationData, Date controlTime, Map<String,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<CertificateRevocationWrapper> getAcceptableRevocationDataForPSVIfExistOrReturnAll(TokenProxy token, CertificateWrapper certificate, Date currentTime, Map<String,XmlBasicBuildingBlocks> bbbs, POEExtraction poe, 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(CertificateWrapper certificateWrapper, Date currentTime, 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(XmlBasicBuildingBlocks bbb, CertificateWrapper certificate, 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(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 XmlRAC getRevocationAcceptanceCheckerResult(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(I18nProvider i18nProvider, 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 MessageTag getCryptoPosition(Context context)
      Returns the message tag for the given context (signature creation,...)
      Parameters:
      context - the context
      Returns:
      the related message tag
    • getCertificateChainCryptoPosition

      public static MessageTag getCertificateChainCryptoPosition(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 MessageTag getDigestMatcherCryptoPosition(XmlDigestMatcher digestMatcher)
      Returns crypto position MessageTag for the given XmlDigestMatcher
      Parameters:
      digestMatcher - XmlDigestMatcher to get crypto position for
      Returns:
      MessageTag position
    • getDigestMatcherCryptoPosition

      public static MessageTag getDigestMatcherCryptoPosition(Collection<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 MessageTag getTimestampTypeMessageTag(TimestampType timestampType)
      Returns MessageTag associated with the given timestamp type
      Parameters:
      timestampType - TimestampType to get related MessageTag for
      Returns:
      MessageTag
    • getContextPosition

      public static MessageTag getContextPosition(Context context)
      Returns the message tag for the given context
      Parameters:
      context - Context
      Returns:
      MessageTag
    • getSubContextPosition

      public static MessageTag getSubContextPosition(SubContext subContext)
      Returns the message tag for the given subContext
      Parameters:
      subContext - SubContext
      Returns:
      MessageTag
    • getValidationTimeMessageTag

      public static MessageTag getValidationTimeMessageTag(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 LevelRule getConstraintOrMaxLevel(LevelRule constraint, 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 LevelRule getLevelRule(Level level)
      Generates an anonymous implementation of the LevelRule with the given Level
      Parameters:
      level - Level
      Returns:
      LevelRule