python-pkcs11 0.10.1__cp315-cp315-macosx_10_15_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pkcs11/__init__.py +50 -0
- pkcs11/_pkcs11.cpython-315-darwin.so +0 -0
- pkcs11/_pkcs11.pxd +964 -0
- pkcs11/_pkcs11.pyi +35 -0
- pkcs11/_pkcs11.pyx +2327 -0
- pkcs11/attributes.py +272 -0
- pkcs11/constants.py +559 -0
- pkcs11/defaults.py +121 -0
- pkcs11/exceptions.py +410 -0
- pkcs11/mechanisms.py +862 -0
- pkcs11/py.typed +0 -0
- pkcs11/types.py +1457 -0
- pkcs11/util/__init__.py +17 -0
- pkcs11/util/dh.py +79 -0
- pkcs11/util/dsa.py +108 -0
- pkcs11/util/ec.py +143 -0
- pkcs11/util/rsa.py +95 -0
- pkcs11/util/x509.py +136 -0
- python_pkcs11-0.10.1.dist-info/METADATA +399 -0
- python_pkcs11-0.10.1.dist-info/RECORD +23 -0
- python_pkcs11-0.10.1.dist-info/WHEEL +6 -0
- python_pkcs11-0.10.1.dist-info/licenses/LICENSE +21 -0
- python_pkcs11-0.10.1.dist-info/top_level.txt +1 -0
pkcs11/__init__.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`pkcs11` defines a high-level, "Pythonic" interface to PKCS#11.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import TYPE_CHECKING, Any
|
|
8
|
+
|
|
9
|
+
from pkcs11.constants import * # noqa: F403
|
|
10
|
+
from pkcs11.exceptions import * # noqa: F403
|
|
11
|
+
from pkcs11.mechanisms import * # noqa: F403
|
|
12
|
+
from pkcs11.types import * # noqa: F403
|
|
13
|
+
from pkcs11.util import dh, dsa, ec, rsa, x509 # noqa: F401
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from pkcs11._pkcs11 import lib as _lib_type
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
_loaded: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def lib(so: str) -> _lib_type:
|
|
23
|
+
"""
|
|
24
|
+
Wrap the main library call coming from Cython with a preemptive
|
|
25
|
+
dynamic loading.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
try:
|
|
29
|
+
_lib = _loaded[so]
|
|
30
|
+
if not _lib.initialized:
|
|
31
|
+
_lib.initialize()
|
|
32
|
+
return _lib
|
|
33
|
+
except KeyError:
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
from . import _pkcs11
|
|
37
|
+
|
|
38
|
+
_lib = _pkcs11.lib(so)
|
|
39
|
+
_loaded[so] = _lib
|
|
40
|
+
|
|
41
|
+
return _lib
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def unload(so: str) -> None:
|
|
45
|
+
try:
|
|
46
|
+
loaded_lib = _loaded[so]
|
|
47
|
+
except KeyError:
|
|
48
|
+
return
|
|
49
|
+
del _loaded[so]
|
|
50
|
+
loaded_lib.unload()
|
|
Binary file
|