Class ValidationPolicyLoader
java.lang.Object
eu.europa.esig.dss.validation.policy.ValidationPolicyLoader
- Direct Known Subclasses:
ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite
This class creates an instance of
ValidationPolicy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class provides a user-friendly configuration of the execution levels for the last set cryptographic suite. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Empty constructorprotected
ValidationPolicyLoader
(ValidationPolicy validationPolicy) Constructor to create aValidationPolicyFactory
using a custom validation policy -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Builds aValidationPolicy
static ValidationPolicyLoader
Creates an instance ofValidationPolicyFactory
from a default validation policystatic ValidationPolicyLoader
fromValidationPolicy
(DSSDocument validationPolicy) Creates an instance ofValidationPolicyFactory
from a custom validation policy filestatic ValidationPolicyLoader
fromValidationPolicy
(ValidationPolicy validationPolicy) Creates an instance ofValidationPolicyFactory
from a custom validation policystatic ValidationPolicyLoader
fromValidationPolicy
(File validationPolicyFile) Creates an instance ofValidationPolicyFactory
from a custom validation policy filestatic ValidationPolicyLoader
fromValidationPolicy
(InputStream validationPolicyStream) Creates an instance ofValidationPolicyFactory
from a custom validation policyInputStream
static ValidationPolicyLoader
fromValidationPolicy
(String validationPolicyFilePath) Creates an instance ofValidationPolicyFactory
from a custom validation policy filewithCryptographicSuite
(DSSDocument cryptographicSuite) Sets a global cryptographic suiteDSSDocument
.withCryptographicSuite
(CryptographicSuite cryptographicSuite) Sets a global cryptographic suite.withCryptographicSuite
(File cryptographicSuiteFile) Sets a global cryptographic suiteFile
.withCryptographicSuite
(InputStream cryptographicSuiteIS) Sets a global cryptographic suiteInputStream
.withCryptographicSuite
(String cryptographicSuiteFilePath) Sets a global cryptographic suite file.withCryptographicSuiteForContext
(DSSDocument cryptographicSuite, Context context) Sets a cryptographic suiteDSSDocument
for the given Context.withCryptographicSuiteForContext
(DSSDocument cryptographicSuite, Context context, SubContext subContext) Sets a cryptographic suiteDSSDocument
for the given Context and SubContext.withCryptographicSuiteForContext
(CryptographicSuite cryptographicSuite, Context context) Sets a cryptographic suite for the given Context.withCryptographicSuiteForContext
(CryptographicSuite cryptographicSuite, Context context, SubContext subContext) Sets a cryptographic suite for the given Context and SubContext.withCryptographicSuiteForContext
(File cryptographicSuiteFile, Context context) Sets a cryptographic suiteFile
for the given Context.withCryptographicSuiteForContext
(File cryptographicSuiteFile, Context context, SubContext subContext) Sets a cryptographic suiteFile
for the given Context and SubContext.withCryptographicSuiteForContext
(InputStream cryptographicSuiteIS, Context context) Sets a cryptographic suiteInputStream
for the given Context.withCryptographicSuiteForContext
(InputStream cryptographicSuiteIS, Context context, SubContext subContext) Sets a cryptographic suiteInputStream
for the given Context and SubContext.withCryptographicSuiteForContext
(String cryptographicSuiteFilePath, Context context) Sets a cryptographic suite file for the given Context.withCryptographicSuiteForContext
(String cryptographicSuiteFilePath, Context context, SubContext subContext) Sets a cryptographic suite file for the given Context and SubContext.Sets a default cryptographic suite for the given Context and SubContext.Sets a default cryptographic suite for the given Context and SubContext.withDefaultCryptographicSuiteForContext
(Context context, SubContext subContext) Sets a default cryptographic suite for the given Context and SubContext.
-
Constructor Details
-
ValidationPolicyLoader
protected ValidationPolicyLoader()Empty constructor -
ValidationPolicyLoader
Constructor to create aValidationPolicyFactory
using a custom validation policy- Parameters:
validationPolicy
-ValidationPolicy
to use
-
-
Method Details
-
fromDefaultValidationPolicy
Creates an instance ofValidationPolicyFactory
from a default validation policy- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactory
from a custom validation policy file- Parameters:
validationPolicy
-File
validation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactory
from a custom validation policyInputStream
- Parameters:
validationPolicyStream
-InputStream
validation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactory
from a custom validation policy file- Parameters:
validationPolicyFile
-File
validation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactory
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
Creates an instance ofValidationPolicyFactory
from a custom validation policy- Parameters:
validationPolicy
-ValidationPolicy
- Returns:
ValidationPolicyLoader
-
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 suiteDSSDocument
. The suite will overwrite all cryptographic constraints defined in the originalValidationPolicy
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 suiteInputStream
. The suite will overwrite all cryptographic constraints defined in the originalValidationPolicy
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 suiteFile
. The suite will overwrite all cryptographic constraints defined in the originalValidationPolicy
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 originalValidationPolicy
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 originalValidationPolicy
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 suiteDSSDocument
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 suiteInputStream
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 suiteFile
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 filesystemcontext
-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 suiteDSSDocument
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 suiteInputStream
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 suiteFile
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 filesystemcontext
-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
Builds aValidationPolicy
- Returns:
ValidationPolicy
-