{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-payment-cryptography/json-schema/amazon-payment-cryptography-encrypt-data-input-schema.json",
  "title": "EncryptDataInput",
  "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/EncryptDataInput",
  "type": "object",
  "properties": {
    "KeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption. When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation."
    },
    "PlainText": {
      "type": "string",
      "description": "The plaintext to be encrypted. For encryption using asymmetric keys, plaintext data length is constrained by encryption key strength that you define in KeyAlgorithm and padding type that you define in AsymmetricEncryptionAttributes. For more information, see Encrypt data in the Amazon Web Services Payment Cryptography User Guide."
    },
    "EncryptionAttributes": {
      "$ref": "#/$defs/EncryptionDecryptionAttributes"
    },
    "WrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    }
  },
  "required": [
    "KeyIdentifier",
    "PlainText",
    "EncryptionAttributes"
  ],
  "$defs": {
    "AsymmetricEncryptionAttributes": {
      "type": "object",
      "properties": {
        "PaddingType": {
          "type": "string",
          "enum": [
            "PKCS1",
            "OAEP_SHA1",
            "OAEP_SHA256",
            "OAEP_SHA512"
          ],
          "description": "The padding to be included with the data."
        }
      }
    },
    "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"
      ]
    },
    "DukptEncryptionAttributes": {
      "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."
        },
        "Mode": {
          "type": "string",
          "enum": [
            "ECB",
            "CBC"
          ],
          "description": "The block cipher method to use for encryption. The default is CBC."
        },
        "DukptKeyDerivationType": {
          "type": "string",
          "enum": [
            "TDES_2KEY",
            "TDES_3KEY",
            "AES_128",
            "AES_192",
            "AES_256"
          ],
          "description": "The key type encrypted 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 incoming data decryption, outgoing data encryption, or both."
        },
        "InitializationVector": {
          "type": "string",
          "description": "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."
        }
      },
      "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"
      ]
    },
    "EmvEncryptionAttributes": {
      "type": "object",
      "properties": {
        "MajorKeyDerivationMode": {
          "type": "string",
          "enum": [
            "EMV_OPTION_A",
            "EMV_OPTION_B"
          ],
          "description": "The EMV derivation mode to use for ICC master key derivation as per EMV version 4.3 book 2."
        },
        "PrimaryAccountNumber": {
          "type": "string",
          "description": "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card and associates the card to a specific account holder."
        },
        "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."
        },
        "SessionDerivationData": {
          "type": "string",
          "description": "The derivation value used to derive the ICC session key. It is typically the application transaction counter value padded with zeros or previous ARQC value padded with zeros as per EMV version 4.3 book 2."
        },
        "Mode": {
          "type": "string",
          "enum": [
            "ECB",
            "CBC"
          ],
          "description": "The block cipher method to use for encryption."
        },
        "InitializationVector": {
          "type": "string",
          "description": "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."
        }
      },
      "required": [
        "MajorKeyDerivationMode",
        "PrimaryAccountNumber",
        "PanSequenceNumber",
        "SessionDerivationData"
      ]
    },
    "EncryptionDecryptionAttributes": {
      "type": "object",
      "properties": {
        "Symmetric": {
          "$ref": "#/$defs/SymmetricEncryptionAttributes"
        },
        "Asymmetric": {
          "$ref": "#/$defs/AsymmetricEncryptionAttributes"
        },
        "Dukpt": {
          "$ref": "#/$defs/DukptEncryptionAttributes"
        },
        "Emv": {
          "$ref": "#/$defs/EmvEncryptionAttributes"
        }
      },
      "description": "Exactly one member is set."
    },
    "SymmetricEncryptionAttributes": {
      "type": "object",
      "properties": {
        "Mode": {
          "type": "string",
          "enum": [
            "ECB",
            "CBC",
            "CFB",
            "CFB1",
            "CFB8",
            "CFB64",
            "CFB128",
            "OFB"
          ],
          "description": "The block cipher method to use for encryption."
        },
        "InitializationVector": {
          "type": "string",
          "description": "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."
        },
        "PaddingType": {
          "type": "string",
          "enum": [
            "PKCS1",
            "OAEP_SHA1",
            "OAEP_SHA256",
            "OAEP_SHA512"
          ],
          "description": "The padding to be included with the data."
        }
      },
      "required": [
        "Mode"
      ]
    },
    "WrappedKeyMaterial": {
      "type": "object",
      "properties": {
        "Tr31KeyBlock": {
          "type": "string",
          "description": "The TR-31 wrapped key block."
        },
        "DiffieHellmanSymmetricKey": {
          "$ref": "#/$defs/EcdhDerivationAttributes"
        }
      },
      "description": "Exactly one member is set."
    }
  }
}