use of aQute.lib.base64.Base64 in project bnd by bndtools.
the class Signer method doManifest.
private void doManifest(Jar jar, String[] digestNames, MessageDigest[] algorithms, OutputStream out) throws Exception {
Writer w = IO.writer(out, UTF_8);
try {
for (Map.Entry<String, Resource> entry : jar.getResources().entrySet()) {
String name = entry.getKey();
if (!METAINFDIR.matcher(name).matches()) {
w.write("\r\n");
w.write("Name: ");
w.write(name);
w.write("\r\n");
digest(algorithms, entry.getValue());
for (int a = 0; a < algorithms.length; a++) {
if (algorithms[a] != null) {
byte[] digest = algorithms[a].digest();
String header = digestNames[a] + "-Digest: " + new Base64(digest) + "\r\n";
w.write(header);
}
}
}
}
} finally {
w.flush();
}
}
use of aQute.lib.base64.Base64 in project bnd by bndtools.
the class Signer method doSignatureFile.
private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
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");
}
}
return out.toByteArray();
}
Aggregations