C2PA 2.x files lose their credentials with c2patool 0.9

Thanks for C2PA Sign! I ran into this while looking into an issue on Content Credentials (https://www.drupal.org/project/content_credentials/issues/3629737), so maybe it's useful.

c2patool 0.9.12, which is what the README's ^0.9.1 installs, can't read C2PA 2.x. So when C2PA Sign re-signs a 2.x file, the original credentials are lost. Newer c2patool versions (0.27, 0.28) can read 2.x, but with those every upload fails, for example with duplicate field operating_system.

On a local test site I got it working with 0.27.22 and 0.28.1 with three small changes, and 0.9.12 still worked:

  • Keep only one of the two operating system fields in claim_generator_info.
  • For c2patool 0.10 and up, leave out c2pa.opened and c2pa.created. With --parent, c2patool adds c2pa.opened itself and links it to the parent.
  • In jrglasgow/c2patool, write the manifest to its own temp folder and copy the logo next to it. c2patool 0.28 only loads files from the manifest's folder.

Happy to help test.