Funzioni specifiche di American Express - AWS Crittografia dei pagamenti

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Funzioni specifiche di American Express

CSC1

La versione 1 di CSC è anche nota come algoritmo CSC classico. Il servizio può fornirlo come numero di 3,4 o 5 cifre.

Per tutti i parametri disponibili, vedi AmexCardSecurityCodeVersion1 nella guida di riferimento dell'API.

Crea chiave

$ 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 risposta richiama i parametri della richiesta, tra cui un ARN per le chiamate successive e un Key Check Value (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" } }

Prendi nota di KeyArn ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east-2: :key/esh6hn7pxdtttzgq. Ne hai bisogno nel passaggio successivo.

Genera un 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" }

Convalida il CSC1

In questo esempio, convalideremo un. CSC1

Se AWS Payment Cryptography è in grado di convalidare, viene restituito un http/200. Se il valore non è convalidato, restituirà una risposta 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

La versione 2 di CSC è anche nota come algoritmo CSC avanzato. Il servizio può fornirlo come numero di 3,4 o 5 cifre.

Per tutti i parametri disponibili, vedi AmexCardSecurityCodeVersion2 nella guida di riferimento dell'API.

Crea chiave

$ 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 risposta richiama i parametri della richiesta, tra cui un ARN per le chiamate successive e un Key Check Value (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" } }

Prendi nota di KeyArn ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east-2: :key/erlm445qvunmvoda. Ne hai bisogno nel passaggio successivo.

Genera un CSC2

In questo esempio, genereremo un CSC2 con una lunghezza di 4. CSC può essere generato con una lunghezza di 3,4 o 5. Per American Express, PANs dovrebbe essere composto da 15 cifre e iniziare con 34 o 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" }

Convalida il CSC2

In questo esempio, convalideremo un. CSC2

Se AWS Payment Cryptography è in grado di convalidare, viene restituito un http/200. Se il valore non è convalidato, restituirà una risposta 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

iCSC è anche noto come algoritmo CSC statico e viene calcolato utilizzando CSC versione 2. Il servizio può fornirlo come numero di 3,4 o 5 cifre.

Usa il codice di servizio 999 per calcolare iCSC per una scheda di contatto. Usa il codice di servizio 702 per calcolare iCSC per una carta contactless.

Per tutti i parametri disponibili, vedi AmexCardSecurityCodeVersion2 nella guida di riferimento delle API.

Crea chiave

$ 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 risposta richiama i parametri della richiesta, tra cui un ARN per le chiamate successive e un Key Check Value (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" } }

Prendi nota di KeyArn ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east-1: :key/7vrybrbvjcvwtunv. Ne hai bisogno nella fase successiva.

Genera un iCSC

In questo esempio, genereremo un iCSC con una lunghezza di 4, per una carta contactless utilizzando il codice di servizio 702. CSC può essere generato con una lunghezza di 3,4 o 5. Per American Express, PANs dovrebbe essere composto da 15 cifre e iniziare con 34 o 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" }

Convalida l'iCSC

In questo esempio, convalideremo un iCSC.

Se AWS Payment Cryptography è in grado di convalidare, viene restituito un http/200. Se il valore non è convalidato, restituirà una risposta 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 }