Skip to content

Unpacking search (SearchIter) fails with PK data from Nexus Personal #192

@msetina

Description

@msetina

Using this code on version 0.7.0:

pk_query_params = {
            pkcs11.Attribute.CLASS: pkcs11.ObjectClass.PRIVATE_KEY
        }
        q = session.get_objects(pk_query_params)        
        results = list(q)
on Nexus Personal PKCS11 driver fails with:
    results = list(q)
  File "pkcs11/_pkcs11.pyx", line 322, in pkcs11._pkcs11.SearchIter.__next__
  File "pkcs11/_pkcs11.pyx", line 692, in pkcs11._pkcs11.Object._make
  File "pkcs11/_pkcs11.pyx", line 723, in pkcs11._pkcs11.Object.__getitem__
  File "pkcs11/_utils.pyx", line 35, in pkcs11._pkcs11._unpack_attributes
  File "/home/miha/.local/lib/python3.10/site-packages/pkcs11/defaults.py", line 116, in <lambda>
    _bool = (Struct('?').pack, lambda v: Struct('?').unpack(v)[0])
struct.error: unpack requires a buffer of 1 bytes
Exception ignored in: <cyfunction SearchIter.__del__ at 0x7f58cf9cea80>
Traceback (most recent call last):
  File "pkcs11/_pkcs11.pyx", line 326, in pkcs11._pkcs11.SearchIter.__del__
  File "pkcs11/_pkcs11.pyx", line 336, in pkcs11._pkcs11.SearchIter._finalize
  File "pkcs11/_errors.pyx", line 88, in pkcs11._pkcs11.assertRV
pkcs11.exceptions.SessionHandleInvalid: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions