aboutsummaryrefslogtreecommitdiff
path: root/cryptech/py11
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-05-10 19:56:44 -0400
committerRob Austein <sra@hactrn.net>2017-05-10 19:56:44 -0400
commitccef1b59bc6cca89474eaddf7144972926281e29 (patch)
treeacba87b2b069a2d788d256a266db203d4920924e /cryptech/py11
parent743ec40231db809d22487ee60f64d00b7b845807 (diff)
Clean up default location of PKCS #11 library.
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,), {})()