Introduction

The Microsoft cryptoapi wrapper dynamic link library is used by the OpenSign applets to access certificates and cryptographic keys stored in the central certificate store available on the Microsoft Windows platform. The library is a C++ library loaded by the applet at runtime and accessed through Java Native Interface (JNI).

The core development team provides a compiled version of the library for your convenience. The compiled library is available in both the source and binary distributions of OpenSign. This documents describes the steps needed if you instead of using the precompiled version choose to build the library yourself.

Feel free to use the mailing lists to place questions, comments and improvements related to building the Microsoft cryptoapi wrapper library.

Prerequisites

The following assumptions are used in this document:

  1. A Microsoft Windows platform is used for building the library
  2. Cygwin is installed with all the needed packages such as gcc-g++, gcc-mingw and make
  3. A Java SDK is installed in the directory pointed at by the environment variable $JAVA_HOME
  4. The OpenSign source distribution is unpacked in the directory
    /cygdrive/d/eclipse/workspace/opensign-<version>

Converting the crypt32 library

Obtain copies of CRYPT32.Lib and CRYPT32.DLL from your favourite Microsoft Windows installation and do the following:
	         $ echo "LIBRARY CRYPT32.dll" > crypt32.def
		 $ echo "EXPORTS" >> crypt32.def
		 $ reimp -s 'CRYPT32.Lib' | sed 's/_//' >> crypt32.def
		 $ dlltool --dllname CRYPT32.dll --def crypt32.def --output-lib libcrypt32.a -k
	   
Now place the libcrypt32.a file in /cygdrive/d/eclipse/workspace/opensign-<version>/jni/microsoftcryptoapi/lib and you are ready to build the wrapper dll.

Building the library

The following commands will now build the library assuming you are using a sh compatible shell.
	  $ cd /cygdrive/d/eclipse/workspace/opensign-<version>/jni/microsoftcryptoapi
	  $ export PATH=$JAVA_HOME/bin:$PATH
	  $ export CLASSPATH=../../classes
	  $ make dll
	
The library is located in /cygdrive/d/eclipse/workspace/opensign-<version>/jni/microsoftcryptoapi