hash & sm4 & cert(未测试)

This commit is contained in:
ghy committed 2021-03-05 20:02:38 +08:00
1 parent e515af4123
commit 3868d65fae
26 files changed
+1873 -15

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package util;
import java.io.IOException;
import java.io.RandomAccessFile;
public class FileUtil {
public static void writeFile(String filePath, byte[] data) throws IOException {
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(filePath, "rw");
raf.write(data);
} finally {
if (raf != null) {
raf.close();
}
}
}
public static byte[] readFile(String filePath) throws IOException {
RandomAccessFile raf = null;
byte[] data;
try {
raf = new RandomAccessFile(filePath, "r");
data = new byte[(int) raf.length()];
raf.read(data);
return data;
} finally {
if (raf != null) {
raf.close();
}
}
}
}