mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
refactoring: move defparams.json to tag-name-value structure
This commit is contained in:
parent
ef7fc4f793
commit
4df0548513
2 changed files with 15 additions and 15 deletions
|
@ -1,56 +1,56 @@
|
|||
[
|
||||
{
|
||||
"name": "Transaction Date",
|
||||
"type": "9A",
|
||||
"tag": "9A",
|
||||
"value": "00 00 00",
|
||||
"length": 3,
|
||||
"hint": "format: YYMMDD"
|
||||
},
|
||||
{
|
||||
"name": "Transaction Type",
|
||||
"type": "9C",
|
||||
"tag": "9C",
|
||||
"value": "00",
|
||||
"length": 1,
|
||||
"hint": "00: Goods and service, 01: Cash"
|
||||
},
|
||||
{
|
||||
"name": "Amount, authorized",
|
||||
"type": "9F 02",
|
||||
"tag": "9F 02",
|
||||
"value": "00 00 00 00 01 00",
|
||||
"length": 6,
|
||||
"hint": "amount (numberic) in cents"
|
||||
},
|
||||
{
|
||||
"name": "Transaction Currency Code",
|
||||
"type": "5F 2A",
|
||||
"tag": "5F 2A",
|
||||
"value": "09 80",
|
||||
"length": 2,
|
||||
"hint": "USD 840, EUR 978, RUB 643, RUR 810(old), UAH 980, AZN 031, n/a 999"
|
||||
},
|
||||
{
|
||||
"name": "Terminal Country Code",
|
||||
"type": "9F 1A",
|
||||
"tag": "9F 1A",
|
||||
"value": "72 75",
|
||||
"length": 2,
|
||||
"hint": "ISO3166: de, en (65 6e), uk(75 6b), ru (72 75), us, ua"
|
||||
},
|
||||
{
|
||||
"name": "Terminal Transaction Qualifiers (TTQ)",
|
||||
"type": "9F 66",
|
||||
"tag": "9F 66",
|
||||
"value": "26 00 00 00",
|
||||
"length": 4,
|
||||
"hint": "qVSDC 26 00 00 00, gen AC from GPO 26 80 00 00, MSD 86 00 00 00, VSDC 46 00 00 00"
|
||||
},
|
||||
{
|
||||
"name": "Unpredictable Number",
|
||||
"type": "9F 37",
|
||||
"tag": "9F 37",
|
||||
"value": "01 02 03 04",
|
||||
"length": 4,
|
||||
"hint": "4 byte random number"
|
||||
},
|
||||
{
|
||||
"name": "Unpredictable Number (MSD for UDOL)",
|
||||
"type": "9F 6A",
|
||||
"tag": "9F 6A",
|
||||
"value": "01 02 03 05",
|
||||
"length": 4,
|
||||
"hint": "4 byte random number"
|
||||
|
|
|
@ -270,7 +270,7 @@ bool ParamLoadFromJson(struct tlvdb *tlv) {
|
|||
PrintAndLog("Load params: json OK");
|
||||
|
||||
for(int i = 0; i < json_array_size(root); i++) {
|
||||
json_t *data, *jtype, *jlength, *jvalue;
|
||||
json_t *data, *jtag, *jlength, *jvalue;
|
||||
|
||||
data = json_array_get(root, i);
|
||||
if(!json_is_object(data))
|
||||
|
@ -280,14 +280,14 @@ bool ParamLoadFromJson(struct tlvdb *tlv) {
|
|||
return false;
|
||||
}
|
||||
|
||||
jtype = json_object_get(data, "type");
|
||||
if(!json_is_string(jtype))
|
||||
jtag = json_object_get(data, "tag");
|
||||
if(!json_is_string(jtag))
|
||||
{
|
||||
PrintAndLog("Load params: data [%d] type is not a string", i + 1);
|
||||
PrintAndLog("Load params: data [%d] tag is not a string", i + 1);
|
||||
json_decref(root);
|
||||
return false;
|
||||
}
|
||||
const char *tlvType = json_string_value(jtype);
|
||||
const char *tlvTag = json_string_value(jtag);
|
||||
|
||||
jvalue = json_object_get(data, "value");
|
||||
if(!json_is_string(jvalue))
|
||||
|
@ -313,12 +313,12 @@ bool ParamLoadFromJson(struct tlvdb *tlv) {
|
|||
return false;
|
||||
}
|
||||
|
||||
PrintAndLog("TLV param: %s[%d]=%s", tlvType, tlvLength, tlvValue);
|
||||
PrintAndLog("TLV param: %s[%d]=%s", tlvTag, tlvLength, tlvValue);
|
||||
uint8_t buf[251] = {0};
|
||||
size_t buflen = 0;
|
||||
|
||||
// here max length must be 4, but now tlv_tag_t is 2-byte var. so let it be 2 by now... TODO: needs refactoring tlv_tag_t...
|
||||
if (!HexToBuffer("TLV Error type:", tlvType, buf, 2, &buflen)) {
|
||||
if (!HexToBuffer("TLV Error type:", tlvTag, buf, 2, &buflen)) {
|
||||
json_decref(root);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue