class ZosmfJwkToPublicKey {

    public boolean updateJwtPublicKeyFile(String zosmfUrl, String filename, String caAlias, String caKeyStore,
    String caKeyStoreType, char[] caKeyStorePassword, char[] caKeyPassword) throws FileNotFoundException {
        try {
            String jwkJson = restTemplateWithoutKeystore.getForObject(zosmfUrl + "/jwt/ibm/api/zOSMFBuilder/jwk",
                    String.class);
            JwkToPublicKeyConverter converter = new JwkToPublicKeyConverter();
            String pem = converter.convertFirstPublicKeyJwkToPem(jwkJson, caAlias, caKeyStore, caKeyStoreType, caKeyStorePassword, caKeyPassword) ;
            try (PrintWriter out = new PrintWriter(filename)) {
                out.println(pem);
            }
            return true;
        } catch (HttpClientErrorException.NotFound e) {
            log.warn("Unable to read z/OSMF JWT public key. JWT support might be not configured in z/OSMF: {}", e.getMessage());;
            return false;
        }
    }

}