This commit is contained in:
liulu
2024-12-10 11:10:05 +08:00
parent 29c5fb261f
commit aabc9c56e1
4 changed files with 12 additions and 5 deletions
@@ -151,6 +151,7 @@ public class TmkService {
}
res.setStatus(DeviceTmkStatus.finished);
} else {
log.debug("tmk not init, start encrypt and import test ...");
byte[] random = sdfApi.generateRandom(hs, 16);
EccCipher eccCipher = sdfApi.externalEncryptECC(hs, pubKey, random);
String hk = sdfApi.importKeyWithISKECC(hs, check.getEncKeyIdx(), eccCipher);
@@ -177,7 +178,9 @@ public class TmkService {
device.setServiceIp("127.0.0.1");
device.setServicePort(8889);
device.setAccessCredentials("543");
device.setEncTmk(CodecUtils.encodeHex(getSoftDeviceEncTmk()));
if (isTmkInit()) {
device.setEncTmk(CodecUtils.encodeHex(getSoftDeviceEncTmk()));
}
return device;
}