private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes) throws IOException { try (ByteBufferOutputStream out = new ByteBufferOutputStream(); PrintWriter ps = IO.writer(out)) { ps.print("Signature-Version: 1.0\r\n"); for (int a = 0; a < algorithms.length; a++) { if (algorithms[a] != null) { byte[] digest = algorithms[a].digest(manbytes); ps.print(digestNames[a] + "-Digest-Manifest: "); ps.print(new Base64(digest)); ps.print("\r\n"); } } ps.flush(); return out.toByteArray(); } }
private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes) throws IOException { try (ByteBufferOutputStream out = new ByteBufferOutputStream(); PrintWriter ps = IO.writer(out)) { ps.print("Signature-Version: 1.0\r\n"); for (int a = 0; a < algorithms.length; a++) { if (algorithms[a] != null) { byte[] digest = algorithms[a].digest(manbytes); ps.print(digestNames[a] + "-Digest-Manifest: "); ps.print(new Base64(digest)); ps.print("\r\n"); } } ps.flush(); return out.toByteArray(); } }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
doManifest(jar, digestNames, digestAlgorithms, o); o.flush(); byte newManifestBytes[] = o.toByteArray(); jar.putResource("META-INF/MANIFEST.MF", new EmbeddedResource(newManifestBytes, 0L)); jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream.toByteArray(), 0L));
doManifest(jar, digestNames, digestAlgorithms, o); o.flush(); byte newManifestBytes[] = o.toByteArray(); jar.putResource("META-INF/MANIFEST.MF", new EmbeddedResource(newManifestBytes, 0L)); jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream.toByteArray(), 0L));
byte[] data = bout.toByteArray(); return data;
byte[] data = bout.toByteArray(); return data;