feat: v0.3.6, add .tinyenc check
This commit is contained in:
@@ -199,7 +199,7 @@ public class TinyEncryptMain {
|
|||||||
if ((clearTextFile != null) && clearTextFile.exists()) {
|
if ((clearTextFile != null) && clearTextFile.exists()) {
|
||||||
Bytes clearTextSha256 = RFile.from(clearTextFile).digest(Digests.sha256());
|
Bytes clearTextSha256 = RFile.from(clearTextFile).digest(Digests.sha256());
|
||||||
if (clearTextSha256.equals(sha256)) {
|
if (clearTextSha256.equals(sha256)) {
|
||||||
log.info("Clear text file exists, and matches.");
|
log.info("Clear text file exists, and MATCHES.");
|
||||||
} else {
|
} else {
|
||||||
String nfn = f.toString();
|
String nfn = f.toString();
|
||||||
log.warn(clearTextSha256.asHex() + " - " + nfn.substring(0, nfn.length() - TinyEncryptConstant.ENC_FILE_EXT.length()));
|
log.warn(clearTextSha256.asHex() + " - " + nfn.substring(0, nfn.length() - TinyEncryptConstant.ENC_FILE_EXT.length()));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.hatter.tools.tinyencrypt.config;
|
package me.hatter.tools.tinyencrypt.config;
|
||||||
|
|
||||||
public class TinyEncryptConstant {
|
public class TinyEncryptConstant {
|
||||||
public static final String VERSION = "0.3.5";
|
public static final String VERSION = "0.3.6";
|
||||||
|
|
||||||
public static final String ENC_FILE_EXT = ".tinyenc";
|
public static final String ENC_FILE_EXT = ".tinyenc";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class EncryptedFileUtil {
|
|||||||
private static final LogTool log = LogTools.getLogTool(EncryptedFileUtil.class);
|
private static final LogTool log = LogTools.getLogTool(EncryptedFileUtil.class);
|
||||||
|
|
||||||
public static boolean decryptToOutputStream(TinyEncryptConfig config, File file, OutputStream os) {
|
public static boolean decryptToOutputStream(TinyEncryptConfig config, File file, OutputStream os) {
|
||||||
|
if (getDecryptFile(file) == null) {
|
||||||
|
log.warn("File is not tinyenc file, skip: " + file);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
try (FileInputStream fis = new FileInputStream(file)) {
|
try (FileInputStream fis = new FileInputStream(file)) {
|
||||||
Tlv tlv = TlvUtil.readTlv(fis);
|
Tlv tlv = TlvUtil.readTlv(fis);
|
||||||
|
|||||||
Reference in New Issue
Block a user