Class ValidationPolicyLoader

java.lang.Object
eu.europa.esig.dss.validation.policy.ValidationPolicyLoader
Direct Known Subclasses:
ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite

public class ValidationPolicyLoader extends Object
This class creates an instance of ValidationPolicy
  • Constructor Details

    • ValidationPolicyLoader

      protected ValidationPolicyLoader()
      Empty constructor
    • ValidationPolicyLoader

      protected ValidationPolicyLoader(ValidationPolicy validationPolicy)
      Constructor to create a ValidationPolicyFactory using a custom validation policy
      Parameters:
      validationPolicy - ValidationPolicy to use
  • Method Details

    • fromDefaultValidationPolicy

      public static ValidationPolicyLoader fromDefaultValidationPolicy()
      Creates an instance of ValidationPolicyFactory from a default validation policy
      Returns:
      ValidationPolicyLoader
    • fromValidationPolicy

      public static ValidationPolicyLoader fromValidationPolicy(DSSDocument validationPolicy)
      Creates an instance of ValidationPolicyFactory from a custom validation policy file
      Parameters:
      validationPolicy - File validation policy file
      Returns:
      ValidationPolicyLoader
    • fromValidationPolicy

      public static ValidationPolicyLoader fromValidationPolicy(InputStream validationPolicyStream)
      Creates an instance of ValidationPolicyFactory from a custom validation policy InputStream
      Parameters:
      validationPolicyStream - InputStream validation policy file
      Returns:
      ValidationPolicyLoader
    • fromValidationPolicy

      public static ValidationPolicyLoader fromValidationPolicy(File validationPolicyFile)
      Creates an instance of ValidationPolicyFactory from a custom validation policy file
      Parameters:
      validationPolicyFile - File validation policy file
      Returns:
      ValidationPolicyLoader
    • fromValidationPolicy

      public static ValidationPolicyLoader fromValidationPolicy(String validationPolicyFilePath)
      Creates an instance of ValidationPolicyFactory from a custom validation policy file
      Parameters:
      validationPolicyFilePath - String path to the validation policy file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      Returns:
      ValidationPolicyLoader
    • fromValidationPolicy

      public static ValidationPolicyLoader fromValidationPolicy(ValidationPolicy validationPolicy)
      Creates an instance of ValidationPolicyFactory from a custom validation policy
      Parameters:
      validationPolicy - ValidationPolicy
      Returns:
      ValidationPolicyLoader
    • withDefaultCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withDefaultCryptographicSuite()
      Sets a default cryptographic suite for the given Context and SubContext. This method will load the first available cryptographic suite. DSS provides two modules with implementations, namely 'dss-policy-crypto-xml' and 'dss-policy-crypto-json'. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuite(DSSDocument cryptographicSuite)
      Sets a global cryptographic suite DSSDocument. The suite will overwrite all cryptographic constraints defined in the original ValidationPolicy file. It is also will be used when a cryptographic suite is not provided for a specific scope. The method #withCryptographicSuiteForContext can be used to specify constraints for a specific scope.
      Parameters:
      cryptographicSuite - DSSDocument
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuite(InputStream cryptographicSuiteIS)
      Sets a global cryptographic suite InputStream. The suite will overwrite all cryptographic constraints defined in the original ValidationPolicy file. It is also will be used when a cryptographic suite is not provided for a specific scope. The method #withCryptographicSuiteForContext can be used to specify constraints for a specific scope.
      Parameters:
      cryptographicSuiteIS - InputStream
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuite(File cryptographicSuiteFile)
      Sets a global cryptographic suite File. The suite will overwrite all cryptographic constraints defined in the original ValidationPolicy file. It is also will be used when a cryptographic suite is not provided for a specific scope. The method #withCryptographicSuiteForContext can be used to specify constraints for a specific scope.
      Parameters:
      cryptographicSuiteFile - File
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuite(String cryptographicSuiteFilePath)
      Sets a global cryptographic suite file. The suite will overwrite all cryptographic constraints defined in the original ValidationPolicy file. It is also will be used when a cryptographic suite is not provided for a specific scope. The method #withCryptographicSuiteForContext can be used to specify constraints for a specific scope.
      Parameters:
      cryptographicSuiteFilePath - String path to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuite

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuite(CryptographicSuite cryptographicSuite)
      Sets a global cryptographic suite. The suite will overwrite all cryptographic constraints defined in the original ValidationPolicy file. It is also will be used when a cryptographic suite is not provided for a specific scope. The method #withCryptographicSuiteForContext can be used to specify constraints for a specific scope.
      Parameters:
      cryptographicSuite - CryptographicSuite
      Returns:
      ValidationPolicyLoader
    • withDefaultCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withDefaultCryptographicSuiteForContext(Context context)
      Sets a default cryptographic suite for the given Context and SubContext. This method will load the first available cryptographic suite. DSS provides two modules with implementations, namely 'dss-policy-crypto-xml' and 'dss-policy-crypto-json'. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      context - Context
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(DSSDocument cryptographicSuite, Context context)
      Sets a cryptographic suite DSSDocument for the given Context. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuite - DSSDocument
      context - Context
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context)
      Sets a cryptographic suite InputStream for the given Context. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteIS - InputStream
      context - Context
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(File cryptographicSuiteFile, Context context)
      Sets a cryptographic suite File for the given Context. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteFile - File
      context - Context
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(String cryptographicSuiteFilePath, Context context)
      Sets a cryptographic suite file for the given Context. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteFilePath - String path to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      context - Context
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(CryptographicSuite cryptographicSuite, Context context)
      Sets a cryptographic suite for the given Context. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuite - CryptographicSuite
      context - Context
      Returns:
      ValidationPolicyLoader
    • withDefaultCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withDefaultCryptographicSuiteForContext(Context context, SubContext subContext)
      Sets a default cryptographic suite for the given Context and SubContext. This method will load the first available cryptographic suite. DSS provides two modules with implementations, namely 'dss-policy-crypto-xml' and 'dss-policy-crypto-json'. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(DSSDocument cryptographicSuite, Context context, SubContext subContext)
      Sets a cryptographic suite DSSDocument for the given Context and SubContext. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuite - DSSDocument
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context, SubContext subContext)
      Sets a cryptographic suite InputStream for the given Context and SubContext. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteIS - InputStream
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(File cryptographicSuiteFile, Context context, SubContext subContext)
      Sets a cryptographic suite File for the given Context and SubContext. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteFile - File
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(String cryptographicSuiteFilePath, Context context, SubContext subContext)
      Sets a cryptographic suite file for the given Context and SubContext. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuiteFilePath - String path to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • withCryptographicSuiteForContext

      public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(CryptographicSuite cryptographicSuite, Context context, SubContext subContext)
      Sets a cryptographic suite for the given Context and SubContext. The supported contexts are: SIGNATURE, COUNTER_SIGNATURE, TIMESTAMP, EVIDENCE_RECORD, REVOCATION. The supported subContext are: SIGNING_CERT and CA_CERTIFICATE. The cryptographic suite will be used only for the specific scope.
      Parameters:
      cryptographicSuite - CryptographicSuite
      context - Context
      subContext - SubContext
      Returns:
      ValidationPolicyLoader
    • create

      public ValidationPolicy create()
      Builds a ValidationPolicy
      Returns:
      ValidationPolicy