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: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" } }

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

Genera un CSC1

Esempio
$ 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" }

Convalida il CSC1

Esempio

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: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 versione 2 di CSC è anche nota come algoritmo CSC avanzato. Il servizio può fornirlo come numero di 3,4 o 5 cifre. Il codice di servizio per CSC2 è in genere 000.

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":"CSC2"},{"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: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" } }

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

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. La data di scadenza è in genere formattata come YYMM. Il codice di servizio può variare: consulta il manuale, ma i valori tipici sono 000, 201 o 702

Esempio
$ 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" }

Convalida il CSC2

Esempio

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: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

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: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" } }

Prendi nota di KeyArn ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east- 1:111122223333: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.

Esempio
$ 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" }

Convalida l'iCSC

Esempio

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: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 }

3DS AVV

3DS AEVV (3-D Secure Account Verification Value) viene utilizzato per l'autenticazione American Express 3-D Secure. Utilizza lo stesso algoritmo CSC2 ma con parametri di input diversi. Il campo della data di scadenza deve essere compilato con un numero imprevedibile (casuale) e il codice di servizio è composto dal codice dei risultati di autenticazione AEVV (1 cifra) più il codice di autenticazione a due fattori (2 cifre). La lunghezza di uscita deve essere di 3 cifre.

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":"3DS_AEVV"},{"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: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" } }

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

Genera un AEVV 3DS

In questo esempio, genereremo un AEVV 3DS con una lunghezza di 3. Il campo della data di scadenza contiene un numero imprevedibile (casuale) (ad esempio 1234) e il codice di servizio è composto dal codice dei risultati di autenticazione AEVV (1 cifra) più il codice di autenticazione di secondo fattore (2 cifre), ad esempio 543 dove 5 è il codice dei risultati di autenticazione e 43 è il codice di autenticazione di secondo fattore. Per American Express, PANs deve essere composto da 15 cifre e iniziare con 34 o 37.

Esempio
$ 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" }

Convalida il 3DS AEVV

Esempio

In questo esempio, convalideremo un AEVV 3DS.

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: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 }