4390 Commits

Author SHA1 Message Date
J8k3
0da4c99a0c Fix PAN generation: random prefix within range, Mastercard series option
Two bugs in generateBrandPan:
1. For networks with multiple prefix rules, always picked the same rule
   (Mastercard always 2-series, AmEx always 37, Discover always 6011)
2. Always used the start of the range as the prefix, so Mastercard
   generated 51xxxxx or 2221xxxxxx every time instead of any value
   in 51-55 or 2221-2720

Fix both: pick a random prefix rule and a random prefix within start..end.

Add a "Mastercard series" arg to PAN Generate so callers can explicitly
request 5-series (51-55), 2-series (2221-2720), or leave it random.
The curated sample path is unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 14:18:22 -04:00
J8k3
eba7e37185 Fix TR-31/TR-34 op names and sort Payments category alphabetically
Rename two ops to follow the domain-prefix-first convention:
  "Parse TR-31 Key Block"    -> "TR-31 Parse Key Block"
  "Parse TR-34 Key Transport" -> "TR-34 Parse Key Transport"

Sort all 33 Payments category entries alphabetically in Categories.json.
With domain-prefix names the prefixes cluster related ops naturally, so
alphabetical order is also logical order.

Update PAYMENT_RECIPES.md UI Arrangement section to document alphabetical
ordering. Fix stale lowercase references in AWS_PAYMENT_CRYPTOGRAPHY_RECIPES.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 14:11:06 -04:00
J8k3
c6d530348e Document generated config files in Payment Operation Maintenance
After the op-rename batch, the runtime threw 'f[e.module][e.name] is not
a constructor' for every renamed op because Payment.mjs and index.mjs are
gitignored generated files that were never regenerated after this.name
was updated.

Add a rule to AGENTS.md step 6 naming the three generated files, the
symptom of a stale registry, and the two-command fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 12:35:41 -04:00
J8k3
fc6ac7806e Improve testDataSamples: random placeholders and recipeConfig chains
Replace six static inputs that held hardcoded keys or PINs with the
appropriate __RANDOM_*__ placeholder so the populate button delivers a
fresh value each time rather than a fixed test vector:
  - PIN Data Generate, IBM 3624 Generate PIN Offset, VISA PVV Generate
    → __RANDOM_PIN_4__
  - DUKPT Derive TDES Key, AS2805 Generate KEK Validation
    → __RANDOM_TDES_16_HEX__
  - DUKPT Derive AES Key → __RANDOM_AES_128_HEX__

Add a recipeConfig chain sample to two ops where the output of
Key Generate flows directly into the next op as input:
  - Card Validation Data Generate: Key Generate → Card Validation Data Generate
  - Payment Calculate KCV: Key Generate → Payment Calculate KCV

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 10:01:31 -04:00
J8k3
634c835dfd Rename payment ops to domain-prefix-first; remove upstream ops from Payments category
All 31 payment operation display names now lead with their domain prefix
(EMV, DUKPT, PIN Block, PAN, etc.) so they sort and scan by topic in the
UI list. 8 upstream CyberChef ops (AES Encrypt/Decrypt, Triple DES,
AES Key Wrap/Unwrap, HMAC, CMAC) removed from the Payments category.

