1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
"""
:mod:`pkcs11` defines a high-level, "Pythonic" interface to PKCS#11.
"""
from .constants import * # noqa: F403
from .exceptions import * # noqa: F403
from .mechanisms import * # noqa: F403
from .types import * # noqa: F403
_so = None
_lib = None
def lib(so):
"""
Wrap the main library call coming from Cython with a preemptive
dynamic loading.
"""
global _lib
global _so
if _lib:
if _so != so:
raise AlreadyInitialized( # noqa: F405
"Already initialized with %s" % so)
else:
return _lib
from . import _pkcs11
_lib = _pkcs11.lib(so)
_so = so
return _lib
|