View a markdown version of this page

Funciones específicas de American Express - AWS Criptografía de pagos

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

Funciones específicas de American Express

CSC1

La versión 1 de CSC también se conoce como algoritmo CSC clásico. El servicio puede proporcionarlo como un número de 3,4 o 5 dígitos.

Para ver todos los parámetros disponibles, consulte el AmexCardSecurityCodeVersionpunto 1 en la guía de referencia de la API.

Crear clave

$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_C0_CARD_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CSC1"},{"Key":"CARD_BIN","Value":"12345678"}]'

La respuesta refleja los parámetros de la solicitud, incluyendo un ARN para las llamadas posteriores y un valor de verificación clave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/esh6hn7pxdtttzgq", "KeyAttributes": { "KeyUsage": "TR31_C0_CARD_VERIFICATION_KEY", "KeyClass": "SYMMETRIC_KEY", "KeyAlgorithm": "TDES_2KEY", "KeyModesOfUse": { "Encrypt": false, "Decrypt": false, "Wrap": false, "Unwrap": false, "Generate": true, "Sign": false, "Verify": true, "DeriveKey": false, "NoRestrictions": false } }, "KeyCheckValue": "8B5077", "KeyCheckValueAlgorithm": "ANSI_X9_24", "Enabled": true, "Exportable": true, "KeyState": "CREATE_COMPLETE", "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "CreateTimestamp": "2023-06-05T06:41:46.648000-07:00", "UsageStartTimestamp": "2023-06-05T06:41:46.626000-07:00" } }

Tome nota de lo KeyArn que representa la clave, por ejemplo arn:aws:payment-cryptography:us-east- 2:111122223333:key/esh6hn7pxdtttzgq. Lo necesitará en el siguiente paso.

Genera un CSC1

ejemplo
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/esh6hn7pxdtttzgq --primary-account-number=344131234567848 --generation-attributes AmexCardSecurityCodeVersion1='{CardExpiryDate=1224}' --validation-data-length 4
{ "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/esh6hn7pxdtttzgq", "KeyCheckValue": "8B5077", "ValidationData": "3938" }

Valide el CSC1

ejemplo

En este ejemplo, validaremos un CSC1.

Si la criptografía de AWS pago puede validarse, se devuelve un http/200. Si el valor no se valida, devolverá una respuesta http/400.

$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/esh6hn7pxdtttzgq --primary-account-number=344131234567848 --verification-attributes AmexCardSecurityCodeVersion1='{CardExpiryDate=1224}'' --validation-data 3938
{ "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/esh6hn7pxdtttzgq", "KeyCheckValue": "8B5077" }

CSC2

La versión 2 del CSC también se conoce como algoritmo CSC mejorado. El servicio puede proporcionarlo como un número de 3,4 o 5 dígitos. El código de servicio CSC2 suele ser 000.

Para ver todos los parámetros disponibles, consulte el AmexCardSecurityCodeVersionapartado 2 en la guía de referencia de la API.

Crear clave

$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_C0_CARD_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CSC2"},{"Key":"CARD_BIN","Value":"12345678"}]'

La respuesta refleja los parámetros de la solicitud, incluyendo un ARN para las llamadas posteriores y un valor de verificación clave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/erlm445qvunmvoda", "KeyAttributes": { "KeyUsage": "TR31_C0_CARD_VERIFICATION_KEY", "KeyClass": "SYMMETRIC_KEY", "KeyAlgorithm": "TDES_2KEY", "KeyModesOfUse": { "Encrypt": false, "Decrypt": false, "Wrap": false, "Unwrap": false, "Generate": true, "Sign": false, "Verify": true, "DeriveKey": false, "NoRestrictions": false } }, "KeyCheckValue": "BF1077", "KeyCheckValueAlgorithm": "ANSI_X9_24", "Enabled": true, "Exportable": true, "KeyState": "CREATE_COMPLETE", "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "CreateTimestamp": "2023-06-05T06:41:46.648000-07:00", "UsageStartTimestamp": "2023-06-05T06:41:46.626000-07:00" } }

