Skip to content

C2paSigningAlg cannot be passed to C2paSignerInfo #135

@djfletcher

Description

@djfletcher

The library provides a C2paSigningAlg enum which presumably should be passed as the alg parameter to the C2paSignerInfo object. However, it raises an exception when I do that:

Traceback (most recent call last):
  File "/Users/daniel/dev/c2pa-python/examples/sign.py", line 47, in <module>
    signer = c2pa.Signer.from_info(signer_info)
  File "/Users/daniel/dev/c2pa-python/venv/lib/python3.13/site-packages/c2pa/c2pa.py", line 1332, in from_info
    raise C2paError(error)
c2pa.c2pa.C2paError: NullParameter: signer_info.alg

This is the minimum diff to reproduce the error in examples/sign.py:

diff --git a/examples/sign.py b/examples/sign.py
index 82070b4..7d365e3 100644
--- a/examples/sign.py
+++ b/examples/sign.py
@@ -38,7 +38,7 @@ certs = open(fixtures_dir + "es256_certs.pem", "rb").read()
 key = open(fixtures_dir + "es256_private.key", "rb").read()
 
 signer_info = c2pa.C2paSignerInfo(
-    alg=b"es256",  # Use bytes instead of encoded string
+    alg=c2pa.C2paSigningAlg.ES256,
     sign_cert=certs,
     private_key=key,
     ta_url=b"http://timestamp.digicert.com"  # Use bytes and add timestamp URL

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions