Simplify importing S/MIME certificates

This commit is contained in:
M66B
2021-10-28 07:35:26 +02:00
parent 76d833be02
commit 0136bfe0a5
2 changed files with 80 additions and 2 deletions

View File

@@ -1653,6 +1653,14 @@ public class Helper {
}
}
static byte[] readBytes(InputStream is) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream(Math.max(BUFFER_SIZE, is.available()));
byte[] buffer = new byte[BUFFER_SIZE];
for (int len = is.read(buffer); len != -1; len = is.read(buffer))
os.write(buffer, 0, len);
return os.toByteArray();
}
static void copy(File src, File dst) throws IOException {
try (InputStream is = new FileInputStream(src)) {
try (OutputStream os = new FileOutputStream(dst)) {