Tome nota de lo KeyArn que representa la clave, por ejemplo arn:aws:payment-cryptography:us-east- 2:111122223333:key/erlm445qvunmvoda. Lo necesitará en el siguiente paso.

Genera un CSC2

En este ejemplo, generaremos a CSC2 con una longitud de 4. El CSC se puede generar con una longitud de 3,4 o 5. Para American Express, PANs debe tener 15 dígitos y empezar por 34 o 37. La fecha de caducidad suele tener el formato YYMM. El código de servicio puede variar; consulte el manual, pero los valores típicos son 000, 201 o 702

ejemplo
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/erlm445qvunmvoda --primary-account-number=344131234567848 --generation-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=2412,ServiceCode=000}' --validation-data-length 4
{ "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/erlm445qvunmvoda", "KeyCheckValue": "BF1077", "ValidationData": "3982" }

Valide el CSC2

ejemplo

En este ejemplo, validaremos un CSC2.

Si la criptografía de AWS pago puede validarse, se devuelve un http/200. Si el valor no se valida, devolverá una respuesta http/400.

$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/erlm445qvunmvoda --primary-account-number=344131234567848 --verification-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=2412,ServiceCode=000}' --validation-data 3982
{ "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/erlm445qvunmvoda", "KeyCheckValue": "BF1077" }

iCSC

El iCSC también se conoce como algoritmo CSC estático y se calcula con la versión 2 del CSC. El servicio puede proporcionarlo como un número de 3,4 o 5 dígitos.

Use el código de servicio 999 para calcular el iCSC de una tarjeta de contacto. Utilice el código de servicio 702 para calcular el iCSC de una tarjeta sin contacto.

Para ver todos los parámetros disponibles, consulte el apartado AmexCardSecurityCodeVersion2 de la guía de referencia de la API.

Crear clave

$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_C0_CARD_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CSC1"},{"Key":"CARD_BIN","Value":"12345678"}]'

La respuesta refleja los parámetros de la solicitud, incluyendo un ARN para las llamadas posteriores y un valor de verificación clave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-1:111122223333:key/7vrybrbvjcvwtunv", "KeyAttributes": { "KeyUsage": "TR31_C0_CARD_VERIFICATION_KEY" "KeyAlgorithm": "TDES_2KEY", "KeyClass": "SYMMETRIC_KEY", "KeyModesOfUse": { "Decrypt": false, "DeriveKey": false, "Encrypt": false, "Generate": true, "NoRestrictions": false, "Sign": false, "Unwrap": false, "Verify": true, "Wrap": false }, }, "KeyCheckValue": "7121C7", "KeyCheckValueAlgorithm": "ANSI_X9_24", "Enabled": true, "Exportable": true, "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "KeyState": "CREATE_COMPLETE", "CreateTimestamp": "2025-01-29T09:19:21.209000-05:00", "UsageStartTimestamp": "2025-01-29T09:19:21.192000-05:00" } }

Tome nota de lo KeyArn que representa la clave, por ejemplo arn:aws:payment-cryptography:us-east- 1:111122223333:key/7vrybrbvjcvwtunv. Lo necesitará en el siguiente paso.

Genera un iCSC

En este ejemplo, generaremos un iCSC con una longitud de 4 para una tarjeta sin contacto utilizando el código de servicio 702. El CSC se puede generar con una longitud de 3,4 o 5. Para American Express, PANs debe tener 15 dígitos y empezar por 34 o 37.

ejemplo
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-1:111122223333:key/7vrybrbvjcvwtunv --primary-account-number=344131234567848 --generation-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=1224,ServiceCode=702}' --validation-data-length 4
{ "KeyArn": arn:aws:payment-cryptography:us-east-1:111122223333:key/7vrybrbvjcvwtunv, "KeyCheckValue": 7121C7, "ValidationData": "2365" }

Valide el iCSC

ejemplo

En este ejemplo, validaremos un iCSC.

Si la criptografía de AWS pago puede validarse, se devuelve un http/200. Si el valor no se valida, devolverá una respuesta http/400.

$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-1:111122223333:key/7vrybrbvjcvwtunv --primary-account-number=344131234567848 --verification-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=1224,ServiceCode=702}' --validation-data 2365
{ "KeyArn": arn:aws:payment-cryptography:us-east-1:111122223333:key/7vrybrbvjcvwtunv, "KeyCheckValue": 7121C7 }

3D AEVV

El AEVV (valor de verificación de la cuenta 3-D Secure) de 3DS se utiliza para la autenticación 3-D Secure de American Express. Utiliza el mismo algoritmo CSC2 pero con parámetros de entrada diferentes. El campo de fecha de caducidad debe rellenarse con un número impredecible (aleatorio) y el código de servicio consta del código de resultados de la autenticación AEVV (1 dígito) más el código de autenticación de segundo factor (2 dígitos). La longitud de salida debe ser de 3 dígitos.

Para ver todos los parámetros disponibles, consulte el AmexCardSecurityCodeVersionapartado 2 de la guía de referencia de la API.

Crear clave

$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_C0_CARD_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"3DS_AEVV"},{"Key":"CARD_BIN","Value":"12345678"}]'

La respuesta refleja los parámetros de la solicitud, incluyendo un ARN para las llamadas posteriores y un valor de verificación clave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/kw8djn5qxvfh3ztm", "KeyAttributes": { "KeyUsage": "TR31_C0_CARD_VERIFICATION_KEY" "KeyAlgorithm": "TDES_2KEY", "KeyClass": "SYMMETRIC_KEY", "KeyModesOfUse": { "Decrypt": false, "DeriveKey": false, "Encrypt": false, "Generate": true, "NoRestrictions": false, "Sign": false, "Unwrap": false, "Verify": true, "Wrap": false }, }, "KeyCheckValue": "8F3A21", "KeyCheckValueAlgorithm": "ANSI_X9_24", "Enabled": true, "Exportable": true, "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "KeyState": "CREATE_COMPLETE", "CreateTimestamp": "2025-02-02T10:30:15.209000-05:00", "UsageStartTimestamp": "2025-02-02T10:30:15.192000-05:00" } }

Tome nota de lo KeyArn que representa la clave, por ejemplo arn:aws:payment-cryptography:us-east- 2:111122223333:key/kw8djn5qxvfh3ztm. Lo necesitará en el siguiente paso.

Genera un AEVV para 3DS

En este ejemplo, generaremos un AEVV de 3DS con una longitud de 3. El campo de fecha de caducidad contiene un número impredecible (aleatorio) (por ejemplo, 1234) y el código de servicio consta del código de resultados de autenticación AEVV (1 dígito) más el código de autenticación de segundo factor (2 dígitos), por ejemplo, 543, donde 5 es el código de resultados de autenticación y 43 es el código de autenticación de segundo factor. En el caso de American Express, PANs debe tener 15 dígitos y empezar por 34 o 37.

ejemplo
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/kw8djn5qxvfh3ztm --primary-account-number=344131234567848 --generation-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=1234,ServiceCode=543}' --validation-data-length 3
{ "KeyArn": arn:aws:payment-cryptography:us-east-2:111122223333:key/kw8djn5qxvfh3ztm, "KeyCheckValue": 8F3A21, "ValidationData": "921" }

Valide el AEVV de la 3DS

ejemplo

En este ejemplo, validaremos un AEVV de la 3DS.

Si la criptografía de AWS pago puede validarse, se devuelve un http/200. Si el valor no se valida, devolverá una respuesta http/400.

$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/kw8djn5qxvfh3ztm --primary-account-number=344131234567848 --verification-attributes AmexCardSecurityCodeVersion2='{CardExpiryDate=1234,ServiceCode=543}' --validation-data 921
{ "KeyArn": arn:aws:payment-cryptography:us-east-2:111122223333:key/kw8djn5qxvfh3ztm, "KeyCheckValue": 8F3A21 }