Using Cryptlib in java

Célio Monteiro <[email protected]> Fri, 21 Jun 2013 14:01:28 +0000
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <[email protected]>
Hi all,
I'm start trying to use the library in java code but I'm getting an error at startup:

In the following code, developed in Eclipse:

----------------------------------------------------------------------
01. import cryptlib.*;
02.
03. class Cryptlib
04.  {
05.    public static void main( String[] args )
06.     {
07.       int Certificate;
08.
09.       System.loadLibrary( "cl32" );
10.       try
11.       {
12.         crypt.Init();
13.         crypt.End();
14.       }
15.      catch( CryptException e )
16.       {
17.         e.printStackTrace();
18.       }
19.    }
20. };
----------------------------------------------------------------------

Due to the fact that the original library doesn't have included code for java, I applied the following suggestions:

1. I opened the file "misc/config.h" and uncomment the command #define USE_JAVA.
2. I opened the file "bindings/java_jni.c" and changed to #include <C:\Program Files\Java\jdk1.7.0_04\include\jni.h>

3. I recompiled the project.
4. I moved the cl32.dll into C:\Windows\System32

When one tries to connect to the current Cryptlib (version 3.4.2./32 bits) library,
the program returns an error at the line 12 (crypt.Init):

----------------------------------------------------------------------
Exception in thread "AWT-EventQueue-1" java.lang.UnsatisfiedLinkError: cryptlib.crypt.Init()V
                at cryptlib.crypt.Init(Native Method)
                at Cryptlib.main(Cryptlib.java:12)
                at ...
                at java.awt.Button.processActionEvent(Unknown Source)
                at java.awt.Button.processEvent(Unknown Source)
                at java.awt.Component.dispatchEventImpl(Unknown Source)
                at java.awt.Component.dispatchEvent(Unknown Source)
                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
                at java.awt.EventQueue.access$200(Unknown Source)
                at java.awt.EventQueue$3.run(Unknown Source)
                at java.awt.EventQueue$3.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                at java.awt.EventQueue$4.run(Unknown Source)
                at java.awt.EventQueue$4.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                at java.awt.EventQueue.dispatchEvent(Unknown Source)
                at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
                at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                at java.awt.EventDispatchThread.run(Unknown Source).
----------------------------------------------------------------------

Does anyone have any idea?
Thanks and regards,
Célio Monteiro

_______________________________________________
Cryptlib mailing list
[email protected] via Mail: [email protected]
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.