Class SignatureValidationContext
- All Implemented Interfaces:
ValidationContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Date
This is the time at what the validation is carried out. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor instantiating object with null or empty values and current timeSignatureValidationContext
(Date validationTime) Constructor instantiating object with null or empty values and provided time -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCertificateTokenForVerification
(CertificateToken certificateToken) Adds a new certificate token to the list of tokens to verify.void
addDocumentCertificateSource
(CertificateSource certificateSource) Adds an extracted certificate source to the used list of sourcesvoid
addDocumentCertificateSource
(ListCertificateSource listCertificateSource) Adds a list certificate source to the used list of sourcesvoid
addDocumentCRLSource
(ListRevocationSource<CRL> crlSource) Adds a list CRL source to the used list of sourcesvoid
addDocumentCRLSource
(OfflineRevocationSource<CRL> crlSource) Adds an extracted CRL source to the used list of sourcesvoid
addDocumentOCSPSource
(ListRevocationSource<OCSP> ocspSource) Adds a listd OCSP source to the used list of sourcesvoid
addDocumentOCSPSource
(OfflineRevocationSource<OCSP> ocspSource) Adds an extracted OCSP source to the used list of sourcesvoid
addEvidenceRecordForVerification
(EvidenceRecord evidenceRecord) Adds Evidence Record's content to proceed with validationvoid
addRevocationTokenForVerification
(RevocationToken<?> revocationToken) Adds a new revocation token to the list of tokens to verify.void
addSignatureForVerification
(AdvancedSignature signature) Adds a new signature to collect the information to verify.void
addTimestampTokenForVerification
(TimestampToken timestampToken) Adds a new timestamp token to the list of tokens to verify.protected RevocationFreshnessStatus
Returns the status of the POE covered by revocation data checkprotected TokenStatus
Returns the status of the required revocation data present checkprotected RevocationFreshnessStatus
Returns the status of the all signature certificates have fresh revocation data checkprotected TokenStatus
Returns the status of the all signature certificates not revoked checkprotected SignatureStatus
Returns the status of the all signatures are yet valid checkprotected SignatureStatus
Returns the status of the all signatures not expired checkprotected TokenStatus
Returns the status of the all timestamps valid checkprotected TokenStatus
certificateIsYetValid
(CertificateToken certificateToken) Returns the status of the certificate yet valid checkprotected TokenStatus
certificateNotExpired
(CertificateToken certificateToken) Returns the status of certificate not expired checkprotected TokenStatus
certificateNotRevoked
(CertificateToken certificateToken) Returns the status of the certificate not revoked checkboolean
This method returns if all POE (timestamp tokens) are covered by a revocation data.boolean
This method returns if all processed certificates have a revocation data.boolean
This method returns whether for all signature's certificate chain certificates there is a fresh revocation data, after the earliest available timestamp token production time.boolean
This method returns whether none of the signature's certificate chain certificates are not revoked, validating recursively.boolean
This method returns whether all signatures added to the ValidationContext have been produced with yet valid certificates at the time of signingboolean
This method returns whether all signatures added to the ValidationContext are not yet expiredboolean
This method returns if all processed timestamps are valid and intact.boolean
checkCertificateIsYetValid
(CertificateToken certificateToken) This method returns whether the certificate token is yet validboolean
checkCertificateNotExpired
(CertificateToken certificateToken) This method returns whether the certificate token is not yet expiredboolean
checkCertificateNotRevoked
(CertificateToken certificateToken) This method returns if the certificate is not revokedReturns a list of allCertificateSource
s used during the validation process.protected CertificateVerifier
Gets theCertificateVerifier
instanceGets the current validation time.Returns a list of allCertificateSource
s extracted from a validating document (signature(s), timestamp(s))Returns a list of all CRLOfflineRevocationSource
s extracted from a validating documentReturns a list of all OCSPOfflineRevocationSource
s extracted from a validating documentReturns a read only list of all certificates used in the process of the validation of all signatures from the given document.Returns evidence records added to the validation contextSet
<RevocationToken<?>> Returns a read only list of all revocations used in the process of the validation of all signatures from the given document.Returns signatures added to the validation contextReturns a read only list of all timestamps processed during the validation of all signatures from the given document.List
<RevocationToken<?>> getRevocationData
(CertificateToken certificateToken) Returns revocation data for the givencertificateToken
, whether extracted from a signature file or obtained online.getValidationData
(AdvancedSignature signature) Returns a validation data for the given signature's certificate chaingetValidationData
(TimestampToken timestampToken) Returns a validation data for the given timestampToken's certificate chainvoid
initialize
(CertificateVerifier certificateVerifier) This method initializes theValidationContext
by retrieving the relevant data fromcertificateVerifier
protected boolean
isTimestampValid
(TimestampToken timestampToken) This method verifies whether atimestampToken
is valid and can be used as a valid POE for covered objectsvoid
validate()
Carries out the validation process in recursive manner for not yet checked tokens.
-
Field Details
-
currentTime
This is the time at what the validation is carried out.
-
-
Constructor Details
-
SignatureValidationContext
public SignatureValidationContext()Default constructor instantiating object with null or empty values and current time -
SignatureValidationContext
Constructor instantiating object with null or empty values and provided time- Parameters:
validationTime
-Date
validation time to be used during the execution
-
-
Method Details
-
initialize
Description copied from interface:ValidationContext
This method initializes theValidationContext
by retrieving the relevant data fromcertificateVerifier
- Specified by:
initialize
in interfaceValidationContext
- Parameters:
certificateVerifier
- The certificate verifier (eg: using the TSL as list of trusted certificates).
-
getCertificateVerifier
Gets theCertificateVerifier
instance- Returns:
CertificateVerifier
-
addSignatureForVerification
Description copied from interface:ValidationContext
Adds a new signature to collect the information to verify.- Specified by:
addSignatureForVerification
in interfaceValidationContext
- Parameters:
signature
-AdvancedSignature
to extract data to be verified
-
addDocumentCertificateSource
Description copied from interface:ValidationContext
Adds an extracted certificate source to the used list of sources- Specified by:
addDocumentCertificateSource
in interfaceValidationContext
- Parameters:
certificateSource
-CertificateSource
-
addDocumentCertificateSource
Description copied from interface:ValidationContext
Adds a list certificate source to the used list of sources- Specified by:
addDocumentCertificateSource
in interfaceValidationContext
- Parameters:
listCertificateSource
-ListCertificateSource
-
addDocumentCRLSource
Description copied from interface:ValidationContext
Adds an extracted CRL source to the used list of sources- Specified by:
addDocumentCRLSource
in interfaceValidationContext
- Parameters:
crlSource
-OfflineRevocationSource
for CRL
-
addDocumentCRLSource
Description copied from interface:ValidationContext
Adds a list CRL source to the used list of sources- Specified by:
addDocumentCRLSource
in interfaceValidationContext
- Parameters:
crlSource
-ListRevocationSource
for CRL
-
addDocumentOCSPSource
Description copied from interface:ValidationContext
Adds an extracted OCSP source to the used list of sources- Specified by:
addDocumentOCSPSource
in interfaceValidationContext
- Parameters:
ocspSource
-OfflineRevocationSource
for OCSP
-
addDocumentOCSPSource
Description copied from interface:ValidationContext
Adds a listd OCSP source to the used list of sources- Specified by:
addDocumentOCSPSource
in interfaceValidationContext
- Parameters:
ocspSource
-ListRevocationSource
for OCSP
-
getCurrentTime
Description copied from interface:ValidationContext
Gets the current validation time.- Specified by:
getCurrentTime
in interfaceValidationContext
- Returns:
Date
-
getAllCertificateSources
Description copied from interface:ValidationContext
Returns a list of allCertificateSource
s used during the validation process. It is represented by sources extracted from the provided document (e.g. signatures, timestamps) as well as the sources obtained during the validation process (e.g. AIA, OCSP).- Specified by:
getAllCertificateSources
in interfaceValidationContext
- Returns:
ListCertificateSource
-
getDocumentCertificateSource
Description copied from interface:ValidationContext
Returns a list of allCertificateSource
s extracted from a validating document (signature(s), timestamp(s))- Specified by:
getDocumentCertificateSource
in interfaceValidationContext
- Returns:
ListCertificateSource
-
getDocumentCRLSource
Description copied from interface:ValidationContext
Returns a list of all CRLOfflineRevocationSource
s extracted from a validating document- Specified by:
getDocumentCRLSource
in interfaceValidationContext
- Returns:
ListRevocationSource
-
getDocumentOCSPSource
Description copied from interface:ValidationContext
Returns a list of all OCSPOfflineRevocationSource
s extracted from a validating document- Specified by:
getDocumentOCSPSource
in interfaceValidationContext
- Returns:
ListRevocationSource
-
addRevocationTokenForVerification
Description copied from interface:ValidationContext
Adds a new revocation token to the list of tokens to verify. If the revocation token has already been added then it is ignored.- Specified by:
addRevocationTokenForVerification
in interfaceValidationContext
- Parameters:
revocationToken
- an instance ofRevocationToken
revocation tokens to verify
-
addCertificateTokenForVerification
Description copied from interface:ValidationContext
Adds a new certificate token to the list of tokens to verify. If the certificate token has already been added then it is ignored.- Specified by:
addCertificateTokenForVerification
in interfaceValidationContext
- Parameters:
certificateToken
-CertificateToken
certificate token to verify
-
addTimestampTokenForVerification
Description copied from interface:ValidationContext
Adds a new timestamp token to the list of tokens to verify. If the timestamp token has already been added then it is ignored.- Specified by:
addTimestampTokenForVerification
in interfaceValidationContext
- Parameters:
timestampToken
-TimestampToken
timestamp token to verify
-
isTimestampValid
This method verifies whether atimestampToken
is valid and can be used as a valid POE for covered objects- Parameters:
timestampToken
-TimestampToken
to be checked- Returns:
- TRUE if the timestamp is valid, FALSE otherwise
-
addEvidenceRecordForVerification
Description copied from interface:ValidationContext
Adds Evidence Record's content to proceed with validation- Specified by:
addEvidenceRecordForVerification
in interfaceValidationContext
- Parameters:
evidenceRecord
-EvidenceRecord
to add content from
-
validate
public void validate()Description copied from interface:ValidationContext
Carries out the validation process in recursive manner for not yet checked tokens.- Specified by:
validate
in interfaceValidationContext
-
getRevocationData
Description copied from interface:ValidationContext
Returns revocation data for the givencertificateToken
, whether extracted from a signature file or obtained online.- Specified by:
getRevocationData
in interfaceValidationContext
- Parameters:
certificateToken
-CertificateToken
to retrieve revocation data for- Returns:
- a list of
RevocationToken
s
-
checkAllRequiredRevocationDataPresent
public boolean checkAllRequiredRevocationDataPresent()Description copied from interface:ValidationContext
This method returns if all processed certificates have a revocation data.NOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllRequiredRevocationDataPresent()
for handling the check with custom alerts.- Specified by:
checkAllRequiredRevocationDataPresent
in interfaceValidationContext
- Returns:
- true if all needed revocation data are present
-
allRequiredRevocationDataPresent
Returns the status of the required revocation data present check- Returns:
TokenStatus
-
checkAllPOECoveredByRevocationData
public boolean checkAllPOECoveredByRevocationData()Description copied from interface:ValidationContext
This method returns if all POE (timestamp tokens) are covered by a revocation data.NOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllPOECoveredByRevocationData()
for handling the check with custom alerts.- Specified by:
checkAllPOECoveredByRevocationData
in interfaceValidationContext
- Returns:
- true if all timestamps are covered by a usable revocation data
-
allPOECoveredByRevocationData
Returns the status of the POE covered by revocation data check- Returns:
RevocationFreshnessStatus
-
checkAllTimestampsValid
public boolean checkAllTimestampsValid()Description copied from interface:ValidationContext
This method returns if all processed timestamps are valid and intact.NOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllTimestampsValid()
for handling the check with custom alerts.- Specified by:
checkAllTimestampsValid
in interfaceValidationContext
- Returns:
- true if all timestamps are valid
-
allTimestampsValid
Returns the status of the all timestamps valid check- Returns:
TokenStatus
-
checkCertificateNotRevoked
Description copied from interface:ValidationContext
This method returns if the certificate is not revokedNOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertCertificateNotRevoked(CertificateToken)
for handling the check with custom alerts.- Specified by:
checkCertificateNotRevoked
in interfaceValidationContext
- Parameters:
certificateToken
-CertificateToken
certificate to be checked- Returns:
- true if all certificates are valid
-
certificateNotRevoked
Returns the status of the certificate not revoked check- Parameters:
certificateToken
-CertificateToken
certificate to be checked- Returns:
TokenStatus
-
checkAllSignatureCertificatesNotRevoked
public boolean checkAllSignatureCertificatesNotRevoked()Description copied from interface:ValidationContext
This method returns whether none of the signature's certificate chain certificates are not revoked, validating recursively.NOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllSignatureCertificatesNotRevoked()
for handling the check with custom alerts.- Specified by:
checkAllSignatureCertificatesNotRevoked
in interfaceValidationContext
- Returns:
- true if all certificates are valid
-
allSignatureCertificatesNotRevoked
Returns the status of the all signature certificates not revoked check- Returns:
TokenStatus
-
checkAllSignatureCertificateHaveFreshRevocationData
public boolean checkAllSignatureCertificateHaveFreshRevocationData()Description copied from interface:ValidationContext
This method returns whether for all signature's certificate chain certificates there is a fresh revocation data, after the earliest available timestamp token production time.NOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllSignatureCertificateHaveFreshRevocationData()
for handling the check with custom alerts.- Specified by:
checkAllSignatureCertificateHaveFreshRevocationData
in interfaceValidationContext
- Returns:
- true if all signature certificates have an updated revocation data (after signature-time-stamp production time)
-
allSignatureCertificateHaveFreshRevocationData
Returns the status of the all signature certificates have fresh revocation data check- Returns:
RevocationFreshnessStatus
-
checkAllSignaturesNotExpired
public boolean checkAllSignaturesNotExpired()Description copied from interface:ValidationContext
This method returns whether all signatures added to the ValidationContext are not yet expiredNOTE: Since DSS 6.2 the behavior of the method has changed, returning only the boolean validation result, without alerts handling. Please see
ValidationAlerter.assertAllSignaturesNotExpired()
for handling the check with custom alerts.- Specified by:
checkAllSignaturesNotExpired
in interfaceValidationContext
- Returns:
- true if the signing certificate or its POE(s) not yet expired, false otherwise
-
allSignaturesNotExpired
Returns the status of the all signatures not expired check- Returns:
SignatureStatus
-
checkCertificateNotExpired
Description copied from interface:ValidationContext
This method returns whether the certificate token is not yet expired- Specified by:
checkCertificateNotExpired
in interfaceValidationContext
- Parameters:
certificateToken
-CertificateToken
to be validated- Returns:
- true if the certificate or/and its POE(s) are not yet expired, false otherwise
-
certificateNotExpired
Returns the status of certificate not expired check- Parameters:
certificateToken
-CertificateToken
to be verified- Returns:
SignatureStatus
-
checkAllSignaturesAreYetValid
public boolean checkAllSignaturesAreYetValid()Description copied from interface:ValidationContext
This method returns whether all signatures added to the ValidationContext have been produced with yet valid certificates at the time of signing- Specified by:
checkAllSignaturesAreYetValid
in interfaceValidationContext
- Returns:
- true if the signing certificate or its POE(s) is yet valid, false otherwise
-
allSignaturesAreYetValid
Returns the status of the all signatures are yet valid check- Returns:
SignatureStatus
-
checkCertificateIsYetValid
Description copied from interface:ValidationContext
This method returns whether the certificate token is yet valid- Specified by:
checkCertificateIsYetValid
in interfaceValidationContext
- Parameters:
certificateToken
-CertificateToken
to be validated- Returns:
- true if the certificate is yet valid, false otherwise
-
certificateIsYetValid
Returns the status of the certificate yet valid check- Parameters:
certificateToken
-CertificateToken
to be verified- Returns:
SignatureStatus
-
getProcessedSignatures
Description copied from interface:ValidationContext
Returns signatures added to the validation context- Specified by:
getProcessedSignatures
in interfaceValidationContext
- Returns:
- a set of
AdvancedSignature
s
-
getProcessedCertificates
Description copied from interface:ValidationContext
Returns a read only list of all certificates used in the process of the validation of all signatures from the given document. This list includes the certificate to check, certification chain certificates, OCSP response certificate...- Specified by:
getProcessedCertificates
in interfaceValidationContext
- Returns:
- a set of
CertificateToken
s
-
getProcessedRevocations
Description copied from interface:ValidationContext
Returns a read only list of all revocations used in the process of the validation of all signatures from the given document.- Specified by:
getProcessedRevocations
in interfaceValidationContext
- Returns:
- a set of
RevocationToken
s
-
getProcessedTimestamps
Description copied from interface:ValidationContext
Returns a read only list of all timestamps processed during the validation of all signatures from the given document.- Specified by:
getProcessedTimestamps
in interfaceValidationContext
- Returns:
- a set of
TimestampToken
s
-
getProcessedEvidenceRecords
Description copied from interface:ValidationContext
Returns evidence records added to the validation context- Specified by:
getProcessedEvidenceRecords
in interfaceValidationContext
- Returns:
- a set of
EvidenceRecord
s
-
getValidationData
Description copied from interface:ValidationContext
Returns a validation data for the given signature's certificate chain- Specified by:
getValidationData
in interfaceValidationContext
- Parameters:
signature
-AdvancedSignature
to extract validation data for- Returns:
ValidationData
-
getValidationData
Description copied from interface:ValidationContext
Returns a validation data for the given timestampToken's certificate chain- Specified by:
getValidationData
in interfaceValidationContext
- Parameters:
timestampToken
-TimestampToken
to extract validation data for- Returns:
ValidationData
-