Skip to content

Missing or empty ID in the document trailer #269

@kzolti

Description

@kzolti

After signing, the new trailer does not contain the ID fields.
verapdf output:

<details passedRules="144" failedRules="1" passedChecks="6295" failedChecks="1">
  <rule specification="ISO 19005-3:2012" clause="6.1.3" testNumber="1" status="failed" failedChecks="1">
    <description>The file trailer dictionary shall contain the ID keyword whose value shall be File Identifiers as defined in ISO 32000-1:2008, 14.4</description>
    <object>CosDocument</object>
    <test>lastID != null &amp;&amp; lastID.length() &gt; 0</test>
    <check status="failed">
      <context>root</context>
      <errorMessage>Missing or empty ID in the document trailer</errorMessage>
    </check>
  </rule>
</details>

I can eliminate the error if here:
https://github.com/vbuch/node-signpdf/blob/develop/packages/placeholder-plain/src/createBufferTrailer.js
I add static two ids;

return Buffer.concat([
    Buffer.from('xref\n'),
    Buffer.from(`${info.xref.startingIndex} 1\n`),
    Buffer.from(rows.join('\n')),
    Buffer.from('\ntrailer\n'),
    Buffer.from('<<\n'),
    Buffer.from(`/Size ${info.xref.maxIndex + 1}\n`),
    Buffer.from(`/Root ${info.rootRef}\n`),
    Buffer.from(info.infoRef ? `/Info ${info.infoRef}\n` : ''),
    Buffer.from(`/Prev ${info.xRefPosition}\n`),
    Buffer.from('/ID [<2A75465A48C679B420E97AFCA186B72A> <65DAA54B261896AB2FAC8B53976D9DFD>]\n>>\n'),
    Buffer.from('startxref\n'),
    Buffer.from(`${pdf.length}\n`),
    Buffer.from('%%EOF'),
]);

I already realized that the first ID should be the second ID from the previous trailer, but I didn't get any further.

The pdf signed in this way will already be valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions