Registry / serialization / c2pa-python

c2pa-python

JSON →
library0.32.6pypypi✓ verified 34d ago

Python bindings for the C2PA Content Authenticity Initiative (CAI) library (v0.32.6, pre-1.0, monthly releases). Provides signing and verification of C2PA manifests for media provenance.

serializationauth-security
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

core class for reading C2PA manifests

from c2pa import Reader

used to configure signing (keys and certs)

from c2pa import SignerInfo

used to create and sign manifests

from c2pa import Builder

Verify C2PA manifest from file, then create and sign a new manifest using environment variables for credentials.

import os from c2pa import Reader, Builder, SignerInfo # Verify an image's C2PA manifest reader = Reader.from_file('test_image.jpg') print(reader.json()) # Sign an image signer = SignerInfo.from_settings({ 'alg': 'es256', 'private_key': os.environ.get('C2PA_PRIVATE_KEY', ''), 'sign_cert': os.environ.get('C2PA_SIGN_CERT', '') }) builder = Builder(signer) manifest = {'claim_generator': 'my_app/1.0'} output = builder.sign('input.jpg', 'output.jpg', manifest) print(output)
Debug
Known footguns
breakingThe `SignerInfo` API changed in v0.30.0: old `from_certs` removed, use `from_settings` with `private_key` and `sign_cert` keys.
deprecated`Reader.from_buffer` is deprecated in v0.32.0; use `Reader.from_bytes` instead.
gotchaThe `Builder` requires the full chain of intermediate CA certificates in `sign_cert`; missing intermediates causes a validation error on verification.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
18 hits · last 30 days
bytedance
4
gptbot
3
ahrefsbot
3
claudebot
3
bingbot
1
Resources