{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-payment-cryptography/json-schema/amazon-payment-cryptography-re-encrypt-data-input-schema.json",
  "title": "ReEncryptDataInput",
  "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/ReEncryptDataInput",
  "type": "object",
  "properties": {
    "IncomingKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the encryption key of incoming ciphertext data. 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."
    },
    "OutgoingKeyIdentifier": {
      "type": "string",
      "description": "The keyARN of the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography."
    },
    "CipherText": {
      "type": "string",
      "description": "Ciphertext to be encrypted. The minimum allowed length is 16 bytes and maximum allowed length is 4096 bytes."
    },
    "IncomingEncryptionAttributes": {
      "$ref": "#/$defs/ReEncryptionAttributes"
    },
    "OutgoingEncryptionAttributes": {
      "$ref": "#/$defs/ReEncryptionAttributes"
    },
    "IncomingWrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    },
    "OutgoingWrappedKey": {
      "$ref": "#/$defs/DataplanePaymentCryptographyWrappedKey"
    }
  },
  "required": [
    "IncomingKeyIdentifier",
    "OutgoingKeyIdentifier",
    "CipherText",
    "IncomingEncryptionAttributes",
    "OutgoingEncryptionAttributes"
  ],
  "$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"
      ]
    },
    "ReEncryptionAttributes": {
      "type": "object",
      "properties": {
        "Symmetric": {
          "$ref": "#/$defs/SymmetricEncryptionAttributes"
        },
        "Asymmetric": {
          "$ref": "#/$defs/AsymmetricEncryptionAttributes"
        },
        "Dukpt": {
          "$ref": "#/$defs/DukptEncryptionAttributes"
        }
      },
      "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."
    }
  }
}