generate_mac_emv_pin_change
Generate an EMV PIN change MAC using P0, E2, and E1 keys for issuer scripts, CHANGE REFERENCE DATA, or offline PIN change.
Instructions
Call this before implementing any EMV PIN change flow — issuer script, CHANGE REFERENCE DATA (INS=24), or offline PIN change MAC assembly.
IMPORTANT: This operation requires THREE separate keys, not one: P0 — PIN Encryption Key: encrypts the new PIN block E2 — EMV Integrity Key: generates the script MAC E1 — EMV Confidentiality Key: encrypts the script data
Single-key EMV MAC helpers (E2 only) cannot replicate this. A full EMV PIN change requires all three key types to be provisioned in APC separately.
Required key types: new_pin_pek_identifier: P0 (PIN Encryption Key for new PIN) secure_messaging_integrity_key_identifier: E2 (EMV integrity) secure_messaging_confidentiality_key_identifier: E1 (EMV confidentiality)
Args: new_pin_pek_identifier: ARN or alias of P0 key for new PIN secure_messaging_integrity_key_identifier: ARN or alias of E2 key secure_messaging_confidentiality_key_identifier: ARN or alias of E1 key message_data: Hex-encoded script command data new_encrypted_pin_block: Hex-encoded new PIN block encrypted under PEK pin_block_format: ISO_FORMAT_0, ISO_FORMAT_1, or ISO_FORMAT_3 (ISO_FORMAT_4 is not supported by this operation) derivation_method_attributes: EMV derivation method (Visa, Mastercard, etc.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message_data | Yes | ||
| pin_block_format | Yes | ||
| new_pin_pek_identifier | Yes | ||
| new_encrypted_pin_block | Yes | ||
| derivation_method_attributes | Yes | ||
| secure_messaging_integrity_key_identifier | Yes | ||
| secure_messaging_confidentiality_key_identifier | Yes |