Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm writing a .NET application in C# which uses the CngProvider class but it cannot load a required DLL for some reason.

I don't want to use the Microsoft CngProvider implementation and would like to use a smart card provider which is already configured on my system.

When the underlying CNG implementation attempts to load the provider DLL from the System32 folder it gets a "Provider DLL could not be found" exception.

The DLL is most definitely present in the System32 folder and is used without issue by Microsoft Certificate Services.

Curiously I made a short C# application which iterates over the list of files in the System32 folder and it does not see the DLL despite the fact that I've set the permissions on the file to allow full control for SYSTEM / Everyone.

I also used Impersonation to run the application as the Administrator and am still unable to see the DLL I need.

Does anyone have a suggestion?

*UPDATE* for those who would suggest to put the DLL somewhere else:
My application will not be the one loading the DLL The microsoft CNG system is the component that loads the DLL. Works fine for non-.NET applications but for some reason it is not visible when .NET is asking CNG to access the provider.
Updated 3-May-10 4:56am

1 solution

Try putting the DLL into your project folder somewhere and then adding a reference to it from there. No guarantees it'll work though.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900