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

What is the recommendation for paths with space? #20

Open
pionl opened this issue Aug 21, 2024 · 2 comments
Open

What is the recommendation for paths with space? #20

pionl opened this issue Aug 21, 2024 · 2 comments

Comments

@pionl
Copy link

pionl commented Aug 21, 2024

Hi,

Ive got a path to pkcs11 with spaces, how is recommended way to pass this path to? Thank you

System.Environment.SetEnvironmentVariable("PKCS11_LOGGER_LIBRARY_PATH", pkcs11LibFixedPath);

I have tried several implementations based on this https://www.howtogeek.com/694949/how-to-escape-spaces-in-file-paths-on-the-windows-command-line/

0x00002784 : 0x000063cc : ****************************** 2024-08-21 20:10:54 ***
0x00002784 : 0x000063cc : PKCS11-LOGGER 2.2.0
0x00002784 : 0x000063cc : PKCS#11 logging proxy module
0x00002784 : 0x000063cc : Developed as a part of the Pkcs11Interop project
0x00002784 : 0x000063cc : Please visit www.pkcs11interop.net for more information
0x00002784 : 0x000063cc : ****************************** 2024-08-21 20:10:54 ***
0x00002784 : 0x000063cc : Unable to load C:\Program Files\Yubico\Yubico PIV Tool\bin\libykcs11.dll
0x000070b8 : 0x00006078 : ****************************** 2024-08-21 20:14:13 ***
0x000070b8 : 0x00006078 : PKCS11-LOGGER 2.2.0
0x000070b8 : 0x00006078 : PKCS#11 logging proxy module
0x000070b8 : 0x00006078 : Developed as a part of the Pkcs11Interop project
0x000070b8 : 0x00006078 : Please visit www.pkcs11interop.net for more information
0x000070b8 : 0x00006078 : ****************************** 2024-08-21 20:14:13 ***
0x000070b8 : 0x00006078 : Unable to load C:\Program^ Files\Yubico\Yubico^ PIV^ Tool\bin\libykcs11.dll
0x00006590 : 0x00007bac : ****************************** 2024-08-21 20:20:40 ***
0x00006590 : 0x00007bac : PKCS11-LOGGER 2.2.0
0x00006590 : 0x00007bac : PKCS#11 logging proxy module
0x00006590 : 0x00007bac : Developed as a part of the Pkcs11Interop project
0x00006590 : 0x00007bac : Please visit www.pkcs11interop.net for more information
0x00006590 : 0x00007bac : ****************************** 2024-08-21 20:20:40 ***
0x00006590 : 0x00007bac : Unable to load C:\Program_Files\Yubico\Yubico_PIV_Tool\bin\libykcs11.dll
0x00007b40 : 0x00004e08 : ****************************** 2024-08-21 20:21:56 ***
0x00007b40 : 0x00004e08 : PKCS11-LOGGER 2.2.0
0x00007b40 : 0x00004e08 : PKCS#11 logging proxy module
0x00007b40 : 0x00004e08 : Developed as a part of the Pkcs11Interop project
0x00007b40 : 0x00004e08 : Please visit www.pkcs11interop.net for more information
0x00007b40 : 0x00004e08 : ****************************** 2024-08-21 20:21:56 ***
0x00007b40 : 0x00004e08 : Unable to load C:\Program\ Files\Yubico\Yubico\ PIV\ Tool\bin\libykcs11.dll
0x0000713c : 0x000013c8 : ****************************** 2024-08-21 20:23:02 ***
0x0000713c : 0x000013c8 : PKCS11-LOGGER 2.2.0
0x0000713c : 0x000013c8 : PKCS#11 logging proxy module
0x0000713c : 0x000013c8 : Developed as a part of the Pkcs11Interop project
0x0000713c : 0x000013c8 : Please visit www.pkcs11interop.net for more information
0x0000713c : 0x000013c8 : ****************************** 2024-08-21 20:23:02 ***
0x0000713c : 0x000013c8 : Unable to load C:\Program` Files\Yubico\Yubico` PIV` Tool\bin\libykcs11.dll
0x00007d80 : 0x000079cc : ****************************** 2024-08-21 20:35:17 ***
0x00007d80 : 0x000079cc : PKCS11-LOGGER 2.2.0
0x00007d80 : 0x000079cc : PKCS#11 logging proxy module
0x00007d80 : 0x000079cc : Developed as a part of the Pkcs11Interop project
0x00007d80 : 0x000079cc : Please visit www.pkcs11interop.net for more information
0x00007d80 : 0x000079cc : ****************************** 2024-08-21 20:35:17 ***
0x00007d80 : 0x000079cc : Unable to load C:\\Program Files\\Yubico\\Yubico PIV Tool\\bin\libykcs11.dll
0x000062b4 : 0x000057fc : ****************************** 2024-08-21 20:36:11 ***
0x000062b4 : 0x000057fc : PKCS11-LOGGER 2.2.0
0x000062b4 : 0x000057fc : PKCS#11 logging proxy module
0x000062b4 : 0x000057fc : Developed as a part of the Pkcs11Interop project
0x000062b4 : 0x000057fc : Please visit www.pkcs11interop.net for more information
0x000062b4 : 0x000057fc : ****************************** 2024-08-21 20:36:11 ***
0x000062b4 : 0x000057fc : Unable to load C:\"Program Files"\Yubico\"Yubico PIV Tool"\bin\libykcs11.dll

@jariq
Copy link
Member

jariq commented Aug 25, 2024

Your first try seems to be the correct one:

0x00002784 : 0x000063cc : Unable to load C:\Program Files\Yubico\Yubico PIV Tool\bin\libykcs11.dll

However that error does not necessarily mean that there is a problem with a path. Loading of PKCS#11 library can fail because of many other issues. One of them for example could be that PKCS#11 library depends on some third party library that is not available in your system. If you want to get more details you would need to modify part of code that handles error returned by LoadLibraryA function and get those details by calling GetLastError function.

When it comes to Yubico's PKCS#11 library I remember that it needed "special" loading that I implemented in Pkcs11Interop as a part of Pkcs11Interop/Pkcs11Interop#143. If that is the case, then the quickest fix would be to add C:\Program Files\Yubico\Yubico PIV Tool\bin\ to your PATH.

@jariq
Copy link
Member

jariq commented Oct 3, 2024

@pionl any update on this?

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