0

Why am I getting a "java.lang.SecurityException: Invalid signature file digest for Manifest main attributes" error when using Java JSON Web Token (JJWT)?

My code is (copied from https://github.com/jwtk/jjwt in its simplest form):

Key key = MacProvider.generateKey();

String compactJws = Jwts.builder()
    .setSubject("Joe")
    .signWith(SignatureAlgorithm.HS512, key)
    .compact();
return compactJws;

The exception stops at "Key key = MacProvider.generateKey();". And if I comment out the line, it will stop at the next line ("String compactJws =...")

Please help!

ikevin8me
  • 4,253
  • 5
  • 44
  • 84
  • The jjws library was built by downloading the source into a jar (by opening the POM file in IntelliJ and creating an artifact.) Is it possible that I forgot to include something when building it? – ikevin8me Jan 22 '17 at 13:54

1 Answers1

1

OK. I solved my own problem. It was the jar file was not properly compiled. I downloaded a jar from somewhere and it worked properly.

ikevin8me
  • 4,253
  • 5
  • 44
  • 84