Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkcs11/_pkcs11.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1366,8 +1366,15 @@ cdef object make_object(Session session, CK_OBJECT_HANDLE handle) with gil:
# Determine a list of base classes to manufacture our class with
try:
attributes = wrapper.get_attribute_list(&attr_keys[0], 8)
except (AttributeTypeInvalid, FunctionFailed) as e:
except PKCS11Error:
# retry fetching the flags one by one, some tokens do not implement error handling
# on bulk fetches correctly.
attributes = {}
for key in attr_keys:
try:
attributes[key] = wrapper[key]
except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
continue

object_class = attributes.get(Attribute.CLASS, session.attribute_mapper)
bases = (_CLASS_MAP[object_class],)
Expand Down
Loading