static byte[] writePacketToZip( Bulletin b, ZipOutputStream zipOut, Packet packet, MartusCrypto security) throws IOException { ZipEntry entry = new ZipEntry(packet.getLocalId()); zipOut.putNextEntry(entry); UnicodeWriter writer = new UnicodeWriter(zipOut); byte[] sig = packet.writeXml(writer, security); writer.flush(); return sig; }
void writePublicInfo(Vector publicInfo) { String publicKey = (String) publicInfo.get(0); String sig = (String) publicInfo.get(1); verifyPublicInfo(publicKey, sig); File outputFile = new File(outputFileName); try { UnicodeWriter writer = new UnicodeWriter(outputFile); MartusUtilities.writeServerPublicKey(writer, publicKey, sig); writer.close(); } catch (IOException e) { e.printStackTrace(); System.out.println("Error writing output file"); System.exit(3); } }
private void writeAccountDirectoryIdentificationFile(File accountDirectory, String accountId) throws Exception { String publicCode = MartusSecurity.computeFormattedPublicCode(accountId); File metadataDirectory = new File(accountDirectory, "metadata"); metadataDirectory.mkdirs(); File identificationFile = new File(metadataDirectory, "acct-" + publicCode + ".txt"); UnicodeWriter writer = new UnicodeWriter(identificationFile); try { writer.writeln(accountId); } finally { writer.close(); } MartusServerUtilities.createSignatureFileFromFileOnServer(identificationFile, security); }