]>
Commit | Line | Data |
---|---|---|
a2bb2735 | 1 | //----------------------------------------------------------------------------- |
2 | // Copyright (C) 2017 Merlok | |
3 | // | |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, | |
5 | // at your option, any later version. See the LICENSE.txt file for the text of | |
6 | // the license. | |
7 | //----------------------------------------------------------------------------- | |
8 | // EMV core functions | |
9 | //----------------------------------------------------------------------------- | |
10 | ||
11 | #include "emvcore.h" | |
12 | ||
13 | static bool print_cb(void *data, const struct tlv *tlv) { | |
14 | emv_tag_dump(tlv, stdout); | |
15 | dump_buffer(tlv->value, tlv->len, stdout); | |
16 | ||
17 | return true; | |
18 | } | |
19 | ||
20 | void TLVPrintFromBuffer(uint8_t *data, int datalen) { | |
21 | struct tlvdb *t = NULL; | |
22 | t = tlvdb_parse(data, datalen); | |
23 | if (t) { | |
24 | PrintAndLog("TLV decoded:"); | |
25 | ||
26 | tlvdb_visit(t, print_cb, NULL); | |
27 | tlvdb_free(t); | |
28 | } else { | |
29 | PrintAndLog("TLV ERROR: Can't parse response as TLV tree."); | |
30 | } | |
31 | } |