Skip to content

Commit 3629924

Browse files
authored
Merge pull request #84 from grant100/reinit
pkcs11/_pkcs11.pyx: Add reinitalize func to lib class
2 parents 62ecdfa + 8f69f83 commit 3629924

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

docs/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ Classes
5959

6060
:rtype: Token
6161

62+
.. method:: reinitialize()
63+
64+
Reinitializes the loaded PKCS#11 library.
65+
66+
:rtype: None
67+
6268
.. attribute:: cryptoki_version
6369

6470
PKCS#11 Cryptoki standard version (:class:`tuple`).

pkcs11/_pkcs11.pyx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,11 @@ cdef class lib:
13551355
except StopIteration:
13561356
return token
13571357

1358+
def reinitialize(self):
1359+
if _funclist != NULL:
1360+
assertRV(_funclist.C_Finalize(NULL))
1361+
assertRV(_funclist.C_Initialize(NULL))
1362+
13581363
def __dealloc__(self):
13591364
if _funclist != NULL:
13601365
assertRV(_funclist.C_Finalize(NULL))

0 commit comments

Comments
 (0)