{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-payment-cryptography/json-schema/amazon-payment-cryptography-translate-pin-data-input-schema.json",
  "title": "TranslatePinDataInput",
  "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/TranslatePinDataInput",
  "type": "object",
  "properties": {
    "IncomingKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the encryption key under which incoming PIN block data is encrypted. This key type can be PEK or BDK. For dynamic keys, it is the keyARN of KEK of the TR-31 wrapped PEK. For ECDH, it is the keyARN of the asymmetric ECC key."
    },
    "OutgoingKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK. For ECDH, it is the keyARN of the asymmetric ECC key."
    },
    "IncomingTranslationAttributes": {
      "$ref": "#/$defs/TranslationIsoFormats"
    },
    "OutgoingTranslationAttributes": {
      "$ref": "#/$defs/TranslationIsoFormats"
    },
    "EncryptedPinBlock": {
      "type": "string",
      "description": "The encrypted PIN block data that Amazon Web Services Payment Cryptography translates."
    },
    "IncomingDukptAttributes": {
      "$ref": "#/$defs/DukptDerivationAttributes"
    },
    "OutgoingDukptAttributes": {
      "$ref": "#/$defs/DukptDerivationAttributes"
    },
    "IncomingWrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    },
    "OutgoingWrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    },
    "IncomingAs2805Attributes": {
      "$ref": "#/$defs/As2805PekDerivationAttributes"
    }
  },
  "required": [
    "IncomingKeyIdentifier",
    "OutgoingKeyIdentifier",
    "IncomingTranslationAttributes",
    "OutgoingTranslationAttributes",
    "EncryptedPinBlock"
  ],
  "$defs": {
    "As2805PekDerivationAttributes": {
      "type": "object",
      "properties": {
        "SystemTraceAuditNumber": {
          "type": "string",
          "description": "The system trace audit number for the transaction."
        },
        "TransactionAmount": {
          "type": "string",
          "description": "The transaction amount for the transaction."
        }
      },
      "required": [
        "SystemTraceAuditNumber",
        "TransactionAmount"
      ]
    },
    "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"
      ]
    },
    "DukptDerivationAttributes": {
      "type": "object",
      "properties": {
        "KeySerialNumber": {
          "type": "string",
          "description": "The unique identifier known as Key Serial Number (KSN) that comes from an encrypting device using DUKPT encryption method. The KSN is derived from the encrypting device unique identifier and an internal transaction counter."
        },
        "DukptKeyDerivationType": {
          "type": "string",
          "enum": [
            "TDES_2KEY",
            "TDES_3KEY",
            "AES_128",
            "AES_192",
            "AES_256"
          ],
          "description": "The key type derived using DUKPT from a Base Derivation Key (BDK) and Key Serial Number (KSN). This must be less than or equal to the strength of the BDK. For example, you can't use AES_128 as a derivation type for a BDK of AES_128 or TDES_2KEY"
        },
        "DukptKeyVariant": {
          "type": "string",
          "enum": [
            "BIDIRECTIONAL",
            "REQUEST",
            "RESPONSE"
          ],
          "description": "The type of use of DUKPT, which can be for incoming data decryption, outgoing data encryption, or both."
        }
      },
      "required": [
        "KeySerialNumber"
      ]
    },
    "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"
      ]
    },
    "TranslationIsoFormats": {
      "type": "object",
      "properties": {
        "IsoFormat0": {
          "$ref": "#/$defs/TranslationPinDataIsoFormat034"
        },
        "IsoFormat1": {
          "$ref": "#/$defs/TranslationPinDataIsoFormat1"
        },
        "IsoFormat3": {
          "$ref": "#/$defs/TranslationPinDataIsoFormat034"
        },
        "IsoFormat4": {
          "$ref": "#/$defs/TranslationPinDataIsoFormat034"
        },
        "As2805Format0": {
          "$ref": "#/$defs/TranslationPinDataAs2805Format0"
        }
      },
      "description": "Exactly one member is set."
    },
    "TranslationPinDataAs2805Format0": {
      "type": "object",
      "properties": {
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."
        }
      },
      "required": [
        "PrimaryAccountNumber"
      ]
    },
    "TranslationPinDataIsoFormat034": {
      "type": "object",
      "properties": {
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."
        }
      },
      "required": [
        "PrimaryAccountNumber"
      ]
    },
    "TranslationPinDataIsoFormat1": {
      "type": "object",
      "properties": {}
    },
    "WrappedKeyMaterial": {
      "type": "object",
      "properties": {
        "Tr31KeyBlock": {
          "type": "string",
          "description": "The TR-31 wrapped key block."
        },
        "DiffieHellmanSymmetricKey": {
          "$ref": "#/$defs/EcdhDerivationAttributes"
        }
      },
      "description": "Exactly one member is set."
    }
  }
}