Class EvidenceRecordTimeStampSequenceVerifier
java.lang.Object
eu.europa.esig.dss.evidencerecord.common.validation.EvidenceRecordTimeStampSequenceVerifier
- Direct Known Subclasses:
ASN1EvidenceRecordTimeStampSequenceVerifier
,XmlEvidenceRecordTimeStampSequenceVerifier
This class performs a verification of complete Evidence Record Archive Time-Stamp Sequence
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DefaultEvidenceRecord
Evidence record to be validated -
Constructor Summary
ModifierConstructorDescriptionprotected
EvidenceRecordTimeStampSequenceVerifier
(DefaultEvidenceRecord evidenceRecord) Evidence record to be validated -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkHashTreeValidity
(ArchiveTimeStampObject archiveTimeStamp, ArchiveTimeStampChainObject archiveTimeStampChain) This method verifies whether theArchiveTimeStampObject
and its hash-tree is valid relatively the parentArchiveTimeStampChainObject
protected DSSMessageDigest
computeDigestValueGroupHash
(DigestAlgorithm digestAlgorithm, DigestValueGroup digestValueGroup, DSSMessageDigest... otherObjectDigests) Computes a hash value for a group of hashesprotected abstract DSSMessageDigest
computeTimeStampHash
(ArchiveTimeStampObject archiveTimeStamp) Computes hash onarchiveTimeStamp
element provided thearchiveTimeStampChain
's attributesprotected abstract DSSMessageDigest
computeTimeStampSequenceHash
(ArchiveTimeStampChainObject archiveTimeStampChain) Computes hash of currentArchiveTimeStampSequenceElement
protected abstract DataObjectDigestBuilder
getDataObjectDigestBuilder
(DSSDocument document, ArchiveTimeStampChainObject archiveTimeStampChain) ReturnsDataObjectDigestBuilder
corresponding to the current implementationprotected byte[]
getDocumentDigest
(DSSDocument document, ArchiveTimeStampChainObject archiveTimeStampChain) Returns digest value for the documentprotected List
<? extends DigestValueGroup> getHashTree
(List<? extends DigestValueGroup> originalHashTree, List<DSSDocument> detachedContents, ManifestFile manifestFile, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampHash, DSSMessageDigest lastTimeStampSequenceHash) This method returns a relevant HashTree, and created a "virtual" HashTree when a HashTree is omitted in the TimeStampprotected List
<byte[]> getLastTimeStampSequenceHashList
(DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedDocuments) Returns a list of hashes computed on a given previous time-stamp sequence hashprotected DSSDocument
getMatchingDocument
(Digest digest, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedContents) This method returns a document with matchingDigest
from a provided list ofdetachedContents
protected DSSDocument
getMatchingDocument
(ManifestEntry manifestEntry, List<DSSDocument> detachedContents) This method returns a matching document for the givenmanifestEntry
protected ManifestEntry
getMatchingManifestEntry
(ManifestFile manifestFile, Digest digest, DSSDocument document) Returns a validated manifest entry matching the givendigest
ordocument
Gets a list of reference validationsprotected List
<ReferenceValidation> validateArchiveDataObjects
(DigestValueGroup digestValueGroup, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedContents, ManifestFile manifestFile) This method is used to verify archive data objects for presence document digests withindigestValueGroup
.protected List
<ReferenceValidation> validateArchiveTimeStampDigest
(List<ReferenceValidation> referenceValidations, DSSMessageDigest lastTimeStampHash) This method is used to verify presence of ArchiveTimeStamp digests within the reference validation list.protected List
<ReferenceValidation> validateArchiveTimeStampSequenceDigest
(List<ReferenceValidation> referenceValidations, DSSMessageDigest lastTimeStampSequenceHashes) This method is used to verify presence of ArchiveTimeStampSequence digests within the reference validation list.protected void
verify()
Performs verification of the Evidence Record.
-
Field Details
-
evidenceRecord
Evidence record to be validated
-
-
Constructor Details
-
EvidenceRecordTimeStampSequenceVerifier
Evidence record to be validated- Parameters:
evidenceRecord
-EvidenceRecord
-
-
Method Details
-
getReferenceValidations
Gets a list of reference validations- Returns:
- a list of
ReferenceValidation
s
-
verify
protected void verify()Performs verification of the Evidence Record. Generated reference validations and time-stamp tokens -
getHashTree
protected List<? extends DigestValueGroup> getHashTree(List<? extends DigestValueGroup> originalHashTree, List<DSSDocument> detachedContents, ManifestFile manifestFile, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampHash, DSSMessageDigest lastTimeStampSequenceHash) This method returns a relevant HashTree, and created a "virtual" HashTree when a HashTree is omitted in the TimeStamp- Parameters:
originalHashTree
- a list ofDigestValueGroup
, representing an original HashTree extracted from a time-stamp tokendetachedContents
- a list ofDSSDocument
s, provided to the validation as a detached contentmanifestFile
-ManifestFile
when presentarchiveTimeStampChain
-ArchiveTimeStampChainObject
archive time-stamp chain containing the time-stamplastTimeStampHash
-DSSMessageDigest
digest of the previous archive-time-stamp, when applicablelastTimeStampSequenceHash
-DSSMessageDigest
digest of the previous archive-time-stamp-sequence, when applicable- Returns:
- a list of
DigestValueGroup
, representing a HashTree to be used for an archive-time-stamp validation
-
checkHashTreeValidity
protected boolean checkHashTreeValidity(ArchiveTimeStampObject archiveTimeStamp, ArchiveTimeStampChainObject archiveTimeStampChain) This method verifies whether theArchiveTimeStampObject
and its hash-tree is valid relatively the parentArchiveTimeStampChainObject
- Parameters:
archiveTimeStamp
-ArchiveTimeStampObject
archiveTimeStampChain
-ArchiveTimeStampChainObject
- Returns:
- TRUE if the validation succeeds, FALSE otherwise
-
getLastTimeStampSequenceHashList
protected List<byte[]> getLastTimeStampSequenceHashList(DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedDocuments) Returns a list of hashes computed on a given previous time-stamp sequence hash- Parameters:
lastTimeStampSequenceHash
-DSSMessageDigest
of the previous ArchiveTimeStampSequencedetachedDocuments
- a list of detachedDSSDocument
s- Returns:
- a list of byte arrays
-
getDocumentDigest
protected byte[] getDocumentDigest(DSSDocument document, ArchiveTimeStampChainObject archiveTimeStampChain) Returns digest value for the document- Parameters:
document
-DSSDocument
to get digest value forarchiveTimeStampChain
-ArchiveTimeStampChainObject
of the current hashtree- Returns:
- byte array representing document digest
-
getDataObjectDigestBuilder
protected abstract DataObjectDigestBuilder getDataObjectDigestBuilder(DSSDocument document, ArchiveTimeStampChainObject archiveTimeStampChain) ReturnsDataObjectDigestBuilder
corresponding to the current implementation- Parameters:
document
-DSSDocument
document to build digest forarchiveTimeStampChain
-ArchiveTimeStampChainObject
of the current hashtree- Returns:
DataObjectDigestBuilder
-
validateArchiveTimeStampDigest
protected List<ReferenceValidation> validateArchiveTimeStampDigest(List<ReferenceValidation> referenceValidations, DSSMessageDigest lastTimeStampHash) This method is used to verify presence of ArchiveTimeStamp digests within the reference validation list. If entry is not present, created one, when applicable- Parameters:
referenceValidations
- a list ofReferenceValidation
slastTimeStampHash
-DSSMessageDigest
- Returns:
- an updated list of
ReferenceValidation
s
-
validateArchiveTimeStampSequenceDigest
protected List<ReferenceValidation> validateArchiveTimeStampSequenceDigest(List<ReferenceValidation> referenceValidations, DSSMessageDigest lastTimeStampSequenceHashes) This method is used to verify presence of ArchiveTimeStampSequence digests within the reference validation list. If entry is not present, created one, when applicable- Parameters:
referenceValidations
- a list ofReferenceValidation
slastTimeStampSequenceHashes
-DSSMessageDigest
- Returns:
- an updated list of
ReferenceValidation
s
-
validateArchiveDataObjects
protected List<ReferenceValidation> validateArchiveDataObjects(DigestValueGroup digestValueGroup, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedContents, ManifestFile manifestFile) This method is used to verify archive data objects for presence document digests withindigestValueGroup
.- Parameters:
digestValueGroup
-DigestValueGroup
to find document corresponding digest inarchiveTimeStampChain
-ArchiveTimeStampChainObject
defines configuration for validationlastTimeStampSequenceHash
-DSSMessageDigest
hash of the last archive time-stamp sequencedetachedContents
- a list of detachedDSSDocument
smanifestFile
-ManifestFile
, when present- Returns:
- a list of
ReferenceValidation
s
-
getMatchingManifestEntry
protected ManifestEntry getMatchingManifestEntry(ManifestFile manifestFile, Digest digest, DSSDocument document) Returns a validated manifest entry matching the givendigest
ordocument
- Parameters:
manifestFile
-ManifestFile
digest
-Digest
document
-DSSDocument
- Returns:
ManifestEntry
, if found
-
getMatchingDocument
protected DSSDocument getMatchingDocument(Digest digest, ArchiveTimeStampChainObject archiveTimeStampChain, DSSMessageDigest lastTimeStampSequenceHash, List<DSSDocument> detachedContents) This method returns a document with matchingDigest
from a provided list ofdetachedContents
- Parameters:
digest
-Digest
to checkarchiveTimeStampChain
-ArchiveTimeStampChainObject
defines configuration for validationlastTimeStampSequenceHash
-DSSMessageDigest
hash of the last archive time-stamp sequencedetachedContents
- a list ofDSSDocument
s- Returns:
DSSDocument
if matching document found, NULL otherwise
-
getMatchingDocument
protected DSSDocument getMatchingDocument(ManifestEntry manifestEntry, List<DSSDocument> detachedContents) This method returns a matching document for the givenmanifestEntry
- Parameters:
manifestEntry
-ManifestEntry
to get matching document fordetachedContents
- a list ofDSSDocument
s provided within a container- Returns:
DSSDocument
matching document when found, NULL otherwise
-
computeTimeStampHash
Computes hash onarchiveTimeStamp
element provided thearchiveTimeStampChain
's attributes- Parameters:
archiveTimeStamp
-ArchiveTimeStampObject
to compute hash on- Returns:
DSSMessageDigest
-
computeTimeStampSequenceHash
protected abstract DSSMessageDigest computeTimeStampSequenceHash(ArchiveTimeStampChainObject archiveTimeStampChain) Computes hash of currentArchiveTimeStampSequenceElement
- Parameters:
archiveTimeStampChain
-ArchiveTimeStampChainObject
to compute hash for- Returns:
DSSMessageDigest
-
computeDigestValueGroupHash
protected DSSMessageDigest computeDigestValueGroupHash(DigestAlgorithm digestAlgorithm, DigestValueGroup digestValueGroup, DSSMessageDigest... otherObjectDigests) Computes a hash value for a group of hashes- Parameters:
digestAlgorithm
-DigestAlgorithm
to be used for a hash computationdigestValueGroup
-DigestValueGroup
containing grouped elements from a hash treeotherObjectDigests
- additional hash values obtained from other computations- Returns:
DSSMessageDigest
-