This simple application certcontext.exe is a win32 application for MS JVM that demonstrates calling COM objects, specifically CAPICOM objects, from Java code. The JCW (Java Callable Wrapper) classes, derived from capicom.dll using the jactivex.exe tool, a component of the SDK for Java 4.0, provide access to the underlying CAPICOM 2 (must be installed already) classes/interfaces. The required JCW classes, along with the basic Java application source code are packaged as an executable using jexegen.exe and then digitally signed.
The console application searches for a certificate with SubjectName substring in the specified system store, and displays the certificate, if found, and then lists the certificate count, the filtered certificate count and the certificate context value in hex. The code illustrates Java casting to the various COM interfaces. Also, the code demonstrates how variants of type VT_DISPATCH are converted to Java objects using the com.ms.com.Variant.getDispatch() method.
Usage: certcontext storename subject_name