{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-payment-cryptography/json-schema/amazon-payment-cryptography-generate-mac-emv-pin-change-input-schema.json",
  "title": "GenerateMacEmvPinChangeInput",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-payment-cryptography-operations-api-openapi.yml#/components/schemas/GenerateMacEmvPinChangeInput",
  "type": "object",
  "properties": {
    "NewPinPekIdentifier": {
      "type": "string",
      "description": "The keyARN of the PEK protecting the incoming new encrypted PIN block."
    },
    "NewEncryptedPinBlock": {
      "type": "string",
      "description": "The incoming new encrypted PIN block data for offline pin change on an EMV card."
    },
    "PinBlockFormat": {
      "type": "string",
      "enum": [
        "ISO_FORMAT_0",
        "ISO_FORMAT_1",
        "ISO_FORMAT_3"
      ],
      "description": "The PIN encoding format of the incoming new encrypted PIN block as specified in ISO 9564."
    },
    "SecureMessagingIntegrityKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the issuer master key (IMK-SMI) used to authenticate the issuer script response."
    },
    "SecureMessagingConfidentialityKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the issuer master key (IMK-SMC) used to protect the PIN block data in the issuer script response."
    },
    "MessageData": {
      "type": "string",
      "description": "The message data is the APDU command from the card reader or terminal. The target encrypted PIN block, after translation to ISO2 format, is appended to this message data to generate an issuer script response."
    },
    "DerivationMethodAttributes": {
      "$ref": "#/$defs/DerivationMethodAttributes"
    }
  },
  "required": [
    "NewPinPekIdentifier",
    "NewEncryptedPinBlock",
    "PinBlockFormat",
    "SecureMessagingIntegrityKeyIdentifier",
    "SecureMessagingConfidentialityKeyIdentifier",
    "MessageData",
    "DerivationMethodAttributes"
  ],
  "$defs": {
    "AmexAttributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The method to use when deriving the master key for a payment card using Amex derivation."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder."
        },
        "PanSequenceNumber": {
          "type": "string",
          "description": "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."
        },
        "ApplicationTransactionCounter": {
          "type": "string",
          "description": "The transaction counter of the current transaction that is provided by the terminal during transaction processing."
        },
        "AuthorizationRequestKeyIdentifier": {
          "type": "string",
          "description": "The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card."
        },
        "CurrentPinAttributes": {
          "$ref": "#/$defs/CurrentPinAttributes"
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "ApplicationTransactionCounter",
        "AuthorizationRequestKeyIdentifier"
      ]
    },
    "CurrentPinAttributes": {
      "type": "object",
      "properties": {
        "CurrentPinPekIdentifier": {
          "type": "string",
          "description": "The keyArn of the current PIN PEK."
        },
        "CurrentEncryptedPinBlock": {
          "type": "string",
          "description": "The encrypted pinblock of the current pin stored on the chip card."
        }
      },
      "required": [
        "CurrentPinPekIdentifier",
        "CurrentEncryptedPinBlock"
      ]
    },
    "DerivationMethodAttributes": {
      "type": "object",
      "properties": {
        "EmvCommon": {
          "$ref": "#/$defs/EmvCommonAttributes"
        },
        "Amex": {
          "$ref": "#/$defs/AmexAttributes"
        },
        "Visa": {
          "$ref": "#/$defs/VisaAttributes"
        },
        "Emv2000": {
          "$ref": "#/$defs/Emv2000Attributes"
        },
        "Mastercard": {
          "$ref": "#/$defs/MasterCardAttributes"
        }
      },
      "description": "Exactly one member is set."
    },
    "Emv2000Attributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The method to use when deriving the master key for the payment card."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder."
        },
        "PanSequenceNumber": {
          "type": "string",
          "description": "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."
        },
        "ApplicationTransactionCounter": {
          "type": "string",
          "description": "The transaction counter of the current transaction that is provided by the terminal during transaction processing."
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "ApplicationTransactionCounter"
      ]
    },
    "EmvCommonAttributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The method to use when deriving the master key for the payment card."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder."
        },
        "PanSequenceNumber": {
          "type": "string",
          "description": "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."
        },
        "ApplicationCryptogram": {
          "type": "string",
          "description": "The application cryptogram for the current transaction that is provided by the terminal during transaction processing."
        },
        "Mode": {
          "type": "string",
          "enum": [
            "ECB",
            "CBC"
          ],
          "description": "The block cipher method to use for encryption."
        },
        "PinBlockPaddingType": {
          "type": "string",
          "enum": [
            "NO_PADDING",
            "ISO_IEC_7816_4"
          ],
          "description": "The padding to be added to the PIN block prior to encryption. Padding type should be ISO_IEC_7816_4, if PinBlockLengthPosition is set to FRONT_OF_PIN_BLOCK. No padding is required, if PinBlockLengthPosition is set to NONE."
        },
        "PinBlockLengthPosition": {
          "type": "string",
          "enum": [
            "NONE",
            "FRONT_OF_PIN_BLOCK"
          ],
          "description": "Specifies if PIN block length should be added to front of the pin block. If value is set to FRONT_OF_PIN_BLOCK, then PIN block padding type should be ISO_IEC_7816_4."
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "ApplicationCryptogram",
        "Mode",
        "PinBlockPaddingType",
        "PinBlockLengthPosition"
      ]
    },
    "MasterCardAttributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The method to use when deriving the master key for the payment card."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder."
        },
        "PanSequenceNumber": {
          "type": "string",
          "description": "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."
        },
        "ApplicationCryptogram": {
          "type": "string",
          "description": "The application cryptogram for the current transaction that is provided by the terminal during transaction processing."
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "ApplicationCryptogram"
      ]
    },
    "VisaAttributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The method to use when deriving the master key for the payment card."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN) of the cardholder."
        },
        "PanSequenceNumber": {
          "type": "string",
          "description": "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."
        },
        "ApplicationTransactionCounter": {
          "type": "string",
          "description": "The transaction counter of the current transaction that is provided by the terminal during transaction processing."
        },
        "AuthorizationRequestKeyIdentifier": {
          "type": "string",
          "description": "The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card."
        },
        "CurrentPinAttributes": {
          "$ref": "#/$defs/CurrentPinAttributes"
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "ApplicationTransactionCounter",
        "AuthorizationRequestKeyIdentifier"
      ]
    }
  }
}