wolfSSL / wolfssljni

wolfSSL JSSE provider and JNI wrapper for SSL/TLS, supporting up to TLS 1.3!
https://www.wolfssl.com
GNU General Public License v2.0
63 stars 35 forks source link

Add module Support for Java 9+ #85

Open ErikBergfurInfor opened 2 years ago

ErikBergfurInfor commented 2 years ago

I'm working on getting a Java 17 FIPS test environment working with WolfSSL as the JSSE and JCA. One of the build steps is to get a FIPS JDK compiled with the JSSE and JCA modules. If I put the JNI and JSSE jars in the /fips and run

jlink --no-header-files --no-man-pages \
    --compress=2 \
    --module-path /fips/ \
    --add-modules ${mods},wolfcrypt.jni,wolfssl.jsse \
    --output /usr/java/fips --ignore-signing-information

I get errors that indicate that the module-info class is missing. I can patch the jar-files with:

jdeps --ignore-missing-deps --generate-module-info patch /fips/wolfcrypt-jni.jar \
  && javac --patch-module wolfcrypt.jni=/fips/wolfcrypt-jni.jar patch/wolfcrypt.jni/module-info.java \
  && jar uf /fips/wolfcrypt-jni.jar -C patch/wolfcrypt.jni module-info.class

But when I do this and retry with the previous command, I get a conflict in the exported packages.

What I think needs to be done is:

  1. In wolfssljni, move the classes in com.wolfssl.wolfcrypt to com.wolfssl.wolfcrypt.jsse or somewhere non-conflicting
  2. Add a module-info.java to each jar, to ease the integration in java 9+
cconlon commented 2 years ago

Hi @ErikBergfurInfor, thanks for the reports. I'll be looking into this and the other issues you recently opened.