Expand description
C2PA manifest embedding, hard binding, and verification for OpenType/TrueType (SFNT) fonts.
Implements the C2PA font embedding method — storing a C2PA Manifest Store
and/or a remote manifest URI in a C2PA SFNT table — together with its
c2pa.hash.data hard binding. Embedding re-serializes the font so the table
directory, offsets, and checksums (including head.checkSumAdjustment) stay
valid.
This crate owns the two format-specific validation steps: locating and
extracting the manifest (step 1) and the hard binding (step 5). COSE
signature verification, X.509 trust evaluation, and assertion/ingredient
validation are delegated to the official
c2pa SDK via the optional validation
feature. Manifest construction and signing remain the SDK’s job.
The C2PA font table format is preliminary in the C2PA specification and
is not yet defined in the OpenType/OFF specifications.
Structs§
- C2pa
Table - A decoded C2PA font table.
- Compliance
- The result of checking a font’s C2PA embedding for spec compliance.
- Exclusion
- A byte range excluded from the
c2pa.hash.datahard binding. - Manifest
Source - What to write into a font’s
C2PAtable: an embedded Manifest Store, a remote manifest URI, or both. - Reserved
Font - A font with a reserved (placeholder) Manifest Store, ready for the hash-then-sign step of the hard-binding flow.
- Validation
- The outcome of validating a font’s C2PA manifest end to end.
Enums§
Constants§
- C2PA_
TAG - SFNT table tag identifying the C2PA table.
- MAJOR_
VERSION - Major version written into new C2PA tables. The format is preliminary in the C2PA specification, so this crate emits version 0.1.
- MINOR_
VERSION
Functions§
- compute_
data_ hash - Compute the
c2pa.hash.datavalue over the font using the font’s own exclusion ranges, via the same hasher c2pa-rs uses at validation time. - data_
hash_ exclusions - Byte ranges excluded from the font’s
c2pa.hash.datahard binding. - data_
hash_ ranges - The font’s exclusion ranges as c2pa-rs
HashRanges, ready to attach to ac2pa.hash.dataassertion. - embed_
manifest - Embed a C2PA manifest into a font by inserting (or replacing) its
C2PAtable. - fill_
manifest - Fill a reserved font’s Manifest Store with signed manifest bytes.
- read_
c2pa_ table - Read and decode the
C2PAtable from a font. - read_
manifest - Read the embedded C2PA Manifest Store from a font.
- read_
manifest_ uri - Read the active manifest URI from a font’s
C2PAtable, if present. - remove_
manifest - Remove the
C2PAtable from a font, if present, returning the re-serialized font. - reserve_
manifest - Reserve space for a manifest of
reserve_sizebytes in a font’sC2PAtable, returning the font-with-placeholder and its hard-binding exclusions. - validate
- Validate a font’s C2PA manifest end to end.
- verify
- Verify a font’s C2PA embedding against the specification.
- verify_
data_ hash - Verify that the font’s bytes hash to
expectedunder its exclusion ranges.