Skip to content

Payment ops: testing gaps #12

@J8k3

Description

@J8k3

Payment operations currently have one or two deterministic happy-path vectors per op. The gaps below represent known areas where coverage is thin, vectors are unverified, or entire test categories are missing.

1. No independent vector verification for Vendor-aligned ops

Most payment operations are classified Vendor-aligned (see PAYMENT_RECIPES.md Validation Status). Their test vectors pass internal round-trip consistency but have not been validated against independent HSM output or a second reference implementation. Highest-risk ops:

  • AS2805 Generate KEK Validation — Test helper; no known-good external reference
  • EMV Generate ARPC — no independent cross-check documented
  • DUKPT Derive TDES Key — documented as Externally cross-checked but the external source and exact vectors are not recorded

2. No edge-case or error-path tests

Current vectors are all valid, well-formed inputs. Missing tests for:

  • Wrong key length (e.g. 15-byte key where 16 is required)
  • Mismatched format/PAN (Format 0 with missing PAN, Format 1 with PAN supplied)
  • Non-hex input where hex is required
  • Empty input
  • KSN shorter than expected

3. PIN block formats 1 and 3 not deterministically covered

Format 0 has a solid deterministic vector. Formats 1 and 3 use randomized fill by default, so they can only be tested deterministically with randomizeFill=false. No test currently exercises these formats with randomizeFill=false.

4. No recipe chain integration tests

No test exercises a full Generate → Verify chain end-to-end (e.g. VISA PVV Generate output piped into VISA PVV Verify). The input/arg swap work done in this fork makes chaining the expected user pattern, but the test suite doesn't verify it.

5. HSM parse ops use only synthetic inputs

HSM Parse Thales Command and HSM Parse Futurex Command tests use hand-crafted hex/ASCII strings, not real captured HSM command/response samples. Real command samples would catch field-offset or framing bugs that synthetic inputs would miss.

6. TR-34 parse uses a minimal synthetic frame

The TR-34 Parse Key Transport test uses a 24-byte synthetic B9 frame. A real B9 envelope from an actual TR-34 key exchange would exercise the ASN.1 CMS parsing path more completely.

7. AES DUKPT derivation lacks a published test vector

DUKPT Derive AES Key (ANSI X9.24-3) was implemented against AWS semantics. ANSI X9.24-3 test vectors exist in the standard appendix; confirming at least one matches would upgrade this from Vendor-aligned to Verified.

Suggested priority order

  1. Formats 1 and 3 deterministic PIN block tests (low effort, clear gap)
  2. AES DUKPT known-vector cross-check (moderate effort, highest value for correctness confidence)
  3. Edge-case / error-path tests for input validation (moderate effort)
  4. Generate → Verify chain tests for PVV, IBM 3624, ARQC (low effort once chain is confirmed working)
  5. Real HSM command samples for Thales/Futurex parsers (requires sample capture, deferred)

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