Updated: op this.name fields, Categories.json, Payment.mjs tests,
PAYMENT_RECIPES.md, AWS_PAYMENT_CRYPTOGRAPHY_RECIPES.md, AGENTS.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 09:29:52 -04:00
github-actions[bot]
32ef373485 Merge remote-tracking branch 'upstream/master' 2026-05-18 09:37:11 +00:00
J8k3
f246a7dcf9 Rename Derive DUKPT Key to Derive DUKPT TDES Key
Mirrors the naming convention of Derive DUKPT AES Key.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 21:56:03 -04:00
Jacob Marks
01f396d121 Fix #4: delete TranslatePaymentPINData (duplicate of TranslatePINBlock) 2026-05-17 20:34:52 -04:00
Jacob Marks
0aadfb94e3 Fix GenerateTestPAN: random fills, suppress cardType when unknown 2026-05-17 13:33:28 -04:00
Jacob Marks
c405326f03 Fix 3 test assertions: TR-31 compliance fields, PAN card-type fields 2026-05-17 08:24:13 -04:00
Jacob Marks
cd4442cc62 Fix 3 test assertions: TR-31 compliance fields, PAN card-type fields 2026-05-17 08:23:10 -04:00
Jacob Marks
6fc1c26b24 Fix Payment.mjs: correct 4 op names (payShield/Futurex uppercase C, TR-31 Key Block, TR-34 Key Transport) and TR-34 expected output 2026-05-17 08:16:56 -04:00
Jacob Marks
43d8a03a5b Fix Categories.json: add new ops, fix renamed op names, move ECDH to Ciphers 2026-05-16 23:42:29 -04:00
Jacob Marks
7081361db7 Fix Pan.mjs: add missing trailing newline (eol-last) 2026-05-16 23:38:20 -04:00
Jacob Marks
35e2f0a2d8 Fix ParseTR31KeyBlock lint: add constructor JSDoc 2026-05-16 23:35:52 -04:00
Jacob Marks
6bbafe7ff3 Fix ParseTR34B9Envelope lint: JSDoc on parseAsnLength, hexStr, constructor 2026-05-16 23:35:31 -04:00
Jacob Marks
0dda2fe08a Fix GenerateKey lint: JSDoc on helper functions and constructor 2026-05-16 23:35:27 -04:00
Jacob Marks
7a4b47fa6b Fix DeriveDUKPTAESKey lint: JSDoc on helpers, constructor, dot-notation 2026-05-16 23:35:24 -04:00
Jacob Marks
b2e3100886 Fix DeriveECDHKeyMaterial lint: brace-style, indentation, operator-linebreak, constructor JSDoc 2026-05-16 23:35:21 -04:00
Jacob Marks
718824a42f Fix Pan.mjs: operator-linebreak for cardTypeNote ternary 2026-05-16 23:35:01 -04:00
Jacob Marks
e08d401956 Add DeriveECDHKeyMaterial tests: P-256 raw secret, Concat KDF SHA-256, missing key error 2026-05-16 23:24:20 -04:00
Jacob Marks
550d0b7ec6 Fix DeriveECDHKeyMaterial: real test vectors, None KDF fix, P-521 comment, module=Ciphers 2026-05-16 23:21:51 -04:00
Jacob Marks
89e39a8642 Move DeriveECDHKeyMaterial from Payment to Ciphers module 2026-05-16 23:08:39 -04:00
Jacob Marks
2a5b1deb2e Add Payment Operation Maintenance rules to AGENTS.md 2026-05-16 23:04:55 -04:00
Jacob Marks
5e473899ea Update PAYMENT_RECIPES.md: fix stale names, add new operations, naming convention section 2026-05-16 23:04:54 -04:00
Jacob Marks
c32be5a5c5 Capitalise display name: "Parse TR-34 Key Transport" 2026-05-16 23:02:54 -04:00
Jacob Marks
ff90e41269 Capitalise display name: "Parse TR-31 Key Block" 2026-05-16 23:02:52 -04:00
Jacob Marks
c268dd3a1e Capitalise display name: "Parse Futurex Excrypt Command" 2026-05-16 23:02:51 -04:00
Jacob Marks
e19bfacd4d Capitalise display name: "Parse Thales payShield Command" 2026-05-16 23:02:49 -04:00
Jacob Marks
517a56e826 Add card type classification and MII description to parsePan 2026-05-16 22:50:41 -04:00
Jacob Marks
062b60e0c6 Revert "Encode PIN Block" back to "Build PIN Block" 2026-05-16 22:50:03 -04:00
Jacob Marks
340db6122d Revert "Decode PIN Block" back to "Parse PIN Block" 2026-05-16 22:49:53 -04:00
Jacob Marks
9590eccd41 Rename "Build PIN Block" to "Encode PIN Block" 2026-05-16 22:48:35 -04:00
Jacob Marks
91d8d0ec37 Rename "Parse PIN Block" to "Decode PIN Block" 2026-05-16 22:48:21 -04:00
Jacob Marks
dd7a26aa1f Broaden ParseTR34B9Envelope to TR-34 key transport: message type table, error codes, ASN.1 envelope peek 2026-05-16 22:45:40 -04:00
Jacob Marks
cf3023bc82 Add GenerateKey operation for random payment keys and IVs 2026-05-16 22:45:30 -04:00
Jacob Marks
4451ddbee3 Enhance ParseTR31KeyBlock with full X9.143 field decoding and compliance checks 2026-05-16 22:45:22 -04:00
Jacob Marks
9207d79356 Add Derive DUKPT AES Key operation (ANSI X9.24-3 AES-128) 2026-05-16 22:37:36 -04:00
J8k3
46228977d6 Update repo agent guidance 2026-05-16 10:39:46 -04:00
J8k3
17c004a66b Add Futurex Excrypt command parser 2026-05-16 10:38:09 -04:00
J8k3
5cc38496bd Allow overriding test timeout 2026-05-16 10:21:26 -04:00
J8k3
1aa54684d8 Add Thales payShield command parser 2026-05-16 10:18:33 -04:00
J8k3
9e9904870c Update payment metadata and restore Docker test baseline 2026-05-16 09:26:39 -04:00
J8k3
b76a0e99be Update README to reflect current payment extension scope
- Fix operations path: payment-crypto/ subdirectory never existed; ops live in src/core/operations/
- Fix UI category name: "Payment Cryptography" -> "Payments"
- Replace stale future-extensions list with accurate current coverage (DUKPT, PIN blocks, MAC/KCV, EMV, card validation, PAN tools all implemented)
- Keep only genuine remaining future work: TR-31 KBPK decryption and AES DUKPT

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:25:49 -04:00
dependabot[bot]
9803553b61
chore (deps): bump @codemirror/view from 6.41.1 to 6.43.0 (#2384)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-16 11:08:49 +01:00
dependabot[bot]
8f9a01ef33
chore (deps): bump globals from 17.5.0 to 17.6.0 (#2386)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-16 10:39:19 +01:00
dependabot[bot]
ebeb4f7d6a
chore (deps): bump the patch-updates group across 1 directory with 3 updates (#2388)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-16 10:34:24 +01:00
GCHQDeveloper581
0bb5472e50
[StepSecurity] Apply security best practices (#2378)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Co-authored-by: StepSecurity Bot <bot@stepsecurity.io>
2026-05-14 14:59:07 +01:00
GCHQDeveloper581
3471731aaf
Build docker container for arm v7 as well (#2379) 2026-05-14 13:51:58 +01:00
Jacob Marks
e1b5ae50b4
Merge pull request #1 from J8k3/J8k3-patch-1
Revise README for CyberChef Payments updates
2026-05-12 15:27:04 -04:00