JoseUtils { public static PublicKey jwkToPublicKey(Map<String, Object> jwk) { try { return PublicJsonWebKey.Factory.newPublicJwk(jwk).getPublicKey(); } catch (JoseException ex) { throw new IllegalArgumentException("Bad JWK", ex); } } private  JoseUtils(); static JSONBuilder createJoseRequest(URL url, KeyPair keypair,
                @Nullable JSONBuilder payload, @Nullable String nonce, @Nullable String kid); static Map<String, Object> createExternalAccountBinding(String kid,
            PublicKey accountKey, SecretKey macKey, URL resource); static Map<String, Object> publicKeyToJWK(PublicKey key); static PublicKey jwkToPublicKey(Map<String, Object> jwk); static byte[] thumbprint(PublicKey key); static String keyAlgorithm(JsonWebKey jwk); static String macKeyAlgorithm(SecretKey macKey);  }
@Test public void testJWKToPublicKey() throws Exception { Map<String, Object> json = new HashMap<>(); json.put("kty", TestUtils.KTY); json.put("n", TestUtils.N); json.put("e", TestUtils.E); PublicKey key = JoseUtils.jwkToPublicKey(json); assertThat(key.getEncoded(), is(TestUtils.createKeyPair().getPublic().getEncoded())); }