generate_pin_data
Create IBM 3624 or Visa PVV PINs, compute PIN offsets for card personalization, or produce encrypted test PIN blocks from a PAN and scheme-specific attributes.
Instructions
Call this when implementing IBM 3624 or Visa PVV PIN generation, generating a PIN offset for card personalization, or producing a test PIN block for a given PAN. Issuer function — use with care in acquirer contexts.
Supported schemes via generation_attributes: Visa PVV: {"VisaPin": {"PinVerificationKeyIndex": 1}} Visa PVV value: {"VisaPinVerificationValue": {"EncryptedPinBlock": "...", "PinVerificationKeyIndex": 1}} IBM3624 offset: {"Ibm3624PinOffset": {"DecimalizationTable": "...", "PinValidationData": "..."}} IBM3624 random: {"Ibm3624RandomPin": {"DecimalizationTable": "..."}} IBM3624 natural: {"Ibm3624NaturalPin": {"DecimalizationTable": "..."}} IBM3624 from offset: {"Ibm3624PinFromOffset": {"DecimalizationTable": "...", "PinOffset": "...", "PinValidationData": "..."}}
Supported key types: generation_key_identifier: V1 (IBM3624) or V2 (Visa) PVK encryption_key_identifier: P0 PIN Encryption Key (or KEK when using encryption_wrapped_key)
primary_account_number is optional for ISO_FORMAT_1 (which does not include PAN).
Args: generation_key_identifier: ARN or alias of PVK (V1 or V2 key) encryption_key_identifier: ARN or alias of PEK (P0 key) to encrypt output PIN block generation_attributes: Scheme-specific generation parameters pin_block_format: ISO_FORMAT_0, ISO_FORMAT_1, ISO_FORMAT_3, or ISO_FORMAT_4 primary_account_number: 12-19 digit PAN (required for all formats except ISO_FORMAT_1) pin_data_length: PIN length (4-12); omit to use scheme default encryption_wrapped_key: Optional TR-31 wrapped PEK (encryption_key_identifier becomes the KEK)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pin_data_length | No | ||
| pin_block_format | Yes | ||
| generation_attributes | Yes | ||
| encryption_wrapped_key | No | ||
| primary_account_number | No | ||
| encryption_key_identifier | Yes | ||
| generation_key_identifier | Yes |