mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
only look if no key is applied
This commit is contained in:
parent
0073fc1a71
commit
fad29cb755
1 changed files with 33 additions and 22 deletions
|
@ -940,22 +940,27 @@ static int CmdHFiClassDecrypt(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verbose = arg_get_lit(clictx, 4);
|
bool verbose = arg_get_lit(clictx, 4);
|
||||||
|
|
||||||
CLIParserFree(clictx);
|
CLIParserFree(clictx);
|
||||||
|
|
||||||
size_t keylen = 0;
|
|
||||||
uint8_t dec_data[8] = {0};
|
uint8_t dec_data[8] = {0};
|
||||||
|
bool use_sc = false;
|
||||||
|
if (have_key == false) {
|
||||||
|
use_sc = IsCryptoHelperPresent(verbose);
|
||||||
|
if (use_sc == false) {
|
||||||
|
size_t keylen = 0;
|
||||||
|
int res = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr, &keylen);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(INFO, "Couldn't find any decryption methods");
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
|
|
||||||
bool use_sc = IsCryptoHelperPresent(verbose);
|
if (keylen != 16) {
|
||||||
|
PrintAndLogEx(ERR, "Failed to load transport key from file");
|
||||||
if (have_key == false && use_sc == false) {
|
return PM3_EINVARG;
|
||||||
int res = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr, &keylen);
|
}
|
||||||
if (res != PM3_SUCCESS) {
|
memcpy(key, keyptr, sizeof(key));
|
||||||
PrintAndLogEx(INFO, "Couldn't find any decryption methods");
|
free(keyptr);
|
||||||
return PM3_EINVARG;
|
|
||||||
}
|
}
|
||||||
memcpy(key, keyptr, sizeof(key));
|
|
||||||
free(keyptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tripledes
|
// tripledes
|
||||||
|
@ -1157,18 +1162,24 @@ static int CmdHFiClassEncryptBlk(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserFree(clictx);
|
CLIParserFree(clictx);
|
||||||
|
|
||||||
bool use_sc = IsCryptoHelperPresent(verbose);
|
bool use_sc = false;
|
||||||
|
if (have_key == false) {
|
||||||
|
use_sc = IsCryptoHelperPresent(verbose);
|
||||||
|
if (use_sc == false) {
|
||||||
|
size_t keylen = 0;
|
||||||
|
int res = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr, &keylen);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(ERR, "Failed to find any encryption methods");
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (have_key == false && use_sc == false) {
|
if (keylen != 16) {
|
||||||
size_t keylen = 0;
|
PrintAndLogEx(ERR, "Failed to load transport key from file");
|
||||||
int res = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr, &keylen);
|
return PM3_EINVARG;
|
||||||
if (res != PM3_SUCCESS) {
|
}
|
||||||
PrintAndLogEx(ERR, "Failed to find the transport key");
|
memcpy(key, keyptr, sizeof(key));
|
||||||
return PM3_EINVARG;
|
free(keyptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(key, keyptr, sizeof(key));
|
|
||||||
free(keyptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_sc) {
|
if (use_sc) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue