How to start coding in C# for eToken?

Newbie request for advice:

I have a task to develop a C# (or VB.NET) service class (library) for storing/extracting a user's passwords to/from Aladdin eToken devices.

Please advise me of any suitable:

I googled but couldn't find anything helpful for starting coding.

The "eToken PKI Developer’s Guide (Windows) Version 5.0 Revision B" has only 2 phrases on .NET:

Developing in Non-C/C++ Environments

Both CAPI and PKCS#11 are C-style APIs. It is easy to use them from C/C++ programs. However, there are many other programming technologies available for MS Windows developers, such as:

  • .NET

and

Writing Wrapper Objects

The alternate solution (for either programming environment) is to write a wrapper object that answers the particular needs of the application.

Depending on these needs, the wrapper object may be a .NET assembly object, an ActiveX object or something else.

Upvotes: 4

Views: 2705

Answers (1)

Jeremy McGee
Jeremy McGee

Reputation: 25200

If you want to call a C API from C#, you'll need to use P/Invoke. This lets you write a wrapper object around the DLL that will have been provided by the hardware vendor.

This is a good introduction that calls the Windows API DLLs.

Generally, for a simple C-style API, the hard part is figuring out the signature in C# for the API call. An insanely useful resource for this is pinvoke.net, which is a collaboratively edited wiki with a fair few signatures already written. If you don't find yours there, it's a great idea to contribute.

Upvotes: 4

Related Questions