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

error: Failed to load pkcs11 module #2884

Closed
nshah2588 opened this issue Oct 2, 2023 · 4 comments
Closed

error: Failed to load pkcs11 module #2884

nshah2588 opened this issue Oct 2, 2023 · 4 comments

Comments

@nshah2588
Copy link

nshah2588 commented Oct 2, 2023

Hello,

We tried to create the new OpenSC dll on Windows all fine.

Then we tried to run it on Windows and we got the error as below

C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool --module "C:\xxxxx\xxxxxx\Downloads\opensc-pkcs11.dll" -L sc_dlopen failed: LoadLibrary/GetProcAddress failed error: Failed to load pkcs11 module Aborting.

Furthermore, when we built the OpenSC from within Cygwin and tried to run it from within Cygwin we got the proper response for the -L command

Also, we are not able to run the OPENSC_DEBUG=9 prompt to get the logs unfortunately

C:\Program Files\OpenSC Project\OpenSC\tools>OPENSC_DEBUG=9 pkcs11-tool --module "C:\xxxxx\xxxxx\Downloads\opensc-pkcs11.dll" -L 'OPENSC_DEBUG' is not recognized as an internal or external command, operable program or batch file.
Can you please advise what we are missing?

@dengert
Copy link
Member

dengert commented Oct 2, 2023

Building on windows or cross compiling are very tricky.

'OPENSC_DEBUG' is not recognized as an internal or external command ...

Windows does not support setting environment variables on the command line. Use the "set" command. It looks like you are mixing a windows built pkcs11-tool with a cross compiled module. That may never work.

As I said in #2883 "submit your changes as a Pull Request, Windows MSI and MacOS DMG files are created automatically on github and your changes will be kept up to date."

Based on #2883 it looks like you are trying to make changes to card-entersafe.c because that was the driver OpenSC matched or you forced that driver. Looking at your github account avatar of a token, it looks like some new token with both USB Type A and Type C with a button and maybe NFC? And you refer to yourself as "we" so I assume you are not doing this alone.

So I would suggest that the best way to get support for this device using OpenSC code get it working on Linux, then submit your changes as a PR, let Github build the Windows MSI and MacOS DMG files and use them to test.

When you get it working, your company can say the new device is supported by OpenSC like other smartcard venders do.

If you goal is to copy OpenSC code and distribute your own version based on OpenSC, you may have license issues.

@nshah2588
Copy link
Author

Hello @dengert

Thank you for your response.

By "we" I mean the team working on the code. Yes, we are using OpenSC card-entersafe and have made some modifications to the code to suite the working of our token which supports USB A, USB C and NFC. There is no button as such but a simple touch pad to showcase user presence.

We are able to get the code working perfectly on Linux. But we need the Windows .dll and the .dylib for macOS which we did not get. Hence we are trying to compile on Windows once again. We are able to compile it within cygwin and Windows but the created .dll doesn't work.

We need to provide the .dll file to someone who can then test our device. Not sure how to proceed there. Hence we are trying to compile it on Windows.

Hope this explains what we are trying to accomplish.

@dengert
Copy link
Member

dengert commented Oct 2, 2023

Do you have a member who has uses github before?
If not Start here:
https://docs.github.com/en/get-started/quickstart/fork-a-repo

make your changes to your local copy
push you to your forked version.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

I am busy most of rest of day...

@nshah2588
Copy link
Author

Thank you @dengert for your suggestion. We will get back on this shortly

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