Package eu.europa.esig.dss.policy
Class EtsiValidationPolicy
java.lang.Object
eu.europa.esig.dss.policy.EtsiValidationPolicy
- All Implemented Interfaces:
ValidationPolicy
public class EtsiValidationPolicy extends Object implements ValidationPolicy
This class encapsulates the constraint file that controls the policy to be used during the validation process. It
adds the functions to direct access to the
file data. It is the implementation of the ETSI 102853 standard.
-
Constructor Summary
Constructors Constructor Description EtsiValidationPolicy(ConstraintsParameters policy)
-
Method Summary
-
Constructor Details
-
Method Details
-
getAlgorithmExpirationDate
Description copied from interface:ValidationPolicy
This function returns the algorithm expiration date extracted from the 'constraint.xml' file. If the TAG AlgoExpirationDate is not present within the constraintsnull
is returned.- Specified by:
getAlgorithmExpirationDate
in interfaceValidationPolicy
- Parameters:
algorithm
- algorithm (SHA1, SHA256, RSA2048...) to be checked- Returns:
- expiration date or null
-
getSignaturePolicyConstraint
Description copied from interface:ValidationPolicy
Indicates if the signature policy should be checked. If AcceptablePolicies element is absent within the constraint file then null is returned, otherwise the list of identifiers is initialised.- Specified by:
getSignaturePolicyConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SigningTime element is present in the constraint file, null otherwise.
-
getSignaturePolicyIdentifiedConstraint
- Specified by:
getSignaturePolicyIdentifiedConstraint
in interfaceValidationPolicy
-
getSignaturePolicyPolicyHashValid
- Specified by:
getSignaturePolicyPolicyHashValid
in interfaceValidationPolicy
-
getSignatureFormatConstraint
- Specified by:
getSignatureFormatConstraint
in interfaceValidationPolicy
-
getSignerInformationStoreConstraint
Description copied from interface:ValidationPolicy
This constraint checks if only one SignerInfo is present into a SignerInformationStore NOTE: applicable only for PAdES- Specified by:
getSignerInformationStoreConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SignerInformationStore element for a given context element is present in the constraint file, null otherwise.
-
getStructuralValidationConstraint
Description copied from interface:ValidationPolicy
Indicates if the structural validation should be checked. If StructuralValidation element is absent within the constraint file then null is returned.- Specified by:
getStructuralValidationConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if StructuralValidation element is present in the constraint file, null otherwise.
-
getSigningTimeConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: signing-time should be checked. If SigningTime element is absent within the constraint file then null is returned.- Specified by:
getSigningTimeConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SigningTime element is present in the constraint file, null otherwise.
-
getContentTypeConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: content-type should be checked. If ContentType element is absent within the constraint file then null is returned.- Specified by:
getContentTypeConstraint
in interfaceValidationPolicy
- Returns:
ValueConstraint
if ContentType element is present in the constraint file, null otherwise.
-
getCounterSignatureConstraint
- Specified by:
getCounterSignatureConstraint
in interfaceValidationPolicy
-
getContentHintsConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: content-hints should be checked. If ContentHints element is absent within the constraint file then null is returned.- Specified by:
getContentHintsConstraint
in interfaceValidationPolicy
- Returns:
ValueConstraint
if ContentHints element is present in the constraint file, null otherwise.
-
getContentIdentifierConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: content-identifier should be checked. If ContentIdentifier element is absent within the constraint file then null is returned.- Specified by:
getContentIdentifierConstraint
in interfaceValidationPolicy
- Returns:
ValueConstraint
if ContentIdentifier element is present in the constraint file, null otherwise.
-
getMessageDigestOrSignedPropertiesConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: message-digest (for CAdES) or SignedProperties (for XAdES) should be checked. If the relative element is absent within the constraint file then null is returned.- Specified by:
getMessageDigestOrSignedPropertiesConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if message-digests/SignedProperties element is present in the constraint file, null otherwise.
-
getCommitmentTypeIndicationConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: commitment-type-indication should be checked. If CommitmentTypeIndication element is absent within the constraint file then null is returned, otherwise the list of identifiers is initialised.- Specified by:
getCommitmentTypeIndicationConstraint
in interfaceValidationPolicy
- Returns:
MultiValuesConstraint
if CommitmentTypeIndication element is present in the constraint file, null otherwise.
-
getSignerLocationConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: signer-location should be checked. If SignerLocation element is absent within the constraint file then null is returned.- Specified by:
getSignerLocationConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SignerLocation element is present in the constraint file, null otherwise.
-
getClaimedRoleConstraint
Description copied from interface:ValidationPolicy
Indicates if the unsigned property: claimed-role should be checked. If ClaimedRoles element is absent within the constraint file then null is returned.- Specified by:
getClaimedRoleConstraint
in interfaceValidationPolicy
- Returns:
MultiValuesConstraint
if ClaimedRoles element is present in the constraint file, null otherwise.
-
getCertifiedRolesConstraint
Description copied from interface:ValidationPolicy
Return the mandated signer role.- Specified by:
getCertifiedRolesConstraint
in interfaceValidationPolicy
- Returns:
-
getPolicyName
Description copied from interface:ValidationPolicy
Returns the name of the policy.- Specified by:
getPolicyName
in interfaceValidationPolicy
- Returns:
-
getPolicyDescription
Description copied from interface:ValidationPolicy
Returns the policy description.- Specified by:
getPolicyDescription
in interfaceValidationPolicy
- Returns:
-
getSignatureCryptographicConstraint
Description copied from interface:ValidationPolicy
This method creates theSignatureCryptographicConstraint
corresponding to the context parameter. If AcceptableEncryptionAlgo is not present in the constraint file the null is returned.- Specified by:
getSignatureCryptographicConstraint
in interfaceValidationPolicy
- Parameters:
context
- The context of the signature cryptographic constraints: MainSignature, Timestamp, Revocation- Returns:
SignatureCryptographicConstraint
if AcceptableEncryptionAlgo for a given context element is present in the constraint file, null otherwise.
-
getCertificateCryptographicConstraint
public CryptographicConstraint getCertificateCryptographicConstraint(Context context, SubContext subContext)Description copied from interface:ValidationPolicy
This method creates theSignatureCryptographicConstraint
corresponding to the context parameter. If AcceptableEncryptionAlgo is not present in the constraint file the null is returned.- Specified by:
getCertificateCryptographicConstraint
in interfaceValidationPolicy
- Parameters:
context
- The context of the signature cryptographic constraints: MainSignature, Timestamp, RevocationsubContext
- the sub context of the signature cryptographic constraints: EMPTY (signature itself), SigningCertificate, CACertificate- Returns:
SignatureCryptographicConstraint
if AcceptableEncryptionAlgo for a given context element is present in the constraint file, null otherwise.
-
getDefaultCryptographicConstraint
-
getCertificateKeyUsageConstraint
public MultiValuesConstraint getCertificateKeyUsageConstraint(Context context, SubContext subContext)- Specified by:
getCertificateKeyUsageConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if key-usage for a given context element is present in the constraint file, null otherwise.
-
getCertificateExtendedKeyUsageConstraint
public MultiValuesConstraint getCertificateExtendedKeyUsageConstraint(Context context, SubContext subContext)- Specified by:
getCertificateExtendedKeyUsageConstraint
in interfaceValidationPolicy
-
getCertificateSurnameConstraint
public MultiValuesConstraint getCertificateSurnameConstraint(Context context, SubContext subContext)- Specified by:
getCertificateSurnameConstraint
in interfaceValidationPolicy
-
getCertificateGivenNameConstraint
public MultiValuesConstraint getCertificateGivenNameConstraint(Context context, SubContext subContext)- Specified by:
getCertificateGivenNameConstraint
in interfaceValidationPolicy
-
getCertificateCommonNameConstraint
public MultiValuesConstraint getCertificateCommonNameConstraint(Context context, SubContext subContext)- Specified by:
getCertificateCommonNameConstraint
in interfaceValidationPolicy
-
getCertificatePseudonymConstraint
public MultiValuesConstraint getCertificatePseudonymConstraint(Context context, SubContext subContext)- Specified by:
getCertificatePseudonymConstraint
in interfaceValidationPolicy
-
getCertificateCountryConstraint
public MultiValuesConstraint getCertificateCountryConstraint(Context context, SubContext subContext)- Specified by:
getCertificateCountryConstraint
in interfaceValidationPolicy
-
getCertificateOrganizationNameConstraint
public MultiValuesConstraint getCertificateOrganizationNameConstraint(Context context, SubContext subContext)- Specified by:
getCertificateOrganizationNameConstraint
in interfaceValidationPolicy
-
getCertificateOrganizationUnitConstraint
public MultiValuesConstraint getCertificateOrganizationUnitConstraint(Context context, SubContext subContext)- Specified by:
getCertificateOrganizationUnitConstraint
in interfaceValidationPolicy
-
getCertificatePseudoUsageConstraint
- Specified by:
getCertificatePseudoUsageConstraint
in interfaceValidationPolicy
-
getCertificateSerialNumberConstraint
public LevelConstraint getCertificateSerialNumberConstraint(Context context, SubContext subContext)- Specified by:
getCertificateSerialNumberConstraint
in interfaceValidationPolicy
-
getCertificateNotExpiredConstraint
- Specified by:
getCertificateNotExpiredConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if Expiration for a given context element is present in the constraint file, null otherwise.
-
getProspectiveCertificateChainConstraint
Description copied from interface:ValidationPolicy
This constraint requests the presence of the trust anchor in the certificate chain.- Specified by:
getProspectiveCertificateChainConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if ProspectiveCertificateChain element for a given context element is present in the constraint file, null otherwise.
-
getCertificateAuthorityInfoAccessPresentConstraint
public LevelConstraint getCertificateAuthorityInfoAccessPresentConstraint(Context context, SubContext subContext)- Specified by:
getCertificateAuthorityInfoAccessPresentConstraint
in interfaceValidationPolicy
-
getCertificateRevocationInfoAccessPresentConstraint
public LevelConstraint getCertificateRevocationInfoAccessPresentConstraint(Context context, SubContext subContext)- Specified by:
getCertificateRevocationInfoAccessPresentConstraint
in interfaceValidationPolicy
-
getCertificateSignatureConstraint
- Specified by:
getCertificateSignatureConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if Signature for a given context element is present in the constraint file, null otherwise.
-
getUnknownStatusConstraint
- Specified by:
getUnknownStatusConstraint
in interfaceValidationPolicy
-
getOCSPResponseCertHashPresentConstraint
- Specified by:
getOCSPResponseCertHashPresentConstraint
in interfaceValidationPolicy
-
getOCSPResponseCertHashMatchConstraint
- Specified by:
getOCSPResponseCertHashMatchConstraint
in interfaceValidationPolicy
-
getRevocationDataAvailableConstraint
public LevelConstraint getRevocationDataAvailableConstraint(Context context, SubContext subContext)- Specified by:
getRevocationDataAvailableConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if RevocationDataAvailable for a given context element is present in the constraint file, null otherwise.
-
getRevocationDataNextUpdatePresentConstraint
public LevelConstraint getRevocationDataNextUpdatePresentConstraint(Context context, SubContext subContext)- Specified by:
getRevocationDataNextUpdatePresentConstraint
in interfaceValidationPolicy
-
getCertificateRevocationFreshnessConstraint
public LevelConstraint getCertificateRevocationFreshnessConstraint(Context context, SubContext subContext)- Specified by:
getCertificateRevocationFreshnessConstraint
in interfaceValidationPolicy
-
getCertificateNotRevokedConstraint
- Specified by:
getCertificateNotRevokedConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if Revoked for a given context element is present in the constraint file, null otherwise.
-
getCertificateNotOnHoldConstraint
- Specified by:
getCertificateNotOnHoldConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if OnHold for a given context element is present in the constraint file, null otherwise.
-
getCertificateNotSelfSignedConstraint
public LevelConstraint getCertificateNotSelfSignedConstraint(Context context, SubContext subContext)- Specified by:
getCertificateNotSelfSignedConstraint
in interfaceValidationPolicy
-
getCertificateSelfSignedConstraint
- Specified by:
getCertificateSelfSignedConstraint
in interfaceValidationPolicy
-
getTrustedServiceStatusConstraint
- Specified by:
getTrustedServiceStatusConstraint
in interfaceValidationPolicy
-
getTrustedServiceTypeIdentifierConstraint
- Specified by:
getTrustedServiceTypeIdentifierConstraint
in interfaceValidationPolicy
-
getCertificatePolicyIdsConstraint
public MultiValuesConstraint getCertificatePolicyIdsConstraint(Context context, SubContext subContext)- Specified by:
getCertificatePolicyIdsConstraint
in interfaceValidationPolicy
-
getCertificateQCStatementIdsConstraint
public MultiValuesConstraint getCertificateQCStatementIdsConstraint(Context context, SubContext subContext)- Specified by:
getCertificateQCStatementIdsConstraint
in interfaceValidationPolicy
-
getCertificateIssuedToNaturalPersonConstraint
public LevelConstraint getCertificateIssuedToNaturalPersonConstraint(Context context, SubContext subContext)- Specified by:
getCertificateIssuedToNaturalPersonConstraint
in interfaceValidationPolicy
-
getCertificateQualificationConstraint
public LevelConstraint getCertificateQualificationConstraint(Context context, SubContext subContext)- Specified by:
getCertificateQualificationConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if Qualification for a given context element is present in the constraint file, null otherwise.
-
getCertificateSupportedByQSCDConstraint
public LevelConstraint getCertificateSupportedByQSCDConstraint(Context context, SubContext subContext)Description copied from interface:ValidationPolicy
Indicates if the end user certificate used in validating the signature is mandated to be supported by a secure signature creation device (QSCD).- Specified by:
getCertificateSupportedByQSCDConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SupportedByQSCD for a given context element is present in the constraint file, null otherwise.
-
getCertificateIssuedToLegalPersonConstraint
public LevelConstraint getCertificateIssuedToLegalPersonConstraint(Context context, SubContext subContext)- Specified by:
getCertificateIssuedToLegalPersonConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if IssuedToLegalPerson for a given context element is present in the constraint file, null otherwise.
-
getSigningCertificateRecognitionConstraint
- Specified by:
getSigningCertificateRecognitionConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if Recognition for a given context element is present in the constraint file, null otherwise.
-
getSigningCertificateAttributePresentConstraint
- Specified by:
getSigningCertificateAttributePresentConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if SigningCertificateAttribute for a given context element is present in the constraint file, null otherwise.
-
getUnicitySigningCertificateAttributeConstraint
- Specified by:
getUnicitySigningCertificateAttributeConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if UnicitySigningCertificate for a given context element is present in the constraint file, null otherwise.
-
getSigningCertificateDigestValuePresentConstraint
- Specified by:
getSigningCertificateDigestValuePresentConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if DigestValuePresent for a given context element is present in the constraint file, null otherwise.
-
getSigningCertificateDigestValueMatchConstraint
- Specified by:
getSigningCertificateDigestValueMatchConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if DigestValueMatch for a given context element is present in the constraint file, null otherwise.
-
getSigningCertificateIssuerSerialMatchConstraint
- Specified by:
getSigningCertificateIssuerSerialMatchConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if IssuerSerialMatch for a given context element is present in the constraint file, null otherwise.
-
getReferenceDataExistenceConstraint
- Specified by:
getReferenceDataExistenceConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if ReferenceDataExistence for a given context element is present in the constraint file, null otherwise.
-
getReferenceDataIntactConstraint
- Specified by:
getReferenceDataIntactConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if ReferenceDataIntact for a given context element is present in the constraint file, null otherwise.
-
getManifestEntryObjectExistenceConstraint
- Specified by:
getManifestEntryObjectExistenceConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if ManifestEntryObjectExistence for a given context element is present in the constraint file, null otherwise.
-
getSignatureIntactConstraint
- Specified by:
getSignatureIntactConstraint
in interfaceValidationPolicy
- Returns:
SignatureDataIntact
if SignatureIntact for a given context element is present in the constraint file, null otherwise.
-
getSignatureDuplicatedConstraint
- Specified by:
getSignatureDuplicatedConstraint
in interfaceValidationPolicy
- Returns:
SignatureDuplicated
if SignatureDuplicated for a given context element is present in the constraint file, null otherwise.
-
getBestSignatureTimeBeforeExpirationDateOfSigningCertificateConstraint
Description copied from interface:ValidationPolicy
This constraint checks if the certificate is not expired on best-signature-time- Specified by:
getBestSignatureTimeBeforeExpirationDateOfSigningCertificateConstraint
in interfaceValidationPolicy
-
getRevocationTimeAgainstBestSignatureTime
- Specified by:
getRevocationTimeAgainstBestSignatureTime
in interfaceValidationPolicy
-
getTimestampCoherenceConstraint
- Specified by:
getTimestampCoherenceConstraint
in interfaceValidationPolicy
-
getTimestampDelayConstraint
- Specified by:
getTimestampDelayConstraint
in interfaceValidationPolicy
-
getRevocationFreshnessConstraint
- Specified by:
getRevocationFreshnessConstraint
in interfaceValidationPolicy
-
getFullScopeConstraint
- Specified by:
getFullScopeConstraint
in interfaceValidationPolicy
-
getContentTimestampConstraint
Description copied from interface:ValidationPolicy
Indicates if the signed property: content-time-stamp should be checked. If ContentTimeStamp element is absent within the constraint file then null is returned.- Specified by:
getContentTimestampConstraint
in interfaceValidationPolicy
- Returns:
LevelConstraint
if ContentTimeStamp element is present in the constraint file, null otherwise.
-
getAcceptedContainerTypesConstraint
- Specified by:
getAcceptedContainerTypesConstraint
in interfaceValidationPolicy
-
getZipCommentPresentConstraint
- Specified by:
getZipCommentPresentConstraint
in interfaceValidationPolicy
-
getAcceptedZipCommentsConstraint
- Specified by:
getAcceptedZipCommentsConstraint
in interfaceValidationPolicy
-
getMimeTypeFilePresentConstraint
- Specified by:
getMimeTypeFilePresentConstraint
in interfaceValidationPolicy
-
getAcceptedMimeTypeContentsConstraint
- Specified by:
getAcceptedMimeTypeContentsConstraint
in interfaceValidationPolicy
-
getAllFilesSignedConstraint
- Specified by:
getAllFilesSignedConstraint
in interfaceValidationPolicy
-
getManifestFilePresentConstraint
- Specified by:
getManifestFilePresentConstraint
in interfaceValidationPolicy
-
getSignedFilesPresentConstraint
- Specified by:
getSignedFilesPresentConstraint
in interfaceValidationPolicy
-
isEIDASConstraintPresent
public boolean isEIDASConstraintPresent()- Specified by:
isEIDASConstraintPresent
in interfaceValidationPolicy
-
getTLFreshnessConstraint
- Specified by:
getTLFreshnessConstraint
in interfaceValidationPolicy
-
getTLWellSignedConstraint
- Specified by:
getTLWellSignedConstraint
in interfaceValidationPolicy
-
getTLNotExpiredConstraint
- Specified by:
getTLNotExpiredConstraint
in interfaceValidationPolicy
-
getTLVersionConstraint
- Specified by:
getTLVersionConstraint
in interfaceValidationPolicy
-
getValidationModel
Description copied from interface:ValidationPolicy
Returns the used validation model (default is SHELL). Alternatives are CHAIN and HYBRID- Specified by:
getValidationModel
in interfaceValidationPolicy
- Returns:
- the validation model to be used
-
getSignatureConstraints
- Specified by:
getSignatureConstraints
in interfaceValidationPolicy
-
getTimestampConstraints
- Specified by:
getTimestampConstraints
in interfaceValidationPolicy
-
getRevocationConstraints
- Specified by:
getRevocationConstraints
in interfaceValidationPolicy
-
getEIDASConstraints
- Specified by:
getEIDASConstraints
in interfaceValidationPolicy
-
getCryptographic
- Specified by:
getCryptographic
in interfaceValidationPolicy
-