Skip to content

fix: Support using Alg enum in SignerInfo #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tmathern
Copy link
Collaborator

@tmathern tmathern commented Aug 4, 2025

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.

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

@tmathern tmathern requested review from gpeacock and dyro August 4, 2025 17:48
@tmathern tmathern self-assigned this Aug 4, 2025
@@ -205,6 +218,49 @@ class C2paSignerInfo(ctypes.Structure):
("ta_url", ctypes.c_char_p),
]

def __init__(self, alg=None, sign_cert=None, private_key=None, ta_url=None):
Copy link
Collaborator Author

@tmathern tmathern Aug 8, 2025

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.

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.

2 participants