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 classThis class provides a user-friendly configuration of the execution levels for the last set cryptographic suite. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructorprotectedValidationPolicyLoader(ValidationPolicy validationPolicy) Constructor to create aValidationPolicyFactoryusing a custom validation policy -
Method Summary
Modifier and TypeMethodDescriptioncreate()Builds aValidationPolicystatic ValidationPolicyLoaderCreates an instance ofValidationPolicyFactoryfrom a default validation policystatic ValidationPolicyLoaderfromValidationPolicy(DSSDocument validationPolicy) Creates an instance ofValidationPolicyFactoryfrom a custom validation policy filestatic ValidationPolicyLoaderfromValidationPolicy(ValidationPolicy validationPolicy) Creates an instance ofValidationPolicyFactoryfrom a custom validation policystatic ValidationPolicyLoaderfromValidationPolicy(File validationPolicyFile) Creates an instance ofValidationPolicyFactoryfrom a custom validation policy filestatic ValidationPolicyLoaderfromValidationPolicy(InputStream validationPolicyStream) Creates an instance ofValidationPolicyFactoryfrom a custom validation policyInputStreamstatic ValidationPolicyLoaderfromValidationPolicy(String validationPolicyFilePath) Creates an instance ofValidationPolicyFactoryfrom 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 suiteDSSDocumentfor the given Context.withCryptographicSuiteForContext(DSSDocument cryptographicSuite, Context context, SubContext subContext) Sets a cryptographic suiteDSSDocumentfor 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 suiteFilefor the given Context.withCryptographicSuiteForContext(File cryptographicSuiteFile, Context context, SubContext subContext) Sets a cryptographic suiteFilefor the given Context and SubContext.withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context) Sets a cryptographic suiteInputStreamfor the given Context.withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context, SubContext subContext) Sets a cryptographic suiteInputStreamfor 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 aValidationPolicyFactoryusing a custom validation policy- Parameters:
validationPolicy-ValidationPolicyto use
-
-
Method Details
-
fromDefaultValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom a default validation policy- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom a custom validation policy file- Parameters:
validationPolicy-Filevalidation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom a custom validation policyInputStream- Parameters:
validationPolicyStream-InputStreamvalidation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom a custom validation policy file- Parameters:
validationPolicyFile-Filevalidation policy file- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom a custom validation policy file- Parameters:
validationPolicyFilePath-Stringpath to the validation policy file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem- Returns:
ValidationPolicyLoader
-
fromValidationPolicy
Creates an instance ofValidationPolicyFactoryfrom 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 originalValidationPolicyfile. It is also will be used when a cryptographic suite is not provided for a specific scope. The method#withCryptographicSuiteForContextcan 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 originalValidationPolicyfile. It is also will be used when a cryptographic suite is not provided for a specific scope. The method#withCryptographicSuiteForContextcan 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 originalValidationPolicyfile. It is also will be used when a cryptographic suite is not provided for a specific scope. The method#withCryptographicSuiteForContextcan 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 originalValidationPolicyfile. It is also will be used when a cryptographic suite is not provided for a specific scope. The method#withCryptographicSuiteForContextcan be used to specify constraints for a specific scope.- Parameters:
cryptographicSuiteFilePath-Stringpath 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 originalValidationPolicyfile. It is also will be used when a cryptographic suite is not provided for a specific scope. The method#withCryptographicSuiteForContextcan 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 suiteDSSDocumentfor 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-DSSDocumentcontext-Context- Returns:
ValidationPolicyLoader
-
withCryptographicSuiteForContext
public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context) Sets a cryptographic suiteInputStreamfor 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-InputStreamcontext-Context- Returns:
ValidationPolicyLoader
-
withCryptographicSuiteForContext
public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(File cryptographicSuiteFile, Context context) Sets a cryptographic suiteFilefor 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-Filecontext-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-Stringpath 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-CryptographicSuitecontext-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-ContextsubContext-SubContext- Returns:
ValidationPolicyLoader
-
withCryptographicSuiteForContext
public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(DSSDocument cryptographicSuite, Context context, SubContext subContext) Sets a cryptographic suiteDSSDocumentfor 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-DSSDocumentcontext-ContextsubContext-SubContext- Returns:
ValidationPolicyLoader
-
withCryptographicSuiteForContext
public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(InputStream cryptographicSuiteIS, Context context, SubContext subContext) Sets a cryptographic suiteInputStreamfor 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-InputStreamcontext-ContextsubContext-SubContext- Returns:
ValidationPolicyLoader
-
withCryptographicSuiteForContext
public ValidationPolicyLoader.ValidationPolicyLoaderWithCryptoSuite withCryptographicSuiteForContext(File cryptographicSuiteFile, Context context, SubContext subContext) Sets a cryptographic suiteFilefor 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-Filecontext-ContextsubContext-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-Stringpath to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystemcontext-ContextsubContext-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-CryptographicSuitecontext-ContextsubContext-SubContext- Returns:
ValidationPolicyLoader
-
create
Builds aValidationPolicy- Returns:
ValidationPolicy
-