Skip to content

Commit ae1a686

Browse files
authored
Merge pull request #245 from rlm2002/jniManUpdates
update wolfJSSE manual to reflect changes up to 1.16.0 release
2 parents e011f62 + 795d923 commit ae1a686

File tree

8 files changed

+396
-26
lines changed

8 files changed

+396
-26
lines changed

wolfSSL-JNI/src/chapter01.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ wolfSSL JNI/JSSE is a provider implementation of the Java Secure Socket Extensio
44

55
The Java Secure Socket Extension ( **JSSE** ) framework supports the installation of security providers. These providers can implement a subset of the functionality used by the Java JSSE security APIs, including SSL/TLS.
66

7-
This document describes wolfSSL’s JSSE provider implementation, named “**wolfJSSE / wolfSSLProvider**”. wolfJSSE wraps the native wolfSSL SSL/TLS library. This interface gives Java applications access to all the benefits of using wolfSSL, including current SSL/TLS standards up to [TLS 1.3](https://www.wolfssl.com/tls13), [FIPS 140-2 and 140-3](https://www.wolfssl.com/license/fips/) support, performance optimizations, hardware cryptography support, [commercial support](https://www.wolfssl.com/products/support-and-maintenance/), and more!
7+
This document describes wolfSSL’s JSSE provider implementation, named “**wolfJSSE / wolfSSLProvider**”. wolfJSSE wraps the native wolfSSL SSL/TLS library. This interface gives Java applications access to all the benefits of using wolfSSL, including current SSL/TLS standards up to [TLS 1.3](https://www.wolfssl.com/tls13), [DTLS 1.3](https://www.wolfssl.com/wolfssl-java-jsse-provider-supports-dtls-1-3/), and [FIPS 140-2 and 140-3](https://www.wolfssl.com/license/fips/) support, performance optimizations, hardware cryptography support, [commercial support](https://www.wolfssl.com/products/support-and-maintenance/), and more!
88

99
wolfJSSE is distributed as part of the “ **wolfssljni** ”package.

wolfSSL-JNI/src/chapter02.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on the following:
1010
+ Oracle JDK
1111
+ OpenJDK
1212
+ Zulu JDK
13-
+ Amazon Coretto
13+
+ Amazon Corretto
14+
+ Eclipse Temurin
1415
- Mac OSX
1516
- Windows (Visual Studio)
1617
- Android Studio

wolfSSL-JNI/src/chapter03.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ location. For example:
3434
$ ./java.sh /path/to/wolfssl/install
3535
```
3636

37+
A second optional argument specifies a custom wolfSSL library name to link
38+
against. This is useful when wolfSSL was compiled with `--with-libsuffix`:
39+
40+
```
41+
$ ./java.sh /usr/local wolfssljsse
42+
```
43+
44+
The script will attempt to auto-detect `JAVA_HOME` if not set. To explicitly
45+
specify a Java installation, set the `JAVA_HOME` environment variable before
46+
running.
47+
48+
Preset `CFLAGS` can be passed to the script via the environment:
49+
50+
```
51+
$ CFLAGS="-DWOLFJNI_USE_IO_SELECT" ./java.sh
52+
```
53+
54+
On Aarch64 hosts, `-fPIC` is automatically added to CFLAGS.
55+
56+
## Building with ant
57+
3758
To compile the Java sources, `ant` is used:
3859

3960
```
@@ -82,6 +103,73 @@ is used:
82103
$ ant examples
83104
```
84105

106+
## Building with Maven
107+
108+
wolfJSSE supports building and packaging with Maven for projects that consume
109+
Maven packages.
110+
111+
First, compile the native JNI shared library using `java.sh` as described above.
112+
This creates the native library under `./lib`:
113+
114+
```
115+
$ ./java.sh
116+
```
117+
118+
Compile the Java sources (output to `./target/classes`):
119+
120+
```
121+
$ mvn compile
122+
```
123+
124+
Compile and run JUnit tests:
125+
126+
```
127+
$ mvn test
128+
```
129+
130+
Package the JAR file (runs tests, then creates `target/wolfssl-jsse-X.X.X-SNAPSHOT.jar`):
131+
132+
```
133+
$ mvn package
134+
```
135+
136+
Generate Javadoc API documentation (output to `./docs/apidocs`):
137+
138+
```
139+
$ mvn javadoc:javadoc
140+
```
141+
142+
Install the JAR to the local Maven repository:
143+
144+
```
145+
$ mvn install
146+
```
147+
148+
The JAR will be installed to a location similar to:
149+
150+
```
151+
~/.m2/repository/com/wolfssl/wolfssl-jsse/X.X.X-SNAPSHOT/wolfssl-jsse-X.X.X-SNAPSHOT.jar
152+
```
153+
154+
The native `libwolfssljni.so` (or `.dylib`) library must be installed on the
155+
native library search path (e.g., `/usr/local/lib`) or the path can be set via
156+
`LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS).
157+
158+
Applications can include wolfJSSE as a Maven dependency:
159+
160+
```xml
161+
<dependency>
162+
<groupId>com.wolfssl</groupId>
163+
<artifactId>wolfssl-jsse</artifactId>
164+
<version>1.16.0-SNAPSHOT</version>
165+
</dependency>
166+
```
167+
168+
## Windows Visual Studio Build
169+
170+
wolfJSSE can be compiled on Windows using Visual Studio. For detailed
171+
instructions, see the `IDE/WIN/README.md` file in the wolfssljni package.
172+
85173
## Android Studio Build
86174

87175
An example Android Studio project is located in the directory `IDE/Android`.

wolfSSL-JNI/src/chapter04.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,39 @@ for (Provider prov:providers) {
4848
}
4949
```
5050

51+
### Java Module System (JPMS) Support
52+
53+
wolfJSSE includes Java ServiceLoader support for compatibility with the Java
54+
Module System (JPMS). This allows the wolfJSSE provider to be automatically
55+
discovered and loaded when the JAR is on the module path.
56+
57+
The wolfJSSE JAR contains a `META-INF/services/java.security.Provider` file
58+
that registers `com.wolfssl.provider.jsse.WolfSSLProvider` for automatic
59+
discovery. Applications can discover and load the provider using the standard
60+
Java ServiceLoader API:
61+
62+
```
63+
import java.security.Provider;
64+
import java.security.Security;
65+
import java.util.ServiceLoader;
66+
67+
ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class);
68+
for (Provider provider : loader) {
69+
if (provider.getName().equals("wolfJSSE")) {
70+
Security.addProvider(provider);
71+
break;
72+
}
73+
}
74+
```
75+
76+
For modular applications, wolfJSSE can be used as an automatic module or
77+
included as a dependency in your `module-info.java`.
78+
79+
**Note:** ServiceLoader-based provider discovery relies on the
80+
`META-INF/services` mechanism which is a JAR/module system feature. On Android,
81+
applications should register the provider directly using
82+
`Security.addProvider(new WolfSSLProvider())` instead.
83+
5184
## Installation at OS / System Level
5285

5386
### Unix/Linux

wolfSSL-JNI/src/chapter05.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@ wolfJSSE / wolfSSL JNI package structure:
99

1010
```
1111
wolfssljni/
12-
build.xml ant build script
12+
build.xml ant build script
13+
pom.xml Maven build configuration
1314
COPYING
14-
docs/ Javadocs
15-
examples/ Example apps
16-
IDE/ Example IDE project, Android Studio
17-
java.sh Script to build native C JNI sources
15+
docs/ Javadocs
16+
examples/ Example apps
17+
IDE/ IDE projects
18+
Android/ Android Studio
19+
WIN/ Windows Visual Studio
20+
java.sh Script to build native C JNI sources
1821
LICENSING
1922
Makefile
20-
lib/ Output directory for compiled library
21-
native/ Native C JNI binding source files
22-
platform/ Android AOSP build files
23+
lib/ Output directory for compiled library
24+
native/ Native C JNI binding source files
25+
platform/ Android AOSP build files
2326
README.md
24-
rpm/ rpm spec files
27+
rpm/ rpm spec files
2528
src/
26-
java/ Java source files
27-
test/ Test source files
29+
java/ Java source files
30+
test/ Test source files
2831
```
2932

3033
The **wolfJSSE** provider source code is located in the

wolfSSL-JNI/src/chapter06.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
wolfJSSE extends or implements the following JSSE classes:
44

55
javax.net.ssl.SSLContextSpi
6-
SSL, TLS, DEFAULT, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3
6+
SSL, TLS, DEFAULT, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1.3
77
javax.net.ssl.KeyManagerFactorySpi
88
PKIX, X509, SunX509
99
javax.net.ssl.TrustManagerFactorySpi
@@ -20,3 +20,16 @@ wolfJSSE extends or implements the following JSSE classes:
2020
java.security.cert.X509Certificate
2121
javax.security.cert.X509Certificate
2222

23+
**Note:** `DTLSv1.3` is only supported through the `SSLEngine` interface.
24+
25+
## Secure Renegotiation
26+
27+
wolfJSSE supports secure renegotiation when the underlying native wolfSSL
28+
library has been compiled with secure renegotiation support:
29+
30+
```
31+
$ ./configure --enable-secure-renegotiation
32+
```
33+
34+
Or by defining `HAVE_SECURE_RENEGOTIATION`.
35+

0 commit comments

Comments
 (0)