Skip to main content

Module soft_binding

Module soft_binding 

Source
Expand description

The c2pa.soft-binding assertion emitted for each algorithm in this family.

This builds the normative soft-binding-map from the C2PA specification (soft-binding.cddl) as deterministic CBOR. The structure mirrors the c2pa-rs reference reader’s SoftBinding type field-for-field, so the bytes produced here deserialize directly into that reader — see tests/c2pa_roundtrip.rs, which decodes them with the exact CBOR codec (c2pa_cbor) that c2pa-rs uses and reconstructs its SoftBinding.

Per the CDDL, a block’s value is algorithm-specific. The reference reader types it as a text string, so every value here is the algorithm’s hex encoding (the same hex the registry descriptions record). Window scopes for the surface fingerprint are carried as textual character ranges (region-of-interest.cddl Textual); the offsets are into the algorithm’s normalized character stream, which is where the fingerprint is computed.

Emitting an assertion is not signing it: [to_cbor] returns the assertion bytes, which the caller signs with crate::manifest::sign_cose. Presence in the C2PA soft-binding algorithm list is not conformance certification.

Structs§

Block
A single soft-binding-block-map: a scope plus the value over that scope.
Range
A single range. Only the textual variant is produced here.
RegionOfInterest
A minimal region of interest carrying one or more Ranges.
Scope
A soft-binding-scope-map. Only the textual region is used by this family; an empty scope means the whole asset.
SoftBinding
A soft-binding-map: one or more soft bindings over the asset’s content.
Text
A textual range: one or more character-offset selectors.
TextSelector
A character-offset selector. fragment is required by the C2PA type; for plain text there is no sub-resource, so it is empty.
TextSelectorRange
One [start, end) character range over the normalized stream.

Enums§

RangeType
The C2PA RangeType discriminator (camelCase on the wire).

Constants§

ALG_FINGERPRINT
Registered algorithm identifier for text-fingerprint.1 (list id 41).
ALG_MINHASH
Registered algorithm identifier for text-minhash.1 (list id 44).
ALG_STRUCTURE
Registered algorithm identifier for text-structure.1 (list id 43).
ALG_WATERMARK
Registered algorithm identifier for zwc-watermark.2 (list id 42).
SOFT_BINDING_LABEL
The C2PA assertion label a soft-binding payload is stored under.

Functions§

from_fingerprint
Build the text-fingerprint.1 (list id 41) soft binding: the whole-document SimHash plus one scoped block per overlapping window.
from_minhash
Build the text-minhash.1 (list id 44) soft binding. The value is the 128 signature values as big-endian u64 bytes, hex-encoded — a deterministic, verifier-reproducible serialization of the recorded signature.
from_structure
Build the text-structure.1 (list id 43) soft binding: the whole-document structural SimHash.
from_watermark_pointer
Build the zwc-watermark.2 (list id 42) soft binding. The value is the routing pointer embedded in the carrier, hex-encoded — the identifier a manifest repository is keyed by.