Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build this project to use the 32bit library instead of 64? #48

Open
mlaw-swi opened this issue Jan 30, 2024 · 3 comments
Open

How to build this project to use the 32bit library instead of 64? #48

mlaw-swi opened this issue Jan 30, 2024 · 3 comments

Comments

@mlaw-swi
Copy link

I am wondering if there's a way to use the win32/cryptoki.dll instead of the 64bit cryptoki.dll by default.

@astraw38
Copy link
Contributor

If you're using 32b python, it should automatically use the 32b library referenced in the crystoki config files (LibUNIX in Chrystoki.conf for linux, LibNT in crystoki.ini for windows).

Alternatively, set the CRYSTOKI_CONF_DLL environment variable to point directly to your dll/.so path.

@mlaw-swi
Copy link
Author

Hi @astraw38,
I've tried using 32b python and I am using the win32/cryptoki.dll by changing the cryptoki.ini. I still get this error.
Traceback (most recent call last):
File "C:\repo\github\pycryptoki\test.py", line 55, in
c_initialize_ex()
File "C:\repo\github\pycryptoki\pycryptoki\exceptions.py", line 61, in luna_function_exception_handle
return_tuple = luna_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\repo\github\pycryptoki\pycryptoki\session_management.py", line 83, in c_initialize
ret = C_Initialize(init_struct_p)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\repo\github\pycryptoki\pycryptoki\cryptoki\helpers.py", line 248, in luna_function
late_binded_function = getattr(CryptokiDLLSingleton().get_dll(), function_name)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\repo\github\pycryptoki\pycryptoki\cryptoki\helpers.py", line 196, in new
new_instance.loaded_dll_library = CDLL(dll_path)
^^^^^^^^^^^^^^
File "C:\Users\mlaw\AppData\Local\anaconda3\Lib\ctypes_init_.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

@astraw38
Copy link
Contributor

astraw38 commented Jan 30, 2024

You'd need to use 32b python to load the 32b dll (ref)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants