public static void printKeyset(String type, KeysetHandle keysetHandle) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); CleartextKeysetHandle.write(keysetHandle, JsonKeysetWriter.withOutputStream(outputStream)); log.info("{}: {}", type, new String(outputStream.toByteArray())); } catch (IOException ex) { log.error("Failed to write keyset", ex); } }