private KeyVersion rollNewVersionInternal(String name, byte[] material) throws NoSuchAlgorithmException, IOException { checkNotEmpty(name, "name"); Map<String, String> jsonMaterial = new HashMap<String, String>(); if (material != null) { jsonMaterial.put(KMSRESTConstants.MATERIAL_FIELD, Base64.encodeBase64String(material)); } URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, null, null); HttpURLConnection conn = createConnection(url, HTTP_POST); conn.setRequestProperty(CONTENT_TYPE, APPLICATION_JSON_MIME); Map response = call(conn, jsonMaterial, HttpURLConnection.HTTP_OK, Map.class); KeyVersion keyVersion = parseJSONKeyVersion(response); encKeyVersionQueue.drain(name); return keyVersion; }
@Override public List<KeyVersion> getKeyVersions(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.VERSIONS_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); List response = call(conn, null, HttpURLConnection.HTTP_OK, List.class); List<KeyVersion> versions = null; if (!response.isEmpty()) { versions = new ArrayList<KeyVersion>(); for (Object obj : response) { versions.add(parseJSONKeyVersion((Map) obj)); } } return versions; }
@Override public List<KeyVersion> getKeyVersions(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.VERSIONS_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); List response = call(conn, null, HttpURLConnection.HTTP_OK, List.class); List<KeyVersion> versions = null; if (!response.isEmpty()) { versions = new ArrayList<KeyVersion>(); for (Object obj : response) { versions.add(parseJSONKeyVersion((Map) obj)); } } return versions; }
@Override public List<KeyVersion> getKeyVersions(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.VERSIONS_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); List response = call(conn, null, HttpURLConnection.HTTP_OK, List.class); List<KeyVersion> versions = null; if (!response.isEmpty()) { versions = new ArrayList<KeyVersion>(); for (Object obj : response) { versions.add(parseJSONKeyVersion((Map) obj)); } } return versions; }
@Override public void deleteKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, null, null); HttpURLConnection conn = createConnection(url, HTTP_DELETE); call(conn, null, HttpURLConnection.HTTP_OK, null); }
@Override public void deleteKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, null, null); HttpURLConnection conn = createConnection(url, HTTP_DELETE); call(conn, null, HttpURLConnection.HTTP_OK, null); }
@Override public void deleteKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, null, null); HttpURLConnection conn = createConnection(url, HTTP_DELETE); call(conn, null, HttpURLConnection.HTTP_OK, null); }
@Override public void deleteKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, null, null); HttpURLConnection conn = createConnection(url, HTTP_DELETE); call(conn, null, HttpURLConnection.HTTP_OK, null); }
@Override public KeyVersion getCurrentKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.CURRENT_VERSION_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public Metadata getMetadata(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.METADATA_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONMetadata(response); }
@Override public KeyVersion getKeyVersion(String versionName) throws IOException { checkNotEmpty(versionName, "versionName"); URL url = createURL(KMSRESTConstants.KEY_VERSION_RESOURCE, versionName, null, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public KeyVersion getCurrentKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.CURRENT_VERSION_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public Metadata getMetadata(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.METADATA_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONMetadata(response); }
@Override public KeyVersion getCurrentKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.CURRENT_VERSION_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public Metadata getMetadata(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.METADATA_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONMetadata(response); }
@Override public Metadata getMetadata(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.METADATA_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONMetadata(response); }
@Override public KeyVersion getKeyVersion(String versionName) throws IOException { checkNotEmpty(versionName, "versionName"); URL url = createURL(KMSRESTConstants.KEY_VERSION_RESOURCE, versionName, null, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public KeyVersion getCurrentKey(String name) throws IOException { checkNotEmpty(name, "name"); URL url = createURL(KMSRESTConstants.KEY_RESOURCE, name, KMSRESTConstants.CURRENT_VERSION_SUB_RESOURCE, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public KeyVersion getKeyVersion(String versionName) throws IOException { checkNotEmpty(versionName, "versionName"); URL url = createURL(KMSRESTConstants.KEY_VERSION_RESOURCE, versionName, null, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }
@Override public KeyVersion getKeyVersion(String versionName) throws IOException { checkNotEmpty(versionName, "versionName"); URL url = createURL(KMSRESTConstants.KEY_VERSION_RESOURCE, versionName, null, null); HttpURLConnection conn = createConnection(url, HTTP_GET); Map response = call(conn, null, HttpURLConnection.HTTP_OK, Map.class); return parseJSONKeyVersion(response); }