[ DOCS · MCP ]
KeyLab MCP
A remote Model Context Protocol server. Streamable HTTP, stateless, one bearer token per agent. The tools are the calculator and the bench, exposed with the schema below.
Endpoint and authentication
- Endpoint:
https://keylab.cloud/api/mcp, method POST, JSON-RPC 2.0 over Streamable HTTP. GET and DELETE answer 405: there is no session to open or close. - Header:
Authorization: Bearer klt_…. Create tokens on the MCP page (up to 5 per account; revoke there too). A token carries the account's current plan on every call. - Send
Accept: application/json, text/event-stream; answers come back as JSON. - Rate limit: 60 calls per minute per account. Free plan: 100 tool calls per UTC day; Pro and above are not counted.
Clients
Claude Code
claude mcp add --transport http keylab https://keylab.cloud/api/mcp --header "Authorization: Bearer klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"keylab": {
"url": "https://keylab.cloud/api/mcp",
"headers": {
"Authorization": "Bearer klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}VS Code (.vscode/mcp.json)
{
"servers": {
"keylab": {
"type": "http",
"url": "https://keylab.cloud/api/mcp",
"headers": {
"Authorization": "Bearer klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}ChatGPT
Settings → Connectors → Developer mode → Create URL: https://keylab.cloud/api/mcp Authentication: token Token: klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MCP Inspector
npx @modelcontextprotocol/inspector --transport http --server-url https://keylab.cloud/api/mcp --header "Authorization: Bearer klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
curl
curl https://keylab.cloud/api/mcp -H "Authorization: Bearer klt_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"keylab_kcv","arguments":{"key":"0123456789ABCDEF"}}}'Conventions
- Hex arguments accept spaces and either case; results are uppercase hex. Digit arguments (PAN, PIN) ignore spaces.
- Results carry
structuredContent(an object) and the same object as JSON text incontent. - A bad input never fails the call: it returns
isError: truewith one sentence naming the field (pan: must be 12–19 digits). Unknown properties are rejected by name. - An HSM error from the simulator is a normal result with
ok: falseand the payShield error code, not a tool error. - Tools marked Pro refuse below their plan with a sentence that names the plan and links to pricing.
Tools
keylab_pin_block
PIN block (ISO 9564 formats 0–4)FreeEncode a clear PIN into an ISO 9564-1 PIN block, or decode a PIN block back to the PIN. Formats: 0 (PIN field XOR PAN field; needs pan), 1 (no PAN, random filler), 2 (no PAN, F padding, used for offline/ICC), 3 (like 0 with random A–F filler), 4 (AES: PIN field enciphered with `key`, XORed with the PAN field, enciphered again; needs pan and a 16/24/32-byte AES key). Formats 1, 3 and 4 include random filler, so encoding them twice gives different blocks that decode to the same PIN. Returns the block (formats 0–3: 16 hex chars; format 4: 32 hex chars) or the recovered PIN. Decoding with the wrong PAN or key fails with an explicit error instead of a wrong PIN.
| Argument | Type | Meaning |
|---|---|---|
| action* | encode | decode | `encode` a PIN into a block, or `decode` a block into a PIN. |
| format* | 0 | 1 | 2 | 3 | 4 | ISO 9564-1 PIN block format. |
| pin | digits | Clear PIN, 4–12 digits. |
| pan | digits | Card number (PAN), 12–19 digits. Spaces are ignored. |
| pinBlock | hex | PIN block to decode: 16 hex chars for formats 0–3, 32 for format 4. |
| key | hex | AES key for format 4 (32, 48 or 64 hex chars). Omit when encoding format 4 to get the clear PIN and PAN fields instead of an enciphered block. |
| paddingChar | string = F | Filler nibble for formats 0 and 2 (default F). |
keylab_kcv
Key check valueFreeCompute a key check value (KCV) for a DES/3DES or AES key. Methods: DES (3DES-encrypt a zero block, first 3 bytes — what payShield prints for DES keys); CMAC (AES-CMAC over a zero block per X9.24-1, first 3 bytes — what payShield 10K prints for AES keys and AES LMKs; the Thales test LMK gives DB3FB6); CKCV_AES (the same CMAC, 5 bytes, as carried in TR-31 version D key blocks); AES (AES-ECB of a zero block, first 3 bytes — legacy, used by some KMS; NOT the payShield value); plus VISA, ATALLA, SHA256 and CKCV_TDEA. If a KCV from an AES key does not match, try CMAC before assuming the key is wrong. Returns the KCV and the full block it was cut from. A matching KCV proves the key bytes, not their parity or their purpose.
| Argument | Type | Meaning |
|---|---|---|
| key* | hex | Clear key in hex: 16/32/48 hex chars for single/double/triple-length DES, 32/48/64 for AES-128/192/256. |
| method | DES | AES | VISA | ATALLA | SHA256 | CMAC | CKCV_TDEA | CKCV_AES = DES | KCV method (default DES). |
keylab_key_parity
DES key parity — check or enforceFreeCheck the parity of a DES/3DES key (each byte should have odd parity per X9.8/X9.24) or rewrite it to odd or even parity by flipping the low bit of each byte. Enforcing parity does not change the effective key (the low bit is ignored by DES), which is why a KCV survives it — so `check` first when a key "looks wrong" but its KCV matches. AES keys have no parity; do not use this on them.
| Argument | Type | Meaning |
|---|---|---|
| key* | hex | DES key in hex (16, 32 or 48 hex chars). |
| action | check | enforce = check | `check` reports the parity; `enforce` returns the key rewritten to `target` parity. |
| target | Odd | Even = Odd | Parity to enforce (default Odd, the DES standard). |
keylab_key_components
Key components — split or combine (XOR)FreeSplit a clear key into random XOR components for a key ceremony (each custodian gets one; no single component reveals the key), or combine components back into the key. Splitting is randomised: the same key gives different components each time, all combining to the same key. Returns each component with its check values, and the combined key with its check values, so custodians can read a KCV per component aloud.
| Argument | Type | Meaning |
|---|---|---|
| action* | split | combine | `split` a key into components, or `combine` components into a key. |
| key | hex | Clear key to split (16/32/48 hex for DES, 32/48/64 for AES). |
| count | integer = 3 | Number of components to split into (default 3). |
| components | array of hex | Components to combine, all the same length. |
keylab_tr31_parse
TR-31 / X9.143 key block — parse and unwrapFreeParse an ANSI TR-31 / X9.143 key block (versions A, B, C, D) or a Thales key block (version 1): header fields with their meanings, optional blocks, encrypted key data and MAC. Pass the key block protection key as `kbpk` to also verify the MAC and unwrap the clear key. Without `kbpk` the header is decoded and nothing is verified. A wrong KBPK is reported as `macVerified: false`, never as a garbage key. Header fields: version (A/B/C/D), key usage (e.g. P0 PIN encryption, B0 BDK, D0 data encryption, K0 KEK), algorithm (T=3DES, A=AES), mode of use (E encrypt, D decrypt, B both, N none…), exportability (E/N/S).
| Argument | Type | Meaning |
|---|---|---|
| keyBlock* | string | The key block as printed by the HSM or KMS (ASCII, e.g. "B0096P0TE00E0000…"). Whitespace is ignored. |
| kbpk | hex | Key block protection key in hex (16/24-byte 3DES for versions A/B/C, 16/24/32-byte AES for version D). Optional. |
keylab_tr31_create
TR-31 / X9.143 key block — wrap a keyFreeWrap a clear key into an ANSI TR-31 / X9.143 key block under a key block protection key (KBPK). Version B (3DES KBPK, key derivation binding) and D (AES KBPK, X9.143) are the ones in use; A and C are legacy variant binding; 1 is the Thales AKB. Key usage, algorithm, mode of use and exportability go into the header exactly as given (e.g. P0/T/E/E for a ZPK, B0/T/X/N for a BDK, D0/A/B/E for an AES data key). Random padding makes every block different; verify by parsing it back with keylab_tr31_parse and the same KBPK.
| Argument | Type | Meaning |
|---|---|---|
| key* | hex | Clear key to wrap, in hex. |
| kbpk* | hex | Key block protection key: 16/24-byte 3DES for A/B/C, 16/24/32-byte AES for D and 1. |
| version | A | B | C | D | 1 = B | Key block version (default B). |
| keyUsage | string = K0 | Two-character key usage: P0 PIN encryption, B0 BDK, D0 data, K0 KEK, M0/M1/M3 MAC, C0 CVK, V0/V1/V2 PIN verification, E0–E6 EMV… |
| algorithm | T | A | D | R | E | H | S = T | Algorithm of the wrapped key: T=3DES, A=AES, D=DES, R=RSA, E=ECC, H=HMAC, S=DSA (default T). |
| modeOfUse | B | C | D | E | G | N | S | T | V | X | Y = N | B both, C generate/verify, D decrypt only, E encrypt only, G generate, N no restriction, S sign, T both sign/verify, V verify, X derive, Y create (default N). |
| exportability | E | N | S = E | E exportable under a KEK, N non-exportable, S sensitive (default E). |
| keyVersion | string = 00 | Key version number, two characters (default 00). |
| lmkId | string = 00 | Thales AKB (version 1) only: LMK identifier (default 00). |
keylab_dukpt_derive
DUKPT working keys (3DES X9.24-1, AES X9.24-3)FreeDerive the DUKPT keys for a KSN: 3DES per ANSI X9.24-1 (IPEK, current derived key, and the PIN, MAC request/response and data request/response variants) or AES per X9.24-3:2017 (initial key and the working keys for PIN, MAC, data). For AES, `workingKeyBytes` picks the working-key length (16 = AES-128, 24, 32); the BDK may be AES-128 or AES-256. The KSN is 10 bytes for 3DES (KSI + device ID + 21-bit counter) and 12 bytes for AES (initial key ID + 32-bit counter). Use the result to decrypt a terminal's PIN block or verify its MAC.
| Argument | Type | Meaning |
|---|---|---|
| algorithm* | TDES | AES | TDES = X9.24-1 (2009), AES = X9.24-3 (2017). |
| bdk* | hex | Base derivation key: 16 bytes (32 hex) for TDES; 16 or 32 bytes for AES. |
| ksn* | hex | Key serial number: 20 hex chars for TDES, 24 for AES. |
| workingKeyBytes | 16 | 24 | 32 = 16 | AES only: working key length in bytes (default 16). |
keylab_emv_udk
EMV ICC master key (UDK) derivationFreeDerive an ICC master key (UDK) from an issuer master key (MDK/IMK) and the PAN + PAN sequence number, per EMV Book 2 Annex A1.4: option A (PAN ≤ 16 digits, classic) or option B (any PAN length, SHA-1 decimalisation). Do this once per key family: MK-AC for cryptograms, MK-SMI for script MACs, MK-SMC for script encryption, each from its own issuer master key. Returns the UDK with odd parity applied when `parity` is odd (what a payShield does), and its KCV.
| Argument | Type | Meaning |
|---|---|---|
| mdk* | hex | Issuer master key in hex (32 hex chars for 3DES; 32/64 for AES). |
| pan* | digits | Card number (PAN), 12–19 digits. Spaces are ignored. |
| panSeq | digits = 00 | PAN sequence number, 2 digits (default 00). |
| option | A | B = A | Derivation option (default A). |
| emvVersion | v4.1 | v4.2 | v4.3 = v4.2 | EMV Book 2 version the derivation follows (default v4.2). |
| parity | none | odd = odd | Apply odd parity to the derived key (default odd, as HSMs do). |
keylab_emv_session_key
EMV session key from the ATCFreeDerive the session key an ICC uses for one transaction from its master key (UDK) and the ATC. `method2` = EMV Common Session Key (Book 2 Annex A1.3: F0/0F branches), the one used by CCD, M/Chip 4+, Visa CVN 18 and most modern profiles. `method1` = the older CSK variant (ATC ⊕ FFFF on the right half). `emv2000` = the EMV 2000 tree derivation (needs iv, branchFactor, height). Returns the session key and its KCV. Wrong method is the usual reason an ARQC does not verify.
| Argument | Type | Meaning |
|---|---|---|
| masterKey* | hex | ICC master key (UDK) in hex, 32 hex chars. |
| atc* | hex | Application Transaction Counter, 4 hex chars (tag 9F36). |
| method | method2 | method1 | emv2000 = method2 | Derivation method (default method2, the Common Session Key). |
| emvVersion | v4.1 | v4.2 | v4.3 = v4.2 | EMV Book 2 version the derivation follows (default v4.2). |
| iv | hex | emv2000 only: initial vector. |
| branchFactor | integer | emv2000 only: tree branch factor. |
| height | integer | emv2000 only: tree height. |
| parity | none | odd = none | Apply odd parity to the session key (default none). |
keylab_emv_arqc
EMV ARQC / application cryptogramFreeGenerate an application cryptogram (ARQC/TC/AAC) the way the issuer verifies it: derive the ICC master key from the issuer MK-AC and PAN (option A), derive the session key from the ATC (`method1` or `method2`), then MAC the transaction data (ISO 9797-1 Algorithm 3, padding 80). `transactionData` is the concatenated CDOL1 data in the card profile order (amount, other amount, terminal country, TVR, currency, date, type, UN, AIP, ATC, CVR/IAD…) — the same bytes tag 9F26 was computed over. Returns the cryptogram, the session key and the ICC master key so each step can be compared with an HSM trace.
| Argument | Type | Meaning |
|---|---|---|
| issuerMasterKey* | hex | Issuer master key for cryptograms (IMK-AC), 32 hex chars. |
| pan* | digits | Card number (PAN), 12–19 digits. Spaces are ignored. |
| panSeq | digits = 00 | PAN sequence number (default 00). |
| atc* | hex | ATC, 4 hex chars (tag 9F36). |
| unpredictableNumber* | hex | Unpredictable number, 8 hex chars (tag 9F37). |
| transactionData* | hex | CDOL1 data as one hex string, in card-profile order. |
| method | method2 | method1 = method2 | Session key derivation (default method2, Common Session Key). |
keylab_emv_arpc
EMV ARPC (issuer response cryptogram)FreeGenerate the ARPC the issuer returns for an ARQC. Method 1 (Book 2 §8.2.1): 3DES of ARQC ⊕ (ARC ‖ 0000…) under the session key, 8 bytes. Method 2 (§8.2.2, CCD/M/Chip): ISO 9797-1 Alg 3 MAC over ARQC ‖ CSU ‖ proprietary data under the session key, 4 bytes, returned as MAC ‖ CSU. Pass the same session key the ARQC was verified with (from keylab_emv_arqc or keylab_emv_session_key).
| Argument | Type | Meaning |
|---|---|---|
| method* | 1 | 2 | ARPC method 1 (ARC) or 2 (CSU). |
| arqc* | hex | The ARQC, 16 hex chars. |
| sessionKey* | hex | Session key used for the ARQC, 32 hex chars. |
| arc | string | Method 1: authorisation response code, 2 ASCII characters (e.g. 00, 05, Z3). |
| csu | hex | Method 2: card status update, 8 hex chars. |
| proprietaryAuthData | hex | Method 2: proprietary authentication data, 0–8 bytes (optional). |
| emvVersion | v4.1 | v4.2 | v4.3 = v4.2 | EMV Book 2 version the derivation follows (default v4.2). |
keylab_tlv_parse
BER-TLV parser (EMV tags)FreeParse BER-TLV data (EMV records, GPO/GENERATE AC responses, DOL data, tag 70/77/80 templates) into tags with their EMV names, lengths and values. Constructed tags (E0, 70, 77, A5, 6F, 61…) are expanded into children. Multi-byte tags (9F26, 5F2A, DF8129…) and long-form lengths (81 xx, 82 xx xx) are handled. Malformed input fails at the exact byte offset instead of returning a partial tree.
| Argument | Type | Meaning |
|---|---|---|
| hex* | hex | TLV bytes in hex. Spaces are ignored. |
keylab_iso8583_parse
ISO 8583 message parserFreeParse an ISO 8583 (1987 ASCII) message given as hex: MTI, primary and secondary bitmap, and every present field with its name and value (LLVAR/LLLVAR lengths resolved; binary fields kept as hex). Field definitions follow the 1987 standard layout; a processor's private fields (48, 61–63, 120–127) come back as raw text. Use it to see which field an ARQC (DE 55), PIN block (DE 52) or MAC (DE 64/128) sits in before checking it.
| Argument | Type | Meaning |
|---|---|---|
| hex* | hex | The whole message in hex, starting at the MTI (no TCP length prefix). |
keylab_cvv
CVV / CVV2 / iCVVFreeCompute a card verification value under a CVK pair (Visa CVV / Mastercard CVC algorithm): PAN, expiry (YYMM) and service code → 3 digits. CVV (magstripe track) uses the real service code; CVV2 (printed on the card) uses service code 000 and the expiry in YYMM; iCVV (chip track 2 equivalent) uses service code 999. Returns the 3 digits. A mismatch with the card is a CVK, expiry-order (MMYY vs YYMM) or service-code problem in that order of likelihood.
| Argument | Type | Meaning |
|---|---|---|
| kind | CVV | CVV2 | iCVV = CVV | Which value: CVV (uses serviceCode), CVV2 (service code 000), iCVV (service code 999). Default CVV. |
| pan* | digits | Card number (PAN), 12–19 digits. Spaces are ignored. |
| expiry* | digits | Expiry as YYMM (e.g. 2812 for December 2028). |
| serviceCode | digits = 101 | Service code for CVV (default 101). Ignored for CVV2 and iCVV. |
| cvkA* | hex | CVK A, 16 hex chars. |
| cvkB* | hex | CVK B, 16 hex chars. |
keylab_pvv
Visa PVV (PIN verification value)FreeCompute the Visa PVV for a PAN and PIN under a PVK (PIN verification key): the 4 digits an issuer stores to verify a PIN without storing the PIN. PVKI selects which of the issuer's PVK pairs was used (0–9; 1 is the common default). Returns the 4-digit PVV.
| Argument | Type | Meaning |
|---|---|---|
| pan* | digits | Card number (PAN), 12–19 digits. Spaces are ignored. |
| pin* | digits | Clear PIN, 4–12 digits. |
| pvki | digits = 1 | PVK indicator, one digit (default 1). |
| pvk* | hex | PVK pair as one 32-hex-char (double-length) key. |
keylab_mac
Message MAC (X9.9, X9.19, ISO 9797-1)FreeCompute a DES-based message authentication code: X9.9 (single DES CBC-MAC, 8 bytes), X9.19 retail MAC (ISO 9797-1 Algorithm 3: single DES CBC then final 3DES, the one payment networks use for DE 64/128 and EMV cryptograms), ISO 9797-1 Algorithm 1 (CBC-MAC) and Algorithm 3, each with padding method 1 (zero pad) or 2 (0x80 then zeros). Returns the full 8-byte MAC; truncate to 4 bytes yourself when the protocol says so.
| Argument | Type | Meaning |
|---|---|---|
| algorithm* | X9.19 | X9.9 | ISO9797-ALG1 | ISO9797-ALG3 | MAC algorithm. |
| key* | hex | MAC key: 16 hex chars for X9.9 and ALG1 (single DES), 32 hex chars for X9.19 and ALG3 (3DES). |
| data* | hex | Data to MAC, in hex. |
| padding | 1 | 2 = 1 | ISO 9797-1 padding method for ALG1/ALG3 (default 1). |
keylab_des
3DES encrypt / decryptFreeEncrypt or decrypt with DES / 3DES (single, double or triple-length key) in ECB or CBC mode, with no padding by default — data must then be a multiple of 8 bytes, as it is in every payment use (PIN blocks, key encryption, KCVs). Use padding pkcs7 only for free-form data. Returns hex.
| Argument | Type | Meaning |
|---|---|---|
| action* | encrypt | decrypt | Direction. |
| key* | hex | DES key, 16/32/48 hex chars. |
| data* | hex | Plaintext or ciphertext in hex. |
| mode | ECB | CBC = ECB | Mode (default ECB). |
| iv | hex | IV for CBC, 16 hex chars (default zeros). |
| padding | none | pkcs7 = none | Padding (default none). |
keylab_aes
AES encrypt / decryptFreeEncrypt or decrypt with AES-128/192/256 in ECB, CBC, CFB, OFB or GCM. Padding is none by default (payment data is block-aligned); pkcs7 for free-form data. GCM returns an authentication tag on encrypt and needs `tag` on decrypt. Returns hex.
| Argument | Type | Meaning |
|---|---|---|
| action* | encrypt | decrypt | Direction. |
| key* | hex | AES key, 32/48/64 hex chars. |
| data* | hex | Plaintext or ciphertext in hex. |
| mode | ECB | CBC | CFB | OFB | GCM = ECB | Mode (default ECB). |
| iv | hex | IV/nonce: 32 hex chars for CBC/CFB/OFB, 24 for GCM. Ignored for ECB. |
| padding | none | pkcs7 = none | Padding for ECB/CBC (default none). |
| tag | hex | GCM decrypt: the authentication tag. |
keylab_luhn
Luhn check (PAN / IMEI)FreeValidate a number with the Luhn (mod 10) algorithm, or compute the check digit for a partial number. Returns `isValid` for the number as given and `checkDigit` = the digit that, appended to the number, makes it Luhn-valid. So for a full PAN read `isValid`; for a PAN without its last digit read `checkDigit`.
| Argument | Type | Meaning |
|---|---|---|
| number* | digits | Digits only (spaces ignored). A full number to validate, or a partial one to complete. |
keylab_xor
XOR hex stringsFreeXOR two or more hex strings (key components, PIN/PAN fields, DUKPT variants, check-value arithmetic). Shorter operands are left-padded with zeros to the longest length. Returns uppercase hex.
| Argument | Type | Meaning |
|---|---|---|
| values* | array of hex | Two or more hex strings to XOR together, in order. |
keylab_hsm_commands
payShield host commands — catalogue, schema, worked exampleFreeList the payShield host commands the simulator implements (key management A0/A6/A8/BW/CA…, PIN CA/DA/JA/JE/JG/BA…, EMV KW/KQ/M0/M2/M6/M8…, diagnostics NC/NO), or describe one: its parameters with lengths and hints, its response code, and a worked example that runs clean against the test LMK — either a raw message or a `params` object for keylab_hsm_run. Call this before keylab_hsm_run when unsure of a command's field layout.
| Argument | Type | Meaning |
|---|---|---|
| command | A0 | A2 | A4 | A6 | A8 | B0 | B2 | BA | BU | BW | CA | CI | CC | CW | CY | DA | DC | DE | DG | EC | EE | BY | GM | JA | JC | JE | JG | KW | KQ | M0 | M2 | M6 | M8 | NG | QK | NC | NO | Two-character command code to describe. Omit to list them all. |
keylab_hsm_run
Run a host command on the simulated payShieldProSend one host command to a simulated payShield 10K and get the response, parsed: response code (00 = OK), response command, data and an explanation. Give either `raw` (the whole message: 4-char header + command + fields, e.g. "0000NC" or "0000A00FFFS%00#P0A3N00S00") or `command` + `params` (the field names keylab_hsm_commands lists; the message is composed for you). The simulator starts fresh on every call with the Thales test LMK (type 4 AES key block by default; `lmkType` 1–3 for variant/3DES key block LMKs), so keys imported in one call do not exist in the next — carry key blocks between calls yourself. An HSM error is a normal result with `ok: false` and the error code (e.g. 15 invalid input, 10 wrong key), not a tool error.
| Argument | Type | Meaning |
|---|---|---|
| raw | string | The full host message including the header (e.g. "0000NC"). Whitespace is stripped. |
| command | A0 | A2 | A4 | A6 | A8 | B0 | B2 | BA | BU | BW | CA | CI | CC | CW | CY | DA | DC | DE | DG | EC | EE | BY | GM | JA | JC | JE | JG | KW | KQ | M0 | M2 | M6 | M8 | NG | QK | NC | NO | Command code, when composing from `params`. |
| params | object | Field values by name, as listed by keylab_hsm_commands (e.g. { keyType: "001", zmkUnderLmk: "S1…", keyUnderZmk: "…" }). |
| lmkType | 1 | 2 | 3 | 4 = 4 | Test LMK: 1 = 2DES variant, 2 = 3DES variant, 3 = 3DES key block, 4 = AES key block (default). |
| headerLength | integer = 4 | Message header length (default 4). |
keylab_kmip_build
KMIP request — compose to TTLVProCompose a KMIP request and return its exact TTLV bytes (hex) plus an annotated wire view. Start from a template (discover-versions, query, create-aes, get, get-attributes, destroy, register, register-payment) for a protocol version (1.4, 2.0, 2.1, 3.0), or pass the request in the OASIS XML profile form as `xml`. Placeholders: $NOW, $NOW+seconds, $UNIQUE_IDENTIFIER_n (filled from `uids`). register-payment carries the standard payment vocabulary (Key Role Type BDK/CVK/ZPK/MK…, Wrapping Method TR-31). Send the bytes over TLS to port 5696 yourself, then decode the reply with keylab_kmip_read.
| Argument | Type | Meaning |
|---|---|---|
| template | discover-versions | query | create-aes | get | get-attributes | destroy | register | register-payment | Template to start from (ignored when `xml` is given). |
| version | 1.4 | 2.0 | 2.1 | 3.0 = 2.1 | KMIP protocol version for the template (default 2.1). |
| xml | string | Request in the OASIS KMIP XML profile form (<RequestMessage>…). Overrides `template`. |
| uids | array of string | Values for $UNIQUE_IDENTIFIER_1, _2, … in order. |
keylab_kmip_read
KMIP TTLV — decode a request or responseProDecode a KMIP TTLV dump (hex) into the OASIS XML profile form and read it out: the operation, and for a response the result status, reason and message, and any Unique Identifiers returned. A byte-level fault is reported with its offset (TtlvError), so a truncated capture or a wrong length is named, not guessed at.
| Argument | Type | Meaning |
|---|---|---|
| hex* | hex | TTLV bytes in hex, one or more whole messages. |