Skip to content

fix: Support using Alg enum in SignerInfo - #136

Merged
tmathern merged 9 commits into
mainfrom
mathern/issue-135-alg-issue
Aug 21, 2025
Merged

fix: Support using Alg enum in SignerInfo#136
tmathern merged 9 commits into
mainfrom
mathern/issue-135-alg-issue

Conversation

@tmathern

@tmathern tmathern commented Aug 4, 2025

Copy link
Copy Markdown
Collaborator

Currently, in the C2paSignerInfo class, we expected the algorithm string as bytes.

As reported in #135, I believe it makes sense to allow to use the enum and that we parse it accordingly into the value needed by the native call (@gpeacock At some point we should harmonize that API - so that we take the same types everywhere, wdyt?).

This PR adds support for that, and also makes sure the timestamp URL gets properly converted into bytes since natively we expect bytes too (and not just a string).

@tmathern
tmathern requested review from dyro and gpeacock August 4, 2025 17:48
@tmathern tmathern self-assigned this Aug 4, 2025
Comment thread src/c2pa/c2pa.py Outdated
Comment thread src/c2pa/c2pa.py Outdated
("ta_url", ctypes.c_char_p),
]

def __init__(self, alg=None, sign_cert=None, private_key=None, ta_url=None):

@tmathern tmathern Aug 8, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of syntactic sugar to make enums reusable and less dependent on underlying (native) types. Also lots of type checkings checks when converting.

@tmathern

tmathern commented Aug 13, 2025

Copy link
Copy Markdown
Collaborator Author

Failing tests will be fixed once fix from contentauth/c2pa-rs#1273 comes in (done).

@tmathern
tmathern merged commit fa5aa60 into main Aug 21, 2025
19 checks passed
@tmathern
tmathern deleted the mathern/issue-135-alg-issue branch August 21, 2025 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants