Funções específicas do American Express - AWS Criptografia de pagamento

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Funções específicas do American Express

CSC1

A versão 1 do CSC também é conhecida como o algoritmo clássico do CSC. O serviço pode fornecê-lo como um número de 3,4 ou 5 dígitos.

Para ver todos os parâmetros disponíveis, consulte AmexCardSecurityCodeVersion1 no guia de referência da API.

Criar chave

$ 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"}]'

A resposta reflete os parâmetros da solicitação, incluindo um ARN para chamadas subsequentes, bem como um valor de verificação chave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2::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" } }

Anote o KeyArn que representa a chave, por exemplo, arn:aws:payment-cryptography:us-east-2: :key/esh6hn7pxdtttzgq. Isso será necessário na próxima etapa.

Gere um CSC1

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

Valide o CSC1

Neste exemplo, vamos validar um CSC1.

Se a criptografia AWS de pagamento puder ser validada, um http/200 será retornado. Se o valor não for validado, ele retornará uma resposta http/400.

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

CSC2

A versão 2 do CSC também é conhecida como algoritmo CSC aprimorado. O serviço pode fornecê-lo como um número de 3,4 ou 5 dígitos.

Para todos os parâmetros disponíveis, consulte AmexCardSecurityCodeVersion2 no guia de referência da API.

Criar chave

$ 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"}]'

A resposta reflete os parâmetros da solicitação, incluindo um ARN para chamadas subsequentes, bem como um valor de verificação chave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2::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" } }

Anote o KeyArn que representa a chave, por exemplo, arn:aws:payment-cryptography:us-east-2: :key/erlm445qvunmvoda. Isso será necessário na próxima etapa.

Gere um CSC2

Neste exemplo, geraremos um CSC2 com um comprimento de 4. O CSC pode ser gerado com um comprimento de 3,4 ou 5. Para American Express, PANs deve ter 15 dígitos e começar com 34 ou 37.

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

Valide o CSC2

Neste exemplo, vamos validar um CSC2.

Se a criptografia AWS de pagamento puder ser validada, um http/200 será retornado. Se o valor não for validado, ele retornará uma resposta http/400.

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

iCSC

O iCSC também é conhecido como algoritmo CSC estático e é calculado usando o CSC versão 2. O serviço pode fornecê-lo como um número de 3,4 ou 5 dígitos.

Use o código de serviço 999 para calcular o iCSC para um cartão de contato. Use o código de serviço 702 para calcular o iCSC para um cartão sem contato.

Para todos os parâmetros disponíveis, consulte AmexCardSecurityCodeVersion2 no guia de referência da API.

Criar chave

$ 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"}]'

A resposta reflete os parâmetros da solicitação, incluindo um ARN para chamadas subsequentes, bem como um valor de verificação chave (KCV).

{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-1::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" } }

Anote o KeyArn que representa a chave, por exemplo, arn:aws:payment-cryptography:us-east-1: :key/7vrybrbvjcvwtunv. Isso será necessário na próxima etapa.

Gere um iCSC

Neste exemplo, geraremos um iCSC com um comprimento de 4, para um cartão sem contato usando o código de serviço 702. O CSC pode ser gerado com um comprimento de 3,4 ou 5. Para American Express, PANs deve ter 15 dígitos e começar com 34 ou 37.

$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-1::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::key/7vrybrbvjcvwtunv, "KeyCheckValue": 7121C7, "ValidationData": "2365" }

Validar o iCSC

Neste exemplo, validaremos um iCSC.

Se a criptografia AWS de pagamento puder ser validada, um http/200 será retornado. Se o valor não for validado, ele retornará uma resposta http/400.

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