Extra Interfaces


This page contains extra interfaces to the CryptoSys PKI Toolkit in different languages. Most of these interfaces have been kindly prepared by Dr Richard Koch unless otherwise noted. We have not tested these. They come with no support or warranties whatsoever. Please make your own checks and use at your own risk.

Writing your own interface

Hint: If you are considering writing an interface to the CryptoSys PKI Toolkit, please note that the DLL is a simple Win32 DLL not an ActiveX one, and that only 32-bit signed integers (LONG) and ANSI strings (LPSTR) are used throughout. You call the functions in the same way you call Win32 API functions like GetUserName. The library name is diCrPKI.dll. Refer also to the sections of the manual on Return Values and Type Conversions.

Types Used

Interfaces to the core functions in the CryptoSys PKI Toolkit can best be figured out from the diCrPKI.h include file. The latest version is included in the downloaded installation distribution and should be in the directory C:\Program Files\CryptoSysPKI\C. The linked version here may be out of date.

Our TypeDescription
longA signed 32-bit integer, passed by value
[const] char *szANSI string: a string of single-byte non-zero characters terminated by a zero byte
[const] unsigned char *lpByte array: an ordered sequence of single-byte values of any value in the range [0,255]
void *lpAlternative for byte array.

The const qualifier indicates an input-only parameter. No const qualifier for a string or byte array indicates an output parameter. You must allocate storage for these output variables.

Common Problems

The most common problems in writing interfaces are:

  1. Using a local 64-bit integer instead of a 32-bit one. A `long' in C is only a 32-bit signed int. All return values are signed 32-bit integers. Check that the "INT" type in your language is a 32-bit one. If not, use one that is.
  2. Passing Unicode UTF-16 strings. The strings must be single-character ANSI strings terminated by a zero character. If your system works with native Unicode strings, you will need to convert to ANSI before calling. If your system passes the length of the string as part of the string, you will need to convert to a type that doesn't, perhaps a byte array. But make sure it is terminated by a zero byte - add an extra one if necessary.
  3. Handling byte arrays. In some languages, this is the same as a String type.
  4. Failing to allocate storage for output strings and byte arrays before calling. The library does not carry out any memory allocation for the output. It expects the programmer to have done this already. You must allocate an extra character for an output string to receive the terminating null character.

Visual FoxPro

See the Visual FoxPro Interface page.

D Programming Language

http://www.digitalmars.com/d/index.html
D is a general purpose systems and applications programming language. It is a higher level language than C++, but retains the ability to write high performance code and interface directly with the operating system API's and with hardware.

Interface for CryptoSys PKI: diCrPKID.d which includes a port of the .NET C# classes, and a zip file with the associated lib file and a QAD set of tests.
Last updated: 12 September 2006 for version 2.9.

Stony Brook Iso Modula-2

http://www.modula2.org/sb/index.php

Interface for CryptoSys PKI: diCrPKI.mod and diCrPKI.def, or in a zipped file which includes a modula-2-compatible diCrPKI.lib file.
Last updated: 17 April 2005

PowerBASIC

http://www.powerbasic.com/

Interface for CryptoSys PKI: diCrPKI-powerbasic.txt
Last updated: 24 February 2005

PowerBuilder Script

Jorge Perez has provided a script in PowerBuilder that uses some of the DLL functions in CryptoSys PKI. This is the same example for SAT Mexico that we prepared using VB6. It should give any Powerbuilder user the necessary information to use any of the functions in the Toolkit.

Example interface: powerbuilder.sat.txt
Last updated: 10 March 2006

.NET

See our own .NET Class Library with test code for C# and VB.NET programmers.

Contact

For more information, please Email Us. To comment on this page, see below.

This page last updated 2 January 2010

Comments

Post a comment on this page.

0 comments so far