aboutsummaryrefslogtreecommitdiff
path: root/cryptech/py11
diff options
context:
space:
mode:
Diffstat (limited to 'cryptech/py11')
-rw-r--r--cryptech/py11/__init__.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cryptech/py11/__init__.py b/cryptech/py11/__init__.py
index fb9af7e..1618a76 100644
--- a/cryptech/py11/__init__.py
+++ b/cryptech/py11/__init__.py
@@ -12,6 +12,15 @@ from .types import *
from .constants import *
from .attributes import *
+import platform
+
+if platform.system() == "Darwin":
+ default_so_name = "/usr/local/lib/libcryptech-pkcs11.dylib"
+elif platform.system() == "Linux":
+ default_so_name = "/usr/lib/libcryptech-pkcs11.so"
+else:
+ default_so_name = "/usr/local/lib/libcryptech-pkcs11.so"
+
class PKCS11 (object):
"""
@@ -46,7 +55,7 @@ class PKCS11 (object):
# Whether to use C_GetFunctionList() instead of dynamic link symbols.
use_C_GetFunctionList = False
- def __init__(self, so_name = "libpkcs11.so"):
+ def __init__(self, so_name = default_so_name):
self.so_name = so_name
self.so = CDLL(so_name)
self.d = type("Dispatch", (object,), {})()