The wolfSSL JNI package provides a Java interface to the wolfSSL SSL/TLS library, providing Java applications with SSL/TLS support up to the current TLS 1.2 and DTLS 1.2 standards. The interface is provided through the use of JNI and standard Java practices. In addition to the interface, the package provides an example client and server, written in Java, which utilize the interface to make an SSL/TLS connection.
To compile and use this interface, users must have Java installed on the development machine. Prior to compiling the JNI wrapper, the wolfSSL library must be compiled and installed in a location which can be found by the JNI wrapper. This release of the Java wrapper has been tested against wolfSSL 3.7.0.
The package utilizes the ant build system to make compilation, testing, and documentation easier and more streamlined. As such, if users wish to use the existing ant build script, ant will need to be installed and available on the development machine.
JUnit is used for unit tests. JUnit will need to be installed on the development machine in order for unit tests to work. Users can download JUnit from http://www.junit.org.
The Java interface package has the following directory structure.
To compile the JNI interface, run the following commands from the root package directory.
The java.sh script tries to detect where Java is installed on your system, using the javaHome variable in java.sh to store this path. If your system has issues finding the Java installation path, manual edit of this variable may be necessary in java.sh.
This interface includes an example server and client written in Java to provide developers with a simple usage example. The example client and server are located in the <package_root>/examples directory. Each is accompanied by a wrapper script. The wrapper script should be used when running the programs to more easily set the classpath and library path options.
The examples demonstrate usage of several things, including using custom I/O callbacks, a custom verify callback, DTLS cookie generation callback, Atomic Record callbacks, public key (ECC, RSA) callbacks, and PSK support.
Sources for the example client can be found in <package_root>/examples/Client.java and the example server in <package_root>/examples/Server.java. Custom I/O callbacks can be found in MyRecvCallback.java and MySendCallback.java, with the I/O context found in MyIOContext.java. The custom verify callback can be found in VerifyCallback.java. Examples of atomic user record layer callbacks and public key callbacks are also included in the <package_root>/examples directory.
The verify callback currently returns 1 (failure), but does no processing of the peer certificate chain. A real-world application would want to do any desired certificate verification processing before returning failure or success.
Currently DTLS usage requires custom I/O callbacks and DTLS cookie generation callback to be registered. Examples of these can be found in Server.java and Client.java.
The ant build system compiles up-to-date Javadocs when run. To view the most current Javadocs for the package, open the local javadocs index file in a web browser.
* Copyright (C) 2006-2015 wolfSSL Inc.
Please send questions or comments to wolfSSL at support@wolfssl.com.
Copyright 2016 wolfSSL Inc. All rights reserved.