Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing or empty ID in the document trailer #269

Open
kzolti opened this issue Sep 8, 2024 · 1 comment
Open

Missing or empty ID in the document trailer #269

kzolti opened this issue Sep 8, 2024 · 1 comment

Comments

@kzolti
Copy link

kzolti commented Sep 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@kzolti and others