I am trying to generate JWE using JJWT in Java.
As per the documentation https://github.com/jwtk/jjwt#creating-a-jwe there has to be an encryptWith method in JwtBuilder class but I am not able to find it and I am using the latest available version with JDK 8
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
Currently, I am using JWS and want to replace it with JWE
String token = Jwts.builder().setClaims(claims).setIssuer(jwtIssuer)
.setIssuedAt(Date.from(currentTime.atZone(ZoneId.systemDefault()).toInstant()))
.setExpiration(Date
.from(currentTime.plusMinutes(accessTokenExpiryMin).atZone(ZoneId.systemDefault()).toInstant()))
.signWith(getSigningKey()).compact();
How to use the encryptWith method? Am I missing something?
Thanks in advance.