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