- public static void writeGigiConfig(DataOutputStream target,
- byte[] keystorepw, byte[] truststorepw, Properties mainprop,
- byte[] cacerts, byte[] keystore) throws IOException {
- writeChunk(target, GigiConfig.GIGI_CONFIG_VERSION.getBytes());
- writeChunk(target, keystorepw);
- writeChunk(target, truststorepw);
- ByteArrayOutputStream props = new ByteArrayOutputStream();
- mainprop.store(props, "");
- writeChunk(target, props.toByteArray());
- writeChunk(target, cacerts);
- writeChunk(target, keystore);
+ public static void writeGigiConfig(OutputStream target, byte[] keystorepw,
+ byte[] truststorepw, Properties mainprop, byte[] cacerts,
+ byte[] keystore) throws IOException {
+ TarOutputStream tos = new TarOutputStream(target);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ mainprop.store(baos, "");
+
+ putTarEntry(baos.toByteArray(), tos, "gigi.properties");
+ putTarEntry(keystorepw, tos, "keystorepw");
+ putTarEntry(truststorepw, tos, "truststorepw");
+ putTarEntry(keystore, tos, "keystore.pkcs12");
+ putTarEntry(cacerts, tos, "cacerts.jks");
+ tos.close();