Skip to main content

Implementation of C2PA: Coalition for Content Provenance and Authenticity.

Project description

PyC2PA

c2pa-concept-full (photo source: C2PA)

PyC2PA is Python implementation of C2PA (Coalition for Content Provenance and Authenticity) addressing the prevalence of misleading information online through the development of technical standards for certifying the source and history (or provenance) of media content.

Quick Trial

  1. Download the testing photo: meimei-fried-chicken-cai-cai-cai.jpg

  2. Go to the CAI verification website and upload the photo.

  3. You should see the C2PA information (3 injections) like this:

    cai-verify-example

Installation

$ python3 -m pip install pyc2pa

C2PA CLI

In command line run:

$ c2pa [-a ASSERTION] [--store-label STORE_LABEL] [--recorder RECORDER] [-k KEY] [-s SIG] [-o OUTPUT] [-i INJECT]

Example: generate meimei-fried-chicken-cai.jpg containing single C2PA injection.

$ c2pa \
    -a cai.location.broad.json \
    -a cai.rights.json \
    -a cai.claim.thumbnail.jpg.jpg \
    -a cai.acquisition.thumbnail.jpg.jpg \
    -a adobe.asset.info.json \
    -a starling.integrity.json \
    --recorder "Starling Capture using Numbers Protocol" \
    --store-label "cb.starling_1" \
    -k certificate.p12 \
    -s endesive \
    -i meimei-fried-chicken.jpg

Quick Start

In pyc2pa/utils/, there are two examples showing how to do single injection and multiple injection programmatically.

# Prepare testing input JPEG photo and its thumbnail.
# Assuming that testing input JPEG is ~/meimei-fried-chicken.jpg
$ cd pyc2pa/utils/
$ cp ~/meimei-fried-chicken.jpg .
$ convert -resize 50% meimei-fried-chicken.jpg meimei-fried-chicken-thumbnail.jpg

# Run single injection example
# (download meimei-fried-chicken-cai.jpg from IPFS)
# output: meimei-fried-chicken-cai.jpg
$ python3 c2pa_hello_world.py

# Run multiple injection example
# output: meimei-fried-chicken-cai-cai-cai.jpg
$ python3 c2pa_multiple_injection.py meimei-fried-chicken.jpg

Development Tips

  1. Currently, the main branch is based on C2PA spec draft v0.5 (compatible with the latest C2PA spec draft).
  2. The feature-support-c2pa-photo branch follows the latest C2PA spec implementation.
  3. pyc2pa/utils/ contains examples of single injection and multiple injection.
  4. pyc2pa/utils/digital-signature/ contains detailed documents and example codes how to create and verify a C2PA signature.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

c2pa-1.4.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file c2pa-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: c2pa-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2

File hashes

Hashes for c2pa-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bce25ffe7b200f59f0f2a351667aa012fa042bf643f2ea5a6df00cb15c76fde
MD5 3d72e113210015284101e5bb2cad5665
BLAKE2b-256 33545c94afc7ca0dc1381e9ee3f7c2d65dbb547fb7b100506a14f07e06ac950e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page