I am trying to produce JWK from an X.509 PEM certificate in jose4j, but I am not getting any clue to do the same.
I have already achieved this using nimbus jose+jwt library , can someone please help me with equivalent code for jose4j?
Code piece for nimbus jose+jwt :
try {
jwk1 = (RSAKey) JWK.parseFromPEMEncodedX509Cert(certificateString);
Map<String, Object> jwkMap = jwk1.toJSONObject();
jwkMap.put("use", "enc");
jwkMap.put("alg", "RSA-OAEP-256");
jwk1 = (RSAKey) JWK.parse(jwkMap);
} catch (JOSEException ex) {
log.error("Exception while creating JWK from X.509 certificate : {}", ex.getMessage());
}