Skip to content

Add Build EMV TLV operation #23

@J8k3

Description

@J8k3

Summary

Companion to Parse EMV TLV (closed in #11). A Build EMV TLV operation would accept structured tag-value input and emit BER-TLV encoded hex — completing the round-trip.

Use cases

  • Constructing DE 55 payloads for test harnesses or ISO 8583 message simulation
  • Editing a parsed TLV structure: parse → modify values → re-encode
  • Building GPO responses, READ RECORD data, or other ICC response templates for issuer-side or terminal emulation work

Proposed operation: Build EMV TLV

Input: JSON array of tag-value objects, e.g.:

[
  { "tag": "9F26", "value": "A1B2C3D4E5F60708" },
  { "tag": "9F36", "value": "0001" },
  { "tag": "77", "children": [
    { "tag": "82", "value": "5900" },
    { "tag": "94", "value": "08010401" }
  ]}
]

Output: BER-TLV hex — suitable for piping into Parse EMV TLV for round-trip verification.

Arguments:

  • Output format: Hex | Annotated (human-readable with tag names from the dictionary)

Notes

  • Constructed/primitive bit should be inferred from the EMV tag dictionary (same dict used by Parse EMV TLV), with a fallback based on whether a children key is present
  • Tag lengths should be computed automatically from the value length
  • The JSON input format should round-trip cleanly with the JSON output of Parse EMV TLV
  • Lower priority than the parse direction — acquirer flows primarily receive and parse TLV rather than construct it; most valuable for issuer simulation and test tooling

Module

Payment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions