@Override public Object create() throws HeapException { JsonValue urlString = config.get("url").required(); URL url = evaluateJsonStaticExpression(urlString).asURL(); String password = evaluate(config.get("password")); String type = config.get("type").defaultTo(KeyStore.getDefaultType()).asString().toUpperCase(); KeyStore keyStore = null; InputStream keyInput = null; try { keyStore = KeyStore.getInstance(type); keyInput = url.openStream(); char[] credentials = (password == null) ? null : password.toCharArray(); keyStore.load(keyInput, credentials); } catch (Exception e) { throw new HeapException( format("Cannot load %S KeyStore from %s", type, urlString.asString()), e); } finally { closeSilently(keyInput); } return keyStore; }