mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
fix asn1 parsing of dates
This commit is contained in:
parent
1cc19c3429
commit
69e43b362e
1 changed files with 13 additions and 5 deletions
|
@ -123,12 +123,20 @@ static void asn1_tag_dump_str_time(const struct tlv *tlv, const struct asn1_tag
|
||||||
if (len > 4) {
|
if (len > 4) {
|
||||||
PrintAndLogEx(NORMAL, " value: '" NOLF);
|
PrintAndLogEx(NORMAL, " value: '" NOLF);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
// year
|
// year
|
||||||
if (longyear == false)
|
if (longyear == false) {
|
||||||
PrintAndLogEx(NORMAL, "20" NOLF);
|
int short_year = (tlv->value[0] - '0') * 10 + (tlv->value[1] - '0');
|
||||||
|
if (short_year >= 0 && short_year <= 99) {
|
||||||
|
if (short_year > 50) {
|
||||||
|
PrintAndLogEx(NORMAL, "19" NOLF);
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(NORMAL, "20" NOLF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "%.*s-" NOLF, startidx, tlv->value);
|
PrintAndLogEx(NORMAL, "%.*s-" NOLF, startidx, tlv->value);
|
||||||
|
|
||||||
if (len < startidx + 2)
|
if (len < startidx + 2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -154,11 +162,11 @@ static void asn1_tag_dump_str_time(const struct tlv *tlv, const struct asn1_tag
|
||||||
|
|
||||||
// sec
|
// sec
|
||||||
PrintAndLogEx(NORMAL, "%.*s" NOLF, 2, tlv->value + startidx + 8);
|
PrintAndLogEx(NORMAL, "%.*s" NOLF, 2, tlv->value + startidx + 8);
|
||||||
if (len < startidx + 11)
|
if (len < startidx + 12)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// time zone
|
// time zone
|
||||||
PrintAndLogEx(NORMAL, " zone: %.*s" NOLF, len - 10 - (longyear ? 4 : 2), tlv->value + startidx + 10);
|
PrintAndLogEx(NORMAL, " zone: %.*s" NOLF, len - startidx - 10, tlv->value + startidx + 10);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "'");
|
PrintAndLogEx(NORMAL, "'");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue