JoseUtils { public static byte[] thumbprint(PublicKey key) { try { PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(key); return jwk.calculateThumbprint("SHA-256"); } catch (JoseException ex) { throw new IllegalArgumentException("Bad public key", 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 testThumbprint() throws Exception { byte[] thumb = JoseUtils.thumbprint(TestUtils.createKeyPair().getPublic()); String encoded = Base64.getUrlEncoder().withoutPadding().encodeToString(thumb); assertThat(encoded, is(TestUtils.THUMBPRINT)); }