Unpacking search (SearchIter) fails with PK data from Nexus Personal
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the failure with the shown SearchIter usage and inspect pkcs11/_utils.pyx:_unpack_attributes, pkcs11/_pkcs11.pyx:Object.getitem, and SearchIter.next. Determine how the Nexus Personal PKCS11 data reaches the boolean unpacking path, then verify that list(q) completes without the reported struct.error or cleanup exception.
Written by the indexing model from the issue text.
Description
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:
- Dominant language
- Python
- Stars
- 170
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyauth/python-pkcs11
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
pyauth/python-pkcs11#225 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pyauth/python-pkcs11#233 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
pyauth/python-pkcs11#228 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pyauth/python-pkcs11#220 · 1 comment ·
-
readthedocs.io setup Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pyauth/python-pkcs11#211 · 1 comment ·
All issues in pyauth/python-pkcs11
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100