CryptoSys Home > PKI > Creating a C# command-line app with CryptoSys PKI

Creating a C# command-line app with CryptoSys PKI


Here is a quick guide to creating a C# command-line application using Microsoft Visual Studio. This is for VS 2013.

  1. Create a new C# console project:    File > New > Project > Visual C# > Windows Desktop > Console Application
  2. Add a reference to the CryptoSys PKI .NET library file diCrSysPKINet.dll:    Project > Add Reference > Browse and search for
    C:\Program Files (x86)\CryptoSysPKI\DotNet\diCrSysPKINet.dll
    The installation program should have copied the .NET library DLL file into the directory C:\Program Files (x86)\CryptoSysPKI\DotNet. Yes, thats "x86" even on a 64-bit platform. If you are using a 32-bit machine, then it will be in
    C:\Program Files\CryptoSysPKI\DotNet
  3. Make sure the Solution Platform is set to Any CPU. If not, you may get a Exception from HRESULT:0x8007000B error.
  4. Add a using directive for the CryptoSysPKI library. We find the following directives are sufficient:
    using System;
    using System.Text;
    using System.Diagnostics;
    using CryptoSysPKI;
    
  5. Add your C# code module. Print out debugging messages using Console.Writeline().
  6. To check you have installed CryptoSys PKI properly, add this line to your program:
    static void Main(string[] args) {
    	Console.WriteLine("PKI Version={0}", General.Version());
    }
    
    This should output PKI Version=200301, or similar, depending on the actual version you have. If it fails with Unable to load DLL 'diCrPKI.dll', you need to re-install it.

See the manual page Using with .NET for more documentation.

Contact

For more information, please send us a message.

This page last updated 4 February 2022

[Go to top]