aboutsummaryrefslogtreecommitdiff
path: root/py11
diff options
context:
space:
mode:
Diffstat (limited to 'py11')
-rw-r--r--py11/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/py11/__init__.py b/py11/__init__.py
index 80495d9..da79e34 100644
--- a/py11/__init__.py
+++ b/py11/__init__.py
@@ -95,10 +95,11 @@ class PKCS11 (object):
self._C_Initialize_args = None
def C_GetSlotList(self):
- slots = (CK_SLOT_ID * 10)()
- count = CK_ULONG(len(slots))
+ count = CK_ULONG()
+ self.so.C_GetSlotList(CK_TRUE, None, byref(count))
+ slots = (CK_SLOT_ID * count.value)()
self.so.C_GetSlotList(CK_TRUE, slots, byref(count))
- return [slots[i] for i in xrange(count.value)]
+ return tuple(slots[i] for i in xrange(count.value))
def C_GetTokenInfo(self, slot_id):
token_info = CK_TOKEN_INFO()
@@ -145,11 +146,11 @@ class PKCS11 (object):
for i in xrange(count.value):
yield objects[i]
- def Find(self, session, template = None, **kwargs):
+ def FindObjects(self, session, template = None, **kwargs):
self.C_FindObjectsInit(session, template, **kwargs)
- for obj in self.C_FindObjects(session):
- yield obj
+ result = tuple(self.C_FindObjects(session))
self.C_FindObjectsFinal(session)
+ return result
def _parse_GenerateKeyPair_template(self,
# Attributes common to public and private templates