diff options
author | Rob Austein <sra@hactrn.net> | 2017-05-10 19:56:44 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2017-05-10 19:56:44 -0400 |
commit | ccef1b59bc6cca89474eaddf7144972926281e29 (patch) | |
tree | acba87b2b069a2d788d256a266db203d4920924e /cryptech/py11 | |
parent | 743ec40231db809d22487ee60f64d00b7b845807 (diff) |
Clean up default location of PKCS #11 library.
Diffstat (limited to 'cryptech/py11')
-rw-r--r-- | cryptech/py11/__init__.py | 11 |
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,), {})() |