{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-payment-cryptography/json-schema/amazon-payment-cryptography-generate-pin-data-input-schema.json",
  "title": "GeneratePinDataInput",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-payment-cryptography-pindata-api-openapi.yml#/components/schemas/GeneratePinDataInput",
  "type": "object",
  "properties": {
    "GenerationKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for pin data generation."
    },
    "EncryptionKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block. For ECDH, it is the keyARN of the asymmetric ECC key."
    },
    "GenerationAttributes": {
      "$ref": "#/$defs/PinGenerationAttributes"
    },
    "PinDataLength": {
      "type": "integer",
      "description": "The length of PIN under generation."
    },
    "PrimaryAccountNumber": {
      "type": "string",
      "description": "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder."
    },
    "PinBlockFormat": {
      "type": "string",
      "enum": [
        "ISO_FORMAT_0",
        "ISO_FORMAT_1",
        "ISO_FORMAT_3",
        "ISO_FORMAT_4"
      ],
      "description": "The PIN encoding format for pin data generation as specified in ISO 9564. Amazon Web Services Payment Cryptography supports ISO_Format_0, ISO_Format_3 and ISO_Format_4. The ISO_Format_0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats. It is similar to a VISA-4 PIN block format. It supports a PIN from 4 to 12 digits in length. The ISO_Format_3 PIN block format is the same as ISO_Format_0 except that the fill digits are random values from 10 to 15. The ISO_Format_4 PIN block format is the only one supporting AES encryption."
    },
    "EncryptionWrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    }
  },
  "required": [
    "GenerationKeyIdentifier",
    "EncryptionKeyIdentifier",
    "GenerationAttributes",
    "PinBlockFormat"
  ],
  "$defs": {
    "DataplanePaymentCryptographyWrappedKey": {
      "type": "object",
      "properties": {
        "WrappedKeyMaterial": {
          "$ref": "#/$defs/WrappedKeyMaterial"
        },
        "KeyCheckValueAlgorithm": {
          "type": "string",
          "description": "The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity. For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result."
        }
      },
      "required": [
        "WrappedKeyMaterial"
      ]
    },
    "EcdhDerivationAttributes": {
      "type": "object",
      "properties": {
        "CertificateAuthorityPublicKeyIdentifier": {
          "type": "string",
          "description": "The keyArn of the certificate that signed the client's PublicKeyCertificate."
        },
        "PublicKeyCertificate": {
          "type": "string",
          "description": "The client's public key certificate in PEM format (base64 encoded) to use for ECDH key derivation."
        },
        "KeyAlgorithm": {
          "type": "string",
          "enum": [
            "TDES_2KEY",
            "TDES_3KEY",
            "AES_128",
            "AES_192",
            "AES_256",
            "HMAC_SHA256",
            "HMAC_SHA384",
            "HMAC_SHA512",
            "HMAC_SHA224"
          ],
          "description": "The key algorithm of the derived ECDH key."
        },
        "KeyDerivationFunction": {
          "type": "string",
          "enum": [
            "NIST_SP800",
            "ANSI_X963"
          ],
          "description": "The key derivation function to use for deriving a key using ECDH."
        },
        "KeyDerivationHashAlgorithm": {
          "type": "string",
          "enum": [
            "SHA_256",
            "SHA_384",
            "SHA_512"
          ],
          "description": "The hash type to use for deriving a key using ECDH."
        },
        "SharedInformation": {
          "type": "string",
          "description": "A byte string containing information that binds the ECDH derived key to the two parties involved or to the context of the key. It may include details like identities of the two parties deriving the key, context of the operation, session IDs, and optionally a nonce. It must not contain zero bytes, and re-using shared information for multiple ECDH key derivations is not recommended."
        }
      },
      "required": [
        "CertificateAuthorityPublicKeyIdentifier",
        "PublicKeyCertificate",
        "KeyAlgorithm",
        "KeyDerivationFunction",
        "KeyDerivationHashAlgorithm",
        "SharedInformation"
      ]
    },
    "Ibm3624NaturalPin": {
      "type": "object",
      "properties": {
        "DecimalizationTable": {
          "type": "string",
          "description": "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."
        },
        "PinValidationDataPadCharacter": {
          "type": "string",
          "description": "The padding character for validation data."
        },
        "PinValidationData": {
          "type": "string",
          "description": "The unique data for cardholder identification."
        }
      },
      "required": [
        "DecimalizationTable",
        "PinValidationDataPadCharacter",
        "PinValidationData"
      ]
    },
    "Ibm3624PinFromOffset": {
      "type": "object",
      "properties": {
        "DecimalizationTable": {
          "type": "string",
          "description": "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."
        },
        "PinValidationDataPadCharacter": {
          "type": "string",
          "description": "The padding character for validation data."
        },
        "PinValidationData": {
          "type": "string",
          "description": "The unique data for cardholder identification."
        },
        "PinOffset": {
          "type": "string",
          "description": "The PIN offset value."
        }
      },
      "required": [
        "DecimalizationTable",
        "PinValidationDataPadCharacter",
        "PinValidationData",
        "PinOffset"
      ]
    },
    "Ibm3624PinOffset": {
      "type": "object",
      "properties": {
        "EncryptedPinBlock": {
          "type": "string",
          "description": "The encrypted PIN block data. According to ISO 9564 standard, a PIN Block is an encoded representation of a payment card Personal Account Number (PAN) and the cardholder Personal Identification Number (PIN)."
        },
        "DecimalizationTable": {
          "type": "string",
          "description": "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."
        },
        "PinValidationDataPadCharacter": {
          "type": "string",
          "description": "The padding character for validation data."
        },
        "PinValidationData": {
          "type": "string",
          "description": "The unique data for cardholder identification."
        }
      },
      "required": [
        "EncryptedPinBlock",
        "DecimalizationTable",
        "PinValidationDataPadCharacter",
        "PinValidationData"
      ]
    },
    "Ibm3624RandomPin": {
      "type": "object",
      "properties": {
        "DecimalizationTable": {
          "type": "string",
          "description": "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."
        },
        "PinValidationDataPadCharacter": {
          "type": "string",
          "description": "The padding character for validation data."
        },
        "PinValidationData": {
          "type": "string",
          "description": "The unique data for cardholder identification."
        }
      },
      "required": [
        "DecimalizationTable",
        "PinValidationDataPadCharacter",
        "PinValidationData"
      ]
    },
    "PinGenerationAttributes": {
      "type": "object",
      "properties": {
        "VisaPin": {
          "$ref": "#/$defs/VisaPin"
        },
        "VisaPinVerificationValue": {
          "$ref": "#/$defs/VisaPinVerificationValue"
        },
        "Ibm3624PinOffset": {
          "$ref": "#/$defs/Ibm3624PinOffset"
        },
        "Ibm3624NaturalPin": {
          "$ref": "#/$defs/Ibm3624NaturalPin"
        },
        "Ibm3624RandomPin": {
          "$ref": "#/$defs/Ibm3624RandomPin"
        },
        "Ibm3624PinFromOffset": {
          "$ref": "#/$defs/Ibm3624PinFromOffset"
        }
      },
      "description": "Exactly one member is set."
    },
    "VisaPin": {
      "type": "object",
      "properties": {
        "PinVerificationKeyIndex": {
          "type": "integer",
          "description": "The value for PIN verification index. It is used in the Visa PIN algorithm to calculate the PVV (PIN Verification Value)."
        }
      },
      "required": [
        "PinVerificationKeyIndex"
      ]
    },
    "VisaPinVerificationValue": {
      "type": "object",
      "properties": {
        "EncryptedPinBlock": {
          "type": "string",
          "description": "The encrypted PIN block data to verify."
        },
        "PinVerificationKeyIndex": {
          "type": "integer",
          "description": "The value for PIN verification index. It is used in the Visa PIN algorithm to calculate the PVV (PIN Verification Value)."
        }
      },
      "required": [
        "EncryptedPinBlock",
        "PinVerificationKeyIndex"
      ]
    },
    "WrappedKeyMaterial": {
      "type": "object",
      "properties": {
        "Tr31KeyBlock": {
          "type": "string",
          "description": "The TR-31 wrapped key block."
        },
        "DiffieHellmanSymmetricKey": {
          "$ref": "#/$defs/EcdhDerivationAttributes"
        }
      },
      "description": "Exactly one member is set."
    }
  }
}