Skip to content

Return value in bytes if the attribute is not currently handled + add object dictionary for printing #148

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

Closed
wants to merge 4 commits into from

Conversation

Muzosh
Copy link

@Muzosh Muzosh commented Nov 14, 2022

Hey, I would like to propose a fix to an information loss.

Sometimes, the library does not know, how to "unpack" certain attributes. I think it would be great to at least return the value in byte array. Currently, the code just raises an exception while providing just the key, but some developers might utilize the returned value and translate it themselves.

@Muzosh Muzosh changed the title Return value in bytes if the attribute is not currently handled Return value in bytes if the attribute is not currently handled + add object dictionary for printing Nov 21, 2022
@MatthiasValvekens
Copy link
Collaborator

This was addressed in a somewhat different way in #209. Defaulting unhandled attribute types to bytes would effectively mean that adding support for a new attribute type in a future version of python-pkcs11 would result in an API-breaking change.

Instead, #209 allows the user to supply an alternative attribute mapper when opening a session. This alternative attribute mapper can include handling for attributes that are not supported in python-pkcs11. The only limitation--which it shares with the implementation proposed in this PR--is that the handler doesn't have access to the PKCS#11 internals (i.e. you're fine as long as you can implement it in Python). In practice, that's not much of a restriction AFAICT, other than for CKA_XYZ_TEMPLATE attributes (which take a raw pointer) and perhaps some vendor-specific stuff.

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