To use the .NET interface with C# and VB.NET (VB2010+):
diCrSysPKINet.dll
library file into a convenient folder
(the install program puts this file by default in
C:\Program Files (x86)\CryptoSysPKI\DotNet
).
diCrSysPKINet.dll
.using CryptoSysPKI;or (for VB.NET)
Imports CryptoSysPKI
to your code.
Alternatively, with C#, you can just include the source code module CryptoSysPKI.cs
in your project
and there is no need to reference the class library DLL.
Note that you must also have the core Win32 (or X64) executable diCrPKI.dll
installed on your system
for the .NET interface to work. If not, it will throw an exception immediately:
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'diCrPKI.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
If you are working on a 64-bit system, Visual Studio will go looking for the 64-bit core DLL in the Windows system folder
(usually C:\Windows\System32
).
Make sure you set the Solution Platform to be Any CPU.
The .NET class library diCrSysPKINet.dll
is compiled for all platforms (Win32 and X64) and
requires at least .NET 4.0 and should be upwardly compatible with all later .NET versions.
This means that you must be using VS2010 or later.
All methods in the CryptoSysPKI .NET Class Library are static methods. You do not need to instantiate or dispose of any objects.
For examples, see the test code TestPKIcsharp.cs
and TestPKIvbnet.vb
provided in the distribution.
The file diCrSysPKINet.dll
and distribution test code will be found in the DotNet sub-directory of the installation folder, typically
C:\Program Files (x86)\CryptoSysPKI\DotNet
(or C:\Program Files\CryptoSysPKI\DotNet
on a 32-bit machine).
To find the installation folder, use Start > All Programs > CryptoSysPKI > CryptoSys PKI Reference Files.
If you need to convert old VB6 code, see Converting VB6 to VB.NET.