Unique content determination of structured format documents
A computer-implemented method of generating a digest for a structured document is provided including selecting a subset of a plurality of component parts of a OOXML document wherein at least one of the selected subset of component parts is an XML file and wherein selecting the subset excludes files named “docProps\app.xml”, “docProps\core.xml”, and “docProps\custom.xml”, ordering the selected subset of component parts, processing a relationships file by removing at least one relationship entry that references a component part not included in the selected subset and sorting the relationships by identifier value, generating a component hash value for each of the selected subset of component parts; and converting each component hash value into a byte array and appending the byte array to a canonical byte stream.
1 . A computer-implemented method of generating a digest for a structured document comprising:
selecting a subset of a plurality of component parts of an OOXML document to prepare the OOXML document for hashing and/or digital sealing, wherein at least one of the selected subset of component parts is an XML file and wherein selecting the subset excludes files named “docProps\app.xml”, “docProps\core.xml”, and “docProps\custom.xml”;
ordering the selected subset of component parts;
processing a relationships file from the selected subset of component parts as follows:
remove at least one relationship entry that references a component part not included in the selected subset, and sort the relationships by identifier value;
generating a component hash value for each of the selected subset of component parts; and
converting each component hash value into a byte array and appending the byte array to a canonical byte stream; and
storing a hash and/or digital seal associated with the OOXML document based on the canonical byte stream for determining a future modification of the OOXML document.
2 . The computer-implemented method of claim 1 , wherein the structured document is an OOXML file, which is a ZIP archive and each of the plurality of component parts is a file.
3 . The computer-implemented method of claim 1 , further comprising calculating an overall hash value for the canonical byte stream.
4 . The computer-implemented method of claim 1 , wherein the selected subset of component parts does not include any of the following dates: a date on which the structured document was created; a date on which the structured document was last printed; a date on which the structured document was last edited; and a date on which the structured document was last opened.
5 . The computer-implemented method of claim 1 , wherein the selected subset of component parts includes a relationships file named “_rels\rels” wherein the relationships file contains a relationship of type “officeDocument”.
6 . The computer-implemented method of claim 1 , wherein the selected subset of component parts does not include a document named “custom.xml”.
7 . The computer-implemented method of claim 1 , further comprising storing the overall hash value for the canonical byte stream in a record; selecting a second subset of the second plurality component parts; ordering a second plurality of component parts of a second structured document; generating a second component hash value for each of the second subset of component parts; converting each second hash value into a second byte array and appending the second byte array to a second canonical byte stream; calculating a second overall hash value for the second canonical byte stream; and determining the structured document is identical to the second structured document in case the second hash value for the second canonical byte stream matches the overall hash value in the record.
8 . A non-transitory computer readable medium comprising executable software instructions that when executed:
select a subset of a plurality of component parts of a OOXML document to prepare the OOXML document for hashing and/or digital sealing, wherein at least one of the selected subset of component parts is an XML file and wherein selecting the subset excludes files named “docProps\app.xml”, “docProps\core.xml” and “docProps\custom.xml”;
order the selected subset of component parts, processing, a relationships file from the selected subset of component parts as follows: remove at least one relationship entry that references a component part not included in the selected subset, and sort the relationships by identifier value;
generate a component hash value for each of the selected subset of component parts;
convert each component hash value into a byte array and appending the byte array to a canonical byte stream; and
store a hash and/or digital seal associated with the OOXML document based on the canonical byte stream for determining a modification of the OOXML document.
9 . The non-transitory computer readable medium of claim 8 , wherein the structured document is an OOXML file, which is a ZIP archive and each of the plurality of component parts is a file.
10 . The non-transitory computer readable medium of claim 8 , further comprising instructions that when executed calculate an overall hash value for the canonical byte stream.
11 . The non-transitory computer readable medium of claim 9 , wherein the selected subset of component parts includes a relationships file named “_rels\rels” wherein the relationships file contains a relationship of type “officeDocument”.
12 . The non-transitory computer readable medium of claim 8 , wherein the selected subset of component parts does not include a document named “custom.xml”.
13 . The non-transitory computer readable medium of claim 8 , further comprising instructions that when executed: store the overall hash value for the canonical byte stream in a record; select a second subset of the second plurality component parts; order a second plurality of component parts of a second structured document; generate a second component hash value for each of the second subset of component parts; convert each second hash value into a second byte array and append the second byte array to a second canonical byte stream; calculate a second overall hash value for the second canonical byte stream; and determine the structured document is identical to the second structured document in case the second hash value for the second canonical byte stream matches the overall hash value in the record.
14 . The non-transitory computer readable medium of claim 8 , wherein the selected subset of component parts
does not include any of the following dates:
a date on which the structured document was created;
a date on which the structured document was last printed;
a date on which the structured document was last edited; and
a date on which the structured document was last opened.