feat: v 0.5.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package me.hatter.tools.tinyencrypt.config;
|
||||
|
||||
public class TinyEncryptConstant {
|
||||
public static final String VERSION = "0.5.1";
|
||||
public static final String VERSION = "0.5.2";
|
||||
|
||||
public static final String ENC_FILE_EXT = ".tinyenc";
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TinyEncryptMetaUtil {
|
||||
}
|
||||
Optional<byte[]> keyOpt = CardCliUtil.getChall(config.getCardCli(), config.getLocalPrivateKeyPemChallenge());
|
||||
if (!keyOpt.isPresent()) {
|
||||
throw new JumpOutException();
|
||||
throw new JumpOutException("Get challenge failed!");
|
||||
}
|
||||
byte[] key = keyOpt.get();
|
||||
String localPrivateKeyPem = AESCryptTool.gcmDecrypt(key)
|
||||
|
||||
@@ -37,7 +37,8 @@ public class CardCliUtil {
|
||||
log.info("Start: " + cardCli);
|
||||
|
||||
Optional<String> outputsOpt = runProcess(pb);
|
||||
if (!outputsOpt.isPresent()) {
|
||||
|
||||
if ((!outputsOpt.isPresent()) || outputsOpt.get().trim().isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
JSONObject jo = JSON.parseObject(outputsOpt.get());
|
||||
@@ -65,13 +66,23 @@ public class CardCliUtil {
|
||||
try {
|
||||
log.debug("Start process: " + pb.command());
|
||||
p = pb.start();
|
||||
p.waitFor();
|
||||
log.info("Finished command");
|
||||
int ret = p.waitFor();
|
||||
if (ret == 0) {
|
||||
log.info("Finished command, ret code: " + ret);
|
||||
} else {
|
||||
log.warn("Finished command, ret code: " + ret);
|
||||
}
|
||||
|
||||
if (log.isDebugEnable()) {
|
||||
byte[] errorBytes = IOUtil.readToBytes(p.getErrorStream());
|
||||
String errorOutputs = new String(errorBytes, StandardCharsets.UTF_8);
|
||||
log.debug("Read cmd error outputs: [[[~" + errorOutputs + "~]]]");
|
||||
}
|
||||
|
||||
byte[] jsonBytes = IOUtil.readToBytes(p.getInputStream());
|
||||
String outputs = new String(jsonBytes, StandardCharsets.UTF_8);
|
||||
if (log.isDebugEnable()) {
|
||||
log.debug("Read cmd outputs: " + outputs);
|
||||
log.debug("Read cmd outputs: [[[~" + outputs + "~]]]");
|
||||
}
|
||||
return Optional.of(outputs);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user