mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
use printandlogex
This commit is contained in:
parent
3fdac2577f
commit
53b48ae6a9
1 changed files with 13 additions and 13 deletions
|
@ -163,16 +163,16 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("----------- CBOR decode ----------------");
|
PrintAndLogEx(NORMAL, "----------- CBOR decode ----------------");
|
||||||
|
|
||||||
// kty
|
// kty
|
||||||
int res = CborMapGetKeyById(&parser, &map, data, datalen, 1);
|
int res = CborMapGetKeyById(&parser, &map, data, datalen, 1);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
cbor_value_get_int64(&map, &i64);
|
cbor_value_get_int64(&map, &i64);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("kty [%lld] %s", (long long)i64, GetCOSEktyDescription(i64));
|
PrintAndLogEx(SUCCESS, "kty [%lld] %s", (long long)i64, GetCOSEktyDescription(i64));
|
||||||
if (i64 != 2)
|
if (i64 != 2)
|
||||||
PrintAndLog("ERROR: kty must be 2.");
|
PrintAndLogEx(ERR, "ERROR: kty must be 2.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// algorithm
|
// algorithm
|
||||||
|
@ -180,9 +180,9 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
if (!res) {
|
if (!res) {
|
||||||
cbor_value_get_int64(&map, &i64);
|
cbor_value_get_int64(&map, &i64);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("algorithm [%lld] %s", (long long)i64, GetCOSEAlgDescription(i64));
|
PrintAndLogEx(SUCCESS, "algorithm [%lld] %s", (long long)i64, GetCOSEAlgDescription(i64));
|
||||||
if (i64 != -7)
|
if (i64 != -7)
|
||||||
PrintAndLog("ERROR: algorithm must be -7.");
|
PrintAndLogEx(ERR, "ERROR: algorithm must be -7.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// curve
|
// curve
|
||||||
|
@ -190,9 +190,9 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
if (!res) {
|
if (!res) {
|
||||||
cbor_value_get_int64(&map, &i64);
|
cbor_value_get_int64(&map, &i64);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("curve [%lld] %s", (long long)i64, GetCOSECurveDescription(i64));
|
PrintAndLogEx(SUCCESS, "curve [%lld] %s", (long long)i64, GetCOSECurveDescription(i64));
|
||||||
if (i64 != 1)
|
if (i64 != 1)
|
||||||
PrintAndLog("ERROR: curve must be 1.");
|
PrintAndLogEx(ERR, "ERROR: curve must be 1.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// plain key
|
// plain key
|
||||||
|
@ -204,9 +204,9 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
res = CborGetBinStringValue(&map, &public_key[1], 32, &len);
|
res = CborGetBinStringValue(&map, &public_key[1], 32, &len);
|
||||||
cbor_check(res);
|
cbor_check(res);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("x - coordinate [%d]: %s", len, sprint_hex(&public_key[1], 32));
|
PrintAndLogEx(SUCCESS, "x - coordinate [%d]: %s", len, sprint_hex(&public_key[1], 32));
|
||||||
if (len != 32)
|
if (len != 32)
|
||||||
PrintAndLog("ERROR: x - coordinate length must be 32.");
|
PrintAndLogEx(ERR, "ERROR: x - coordinate length must be 32.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// y - coordinate
|
// y - coordinate
|
||||||
|
@ -215,9 +215,9 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
res = CborGetBinStringValue(&map, &public_key[33], 32, &len);
|
res = CborGetBinStringValue(&map, &public_key[33], 32, &len);
|
||||||
cbor_check(res);
|
cbor_check(res);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("y - coordinate [%d]: %s", len, sprint_hex(&public_key[33], 32));
|
PrintAndLogEx(SUCCESS, "y - coordinate [%d]: %s", len, sprint_hex(&public_key[33], 32));
|
||||||
if (len != 32)
|
if (len != 32)
|
||||||
PrintAndLog("ERROR: y - coordinate length must be 32.");
|
PrintAndLogEx(ERR, "ERROR: y - coordinate length must be 32.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// d - private key
|
// d - private key
|
||||||
|
@ -227,11 +227,11 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
|
||||||
res = CborGetBinStringValue(&map, private_key, sizeof(private_key), &len);
|
res = CborGetBinStringValue(&map, private_key, sizeof(private_key), &len);
|
||||||
cbor_check(res);
|
cbor_check(res);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("d - private key [%d]: %s", len, sprint_hex(private_key, len));
|
PrintAndLogEx(SUCCESS, "d - private key [%d]: %s", len, sprint_hex(private_key, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("----------- CBOR decode ----------------");
|
PrintAndLogEx(NORMAL, "----------- CBOR decode ----------------");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue