Tools

    AFL decoder and static data builder

    Decode the AFL, list the records the terminal reads and build the static data to authenticate.

    • Runs in your browser
    • No sign-up

    Input

    80 … (format 1) or 77 … (format 2), SW 9000 optional.
    An AFL whose first entry is SFI 16 starts with 80, like a format 1 response; choose "AFL only" for it.
    A log with the READ RECORD commands (00 B2 …) says which SFI and record each response is.

    Result

    AFL: 3 entries, 4 records read, 2 for offline authentication. Static data assembled: 84 bytes.

    AFL

    format 1 (80) · AIP 3C00 · AFL 08 01 01 00 10 01 02 01 58 01 01 01

    EntryBytesSFIRecordsOffline auth.Check
    108 01 01 0011nonevalid
    210 01 02 0121 to 21 (record 1)valid
    358 01 01 011111 (record 1)valid

    Records the terminal reads

    #SFI / recordREAD RECORDOffline auth.In the inputBytes added
    11 / 100 B2 01 0C 00noAPDU 2, SW 9000-
    22 / 100 B2 01 14 00yesAPDU 4, SW 900063 at offset 0
    SFI 1–10: the 70 tag and its length (703F) are left out
    32 / 200 B2 02 14 00noAPDU 6, SW 9000-
    411 / 100 B2 01 5C 00yesAPDU 8, SW 900019 at offset 63
    SFI 11–30: the whole record, 70 tag and length included

    Tag 9F4A (Static Data Authentication Tag List) = 82, in SFI 2 record 1. The AIP value 3C00 is appended (without tag and length).

    Static data to be authenticated: 84 bytes
    5A0847617390010100105F24032812315F25032401015F280200765F3401018C159F02069F03069F1A0295055F2A029A039C019F37049F0702FF009F4A018270118F01929F3201039F4701039F49039F37043C00
    SHA-1 of the static data alone
    1A347DA29F7C1399BCEF3289D35B698C42D83AF2

    The hash inside the ICC public key certificate (9F46), or inside the signed static application data (93) for SDA, is not this value: other fields are hashed before this static data (for the ICC certificate: its fields, the key remainder and the exponent). The SHA-1 here is for comparing two assemblies of the same records.

    Static data or AFL flagged in a CPV or PVT review? IDNTEQ can help. CPV / PVT preparation and remediation

    About this tool

    Runs in your browser. This page loads no analytics or third-party scripts and does not send what you type.

    Paste the GET PROCESSING OPTIONS response and the READ RECORD responses. The tool decodes the AFL entry by entry, lists the records the terminal reads and the ones used for offline data authentication, and builds the static data to be authenticated byte by byte.

    What the AFL says

    The Application File Locator (tag 94, or the bytes after the AIP in a format 1 response) is a list of 4-byte entries. Byte 1 holds the SFI in bits 8 to 4, with bits 3 to 1 set to 000; byte 2 is the first record number, byte 3 the last, and byte 4 the number of records, starting with the first, that take part in offline data authentication. The terminal reads every record of every entry, in order, with READ RECORD (P1 = record number, P2 = SFI × 8 + 4).

    Each entry is checked: SFI 1 to 30, first record not 0, last record not lower than the first, and an offline authentication count no larger than the number of records in the entry. An entry that fails a check is reported and the static data is not built.

    How the static data is assembled

    The records listed for offline authentication are concatenated in AFL order (EMV Book 3 §10.3). For SFI 1 to 10, the record template tag 70 and its length are left out and only the content goes in. For SFI 11 to 30, the whole record goes in, tag 70 and length included. A record listed for offline authentication that is not a tag 70 template makes offline data authentication fail, and the tool says so instead of building the data.

    If the records contain the Static Data Authentication Tag List (9F4A), it may list only the AIP tag 82; the AIP value from the GPO response is then appended, without tag and length. A 9F4A listing anything else is reported as an error.

    How to use it

    Paste the GPO response (80 … or 77 …, with or without SW 9000) or the AFL alone. Then paste the READ RECORD part of a log: with the commands (00 B2 …) the tool knows the SFI and record of each response, in any order. Without commands, give one record per line in the order the AFL lists them; the count must match. If the log also contains the GPO exchange, the first field can be left empty.

    The result shows the static data, where each record’s bytes start in it, and its SHA-1. To check an ICC public key certificate, paste the static data into the EMV certificate validator, which computes the hash over the certificate fields, the key remainder and exponent, and this data.

    Hash coverage and unused records

    The SHA-1 here differs from the hash in the ICC certificate because the certificate hash covers more than the static data: the certificate fields, the ICC key remainder and the exponent come first. The SHA-1 shown here is for comparing two assemblies of the same records, for example from the terminal’s log and from the personalization data.

    Only the records counted in byte 4 of an AFL entry are part of the static data; the others are read for their data elements but not signed. Records in the log that the AFL does not list are ignored and noted.

    Spec references

    • EMV 4.4 Book 3 §10.2 (Read Application Data, AFL coding)
    • EMV 4.4 Book 3 §10.3 (Offline Data Authentication, static data to be authenticated)
    • EMV 4.4 Book 3 §6.5.8 (GET PROCESSING OPTIONS response formats 1 and 2)
    • EMV 4.4 Book 3 §6.5.11 (READ RECORD)
    • EMV 4.4 Book 2 §5 and §6 (SDA and the ICC public key certificate)

    Verified against

    Specifications
    • EMV 4.4 Book 3 §10.2 (AFL coding), §10.3 (static data to be authenticated), §6.5.8 (GPO response formats), §6.5.11 (READ RECORD)
    Published examples in the tests
    None: no published example with these inputs was found. The checks below are the ones the tests run.
    Other checks in the tests
    • GPO formats 1 and 2, AFL entry checks (SFI 1–30, record 0, first > last, offline count)
    • SFI 1–10 without the 70 header, SFI 11–30 whole, long (81) lengths, 9F4A with the AIP; a non-70 offline record is an error
    • Records in any log order give the same static data (made-up test data)
    Inputs
    A GPO response or a bare AFL, and READ RECORD exchanges or one record per line.
    Not covered
    The SHA-1 shown is of the static data alone, not the certificate hash. Records are not fetched from a card.
    Last reviewed