4

We are considering the adoption of a library to generate and use JSON Web Tokens. Jose4j seems a good choice but library "Dependencies" state that "...Jose4j is compiled with/for Java 7 and will also run on Java 8..." and our current instalation run on Java 6 version (migration to higher versions is out of our reach), so our question is simple.

Is there any chance to integrate Jose4j with Java 6? (not at all, with some limitations, can be achieved in any way by adding some specific libraries, etc.)

Thanks in advance

Xavi Alcalde
  • 43
  • 1
  • 3

2 Answers2

2

Getting jose4j to run on Java 6 is (probably) possible but will require recompilation and some code changes.

There have been a couple forks of somewhat older versions that I believe have back-ported to compile and run with Java 6 - https://bitbucket.org/yosef_kitrossky/jose4j-jdk1.6/commits/all is the most recent that I know about and there's also https://bitbucket.org/ijazfx/jose4j/commits/all

You could probably do a back-port of the latest too without too much trouble. The code base uses some multi-catch, diamond, and try-with-resources syntax that will need to be converted to the pre Java 7 equivalents. Somewhat tedious perhaps but not rocket surgery. There are also some algorithms that won't work. Some might just not be available at runtime and some, like all the AES-GCM related bits, will need to be removed from the code to get it to compile.

You'll also want to have the JCE Unlimited Strength Jurisdiction Policy File(s) in place as some of the unit tests use AES keys that are larger than 128 bits http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

I hope this helps. Unfortunately, I just don't have bandwidth to maintain a Java 6 compatible version myself.

Brian Campbell
  • 2,293
  • 12
  • 13
  • Thanks for your answer. It helps for sure. Have two "investigation" paths, those forks you mentioned (maybe we can reach our desired functionality with that back-porting) and/or back-port last version (taking into account your hints about what might work and what may not). Again thanks for your answer Brian, best regards. – Xavi Alcalde Nov 02 '15 at 07:41
  • recently noticed this https://bitbucket.org/n_k_c/jose4j/commits/091fbb0a1049750861e947e61f8cf3eca95c84f7 which is changes to compile on 6 in what I think is a more recent fork – Brian Campbell Nov 23 '15 at 14:06
0

Nimbus JOSE + JWT have support for Java 6 since 4.11.1 version.

From documentation, you just need inform the classifier in the dependency:

<dependency>
    <groupId>com.nimbusds</groupId>
    <artifactId>nimbus-jose-jwt</artifactId>
    <classifier>jdk16</classifier>
    <version>[ version ]</version>
</dependency>

You can find the available versions here.

Dherik
  • 17,757
  • 11
  • 115
  • 164