

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à.

# Casi di utilizzo comune
<a name="use-cases"></a>

AWS La crittografia dei pagamenti supporta molte operazioni crittografiche tipiche dei pagamenti. I seguenti argomenti fungono da guida su come utilizzare queste operazioni per i casi d'uso più comuni. Per un elenco di tutti i comandi, consulta l'API AWS Payment Cryptography.

**Topics**
+ [Emittenti e processori emittenti](use-cases-issuers.md)
+ [Agevolatori di acquisizione e pagamento](use-cases-acquirers.md)

# Emittenti e processori emittenti
<a name="use-cases-issuers"></a>

 I casi d'uso degli emittenti sono generalmente composti da poche parti. Questa sezione è organizzata per funzione (ad esempio lavorare con i pin). In un sistema di produzione, le chiavi sono in genere limitate a un determinato contenitore per schede e vengono create durante la configurazione del contenitore anziché in linea, come illustrato di seguito. 

**Topics**
+ [Funzioni generali](use-cases-issuers.generalfunctions.md)
+ [Funzioni specifiche della rete](use-cases-issuers.networkfunctions.md)

# Funzioni generali
<a name="use-cases-issuers.generalfunctions"></a>

**Topics**
+ [Genera un pin casuale e il PVV associato, quindi verifica il valore](use-cases-issuers.generalfunctions.pvv.md)
+ [Genera o verifica un CVV per una determinata carta](use-cases-issuers.generalfunctions.cvv.md)
+ [Genera o verifica un messaggio CVV2 per una carta specifica](use-cases-issuers.generalfunctions.cvv2.md)
+ [Genera o verifica un iCVV per una scheda specifica](use-cases-issuers.generalfunctions.icvv.md)
+ [Verifica un ARQC EMV e genera un ARPC](use-cases-issuers.generalfunctions.arqc.md)
+ [Genera e verifica un MAC EMV](use-cases-issuers.generalfunctions.emvmac.md)
+ [Genera EMV MAC per la modifica del PIN](use-cases-issuers.generalfunctions.emvpinchange.md)

# Genera un pin casuale e il PVV associato, quindi verifica il valore
<a name="use-cases-issuers.generalfunctions.pvv"></a>

**Topics**
+ [Crea la/le chiave/i](#use-cases-issuers.generalfunctions.pvv.setup)
+ [Genera un pin casuale, genera PVV e restituisci il PIN e il PVV crittografati](#use-cases-issuers.generalfunctions.pvv.generate)
+ [Convalida il PIN crittografato utilizzando il metodo PVV](#use-cases-issuers.generalfunctions.pvv.verify)

## Crea la/le chiave/i
<a name="use-cases-issuers.generalfunctions.pvv.setup"></a>

Per generare un pin casuale e il [PVV](terminology.md#terms.pvv), avrai bisogno di due chiavi, una [chiave di verifica del pin (PVK) per generare il PVV](terminology.md#terms.pvk) e una [chiave di crittografia dei pin](terminology.md#terms.pek) per crittografare il pin. Il pin stesso viene generato casualmente in modo sicuro all'interno del servizio e non è correlato crittograficamente a nessuna delle due chiavi. 

Il PGK deve essere una chiave dell'algoritmo TDES\$12KEY basato sull'algoritmo PVV stesso. Un PEK può essere TDES\$12KEY, TDES\$13KEY o AES\$1128. In questo caso, poiché il PEK è destinato all'uso interno del sistema, AES\$1128 sarebbe una buona scelta. Se un PEK viene utilizzato per l'interscambio con altri sistemi (ad esempio reti di schede, acquirenti ATMs) o viene spostato nell'ambito di una migrazione, TDES\$12KEY può essere la scelta più appropriata per motivi di compatibilità. 

### Crea il PEK
<a name="use-cases-issuers.generalfunctions.pvv.setup.pek"></a>

```
$ aws payment-cryptography create-key \
               --exportable 
               --key-attributes KeyAlgorithm=AES_128,KeyUsage=TR31_P0_PIN_ENCRYPTION_KEY,\
                   KeyClass=SYMMETRIC_KEY,\
                   KeyModesOfUse='{Encrypt=true,Decrypt=true,Wrap=true,Unwrap=true}' --tags='[{"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/ivi5ksfsuplneuyt",
                   "KeyAttributes": {
                       "KeyUsage": "TR31_P0_PIN_ENCRYPTION_KEY",
                       "KeyClass": "SYMMETRIC_KEY",
                       "KeyAlgorithm": "AES_128",
                       "KeyModesOfUse": {
                           "Encrypt": false,
                           "Decrypt": false,
                           "Wrap": false,
                           "Unwrap": false,
                           "Generate": true,
                           "Sign": false,
                           "Verify": true,
                           "DeriveKey": false,
                           "NoRestrictions": false
                       }
                   },
                   "KeyCheckValue": "7CC9E2",
                   "KeyCheckValueAlgorithm": "CMAC",
                   "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/ivi5ksfsuplneuyt.* Ne hai bisogno nella fase successiva.

### Crea il PVK
<a name="use-cases-issuers.generalfunctions.pvv.setup.pvk"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_V2_VISA_PIN_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}'  --tags='[{"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/ov6icy4ryas4zcza",
                      "KeyAttributes": {
                          "KeyUsage": "TR31_V2_VISA_PIN_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": "51A200",
                      "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/ov6icy4ryas4zcza.* Ne hai bisogno nella fase successiva.

## Genera un pin casuale, genera PVV e restituisci il PIN e il PVV crittografati
<a name="use-cases-issuers.generalfunctions.pvv.generate"></a>

**Example**  
In questo esempio, genereremo un nuovo pin (casuale) a 4 cifre in cui le uscite saranno crittografate (. `PIN block` PinData PinBlock) e un `PVV` (PinData. VerificationValue). Gli input chiave sono `PAN` il formato `Pin Verification Key` (noto anche come chiave di generazione dei pin) `Pin Encryption Key` e il formato [PIN Block](terminology.md#terms.pinblock).   
 Questo comando richiede che la chiave sia di tipo`TR31_V2_VISA_PIN_VERIFICATION_KEY`.   

```
$ aws payment-cryptography-data generate-pin-data --generation-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0 --generation-attributes VisaPin={PinVerificationKeyIndex=1}
```

```
{
            "GenerationKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2",
            "GenerationKeyCheckValue": "7F2363",
            "EncryptionKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt",
            "EncryptionKeyCheckValue": "7CC9E2",
            "EncryptedPinBlock": "AC17DC148BDA645E",
            "PinData": {
                "VerificationValue": "5507"
            }
        }
```

## Convalida il PIN crittografato utilizzando il metodo PVV
<a name="use-cases-issuers.generalfunctions.pvv.verify"></a>

**Example**  
In questo esempio, convalideremo un PIN per un determinato PAN. Il PIN viene in genere fornito dal titolare della carta o dall'utente durante il momento della transazione per la convalida e viene confrontato con il valore registrato (l'input del titolare della carta viene fornito come valore crittografato dal terminale o da altro provider a monte). Per convalidare questo input, verranno forniti anche i seguenti valori in fase di esecuzione: il pin crittografato, la chiave utilizzata per crittografare il pin di input (spesso denominato [IWK](terminology.md#terms.iwk)) `PAN` e il valore con cui eseguire la verifica (a `PVV` o`PIN offset`).   
Se AWS Payment Cryptography è in grado di convalidare il pin, viene restituito un http/200. Se il pin non è convalidato, restituirà un http/400.  

```
$ aws payment-cryptography-data verify-pin-data --verification-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0  --verification-attributes VisaPin="{PinVerificationKeyIndex=1,VerificationValue=5507}" --encrypted-pin-block AC17DC148BDA645E 
```

```
{
        "VerificationKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2",
        "VerificationKeyCheckValue": "7F2363",
        "EncryptionKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt",
        "EncryptionKeyCheckValue": "7CC9E2",
}
```

# Genera o verifica un CVV per una determinata carta
<a name="use-cases-issuers.generalfunctions.cvv"></a>

[CVV](terminology.md#terms.cvv) o CVV1 è un valore tradizionalmente incorporato nella banda magnetica di una scheda. Non è lo stesso di CVV2 (visibile al titolare della carta e utilizzabile per gli acquisti online).

Il primo passo è creare una chiave. Per questo tutorial, crei una chiave [CVK](terminology.md#terms.cvk) 3DES (2KEY TDES) a doppia lunghezza. 

**Nota**  
CVV CVV2 e iCVV utilizzano tutti algoritmi simili se non identici, ma variano i dati di input. Tutti utilizzano lo stesso tipo di chiave TR31 \$1C0\$1CARD\$1VERIFICATION\$1KEY, ma si consiglia di utilizzare chiavi separate per ogni scopo. Questi possono essere distinti utilizzando tag alias come nell'esempio seguente. and/or 

## Crea la chiave
<a name="use-cases-issuers.generalfunctions.cvv.setup"></a>

```
$ 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":"CVV"},{"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/r52o3wbqxyf6qlqr",
                "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": "DE89F9",
                "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/r52o3wbqxyf6qlqr.* Ne hai bisogno nel passaggio successivo.

## Genera un CVV
<a name="use-cases-issuers.generalfunctions.cvv.generate"></a>

**Example**  
In questo esempio, genereremo un [CVV](terminology.md#terms.cvv) per un determinato PAN con gli input di`PAN`, un codice di servizio (come definito da ISO/IEC 7813) di 121 e la data di scadenza della carta.   
Per tutti i parametri disponibili, vedi [CardVerificationValue1](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html) nella guida di riferimento dell'API.   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/r52o3wbqxyf6qlqr --primary-account-number=171234567890123 --generation-attributes CardVerificationValue1='{CardExpiryDate=1127,ServiceCode=121}'
```

```
                  {
                      "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/r52o3wbqxyf6qlqr",
                      "KeyCheckValue": "DE89F9",
                      "ValidationData": "801"
                  }
```

## Convalida CVV
<a name="use-cases-issuers.generalfunctions.cvv.verify"></a>

**Example**  
In questo esempio, verificheremo un [CVV](terminology.md#terms.cvv) per un determinato PAN inserendo un CVK, un codice di servizio 121`PAN`, la data di scadenza della carta e il CVV fornito durante la transazione per la convalida.   
[Per tutti i parametri disponibili, consulta il paragrafo 1 nella guida di riferimento delle API. CardVerificationValue](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html)   
CVV non è un valore inserito dall'utente (come CVV2), ma in genere è incorporato in una banda magnetica. Si dovrebbe valutare se debba sempre essere convalidato quando fornito.

```
$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/r52o3wbqxyf6qlqr --primary-account-number=171234567890123 --verification-attributes CardVerificationValue1='{CardExpiryDate=1127,ServiceCode=121} --validation-data 801
```

```
{
                    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/r52o3wbqxyf6qlqr",
                    "KeyCheckValue": "DE89F9",
                    "ValidationData": "801"
}
```

# Genera o verifica un messaggio CVV2 per una carta specifica
<a name="use-cases-issuers.generalfunctions.cvv2"></a>

[CVV2](terminology.md#terms.cvv2)è un valore che viene tradizionalmente indicato sul retro di una carta e viene utilizzato per gli acquisti online. Per le carte virtuali, potrebbe anche essere visualizzato su un'app o su uno schermo. Dal punto di vista crittografico, è uguale CVV1 ma con un valore del codice di servizio diverso.

## Crea la chiave
<a name="use-cases-issuers.generalfunctions.cvv2.setup"></a>

```
$ 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":"CVV2"},{"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/7f7g4spf3xcklhzu",
                   "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": "AEA5CD",
                   "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/7f7g4spf3xcklhzu.* Ne hai bisogno nel passaggio successivo.

## Genera un CVV2
<a name="use-cases-issuers.generalfunctions.cvv2.generate"></a>

**Example**  
In questo esempio, genereremo un codice [CVV2](terminology.md#terms.cvv2)per un determinato PAN con gli input `PAN` e la data di scadenza della carta.   
Per tutti i parametri disponibili, vedi [CardVerificationValue2](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue2.html) nella guida di riferimento delle API.   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/7f7g4spf3xcklhzu --primary-account-number=171234567890123 --generation-attributes CardVerificationValue2='{CardExpiryDate=1127}'
```

```
                     {
                         "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/7f7g4spf3xcklhzu",
                         "KeyCheckValue": "AEA5CD",
                         "ValidationData": "321"
                     }
```

## Convalida un CVV2
<a name="use-cases-issuers.generalfunctions.cvv2.verify"></a>

**Example**  
In questo esempio, verificheremo a [CVV2](terminology.md#terms.cvv2)per un determinato PAN inserendo un CVK, la data di scadenza della carta `PAN` e il CVV fornito durante la transazione per la convalida.   
Per tutti i parametri disponibili, consulta il punto [CardVerificationValue2](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue2.html) nella guida di riferimento delle API.   
CVV2 e gli altri input sono valori immessi dall'utente. Pertanto, non è necessariamente un segno di un problema che questo non riesca periodicamente a convalidare.

```
$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/7f7g4spf3xcklhzu --primary-account-number=171234567890123 --verification-attributes CardVerificationValue2='{CardExpiryDate=1127} --validation-data 321
```

```
{
                       "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/7f7g4spf3xcklhzu",
                       "KeyCheckValue": "AEA5CD",
                       "ValidationData": "801"
   }
```

# Genera o verifica un iCVV per una scheda specifica
<a name="use-cases-issuers.generalfunctions.icvv"></a>

[iCVV](terminology.md#terms.icvv) utilizza lo stesso algoritmo di CVV/ CVV2 ma iCVV è incorporato all'interno di una chip card. Il suo codice di servizio è 999.

## Crea la chiave
<a name="use-cases-issuers.generalfunctions.icvv.setup"></a>

```
$ 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":"ICVV"},{"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/c7dsi763r6s7lfp3",
                   "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": "1201FB",
                   "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/c7dsi763r6s7lfp3.* Ne hai bisogno nel passaggio successivo.

## Genera un iCVV
<a name="use-cases-issuers.generalfunctions.icvv.generate"></a>

**Example**  
In questo esempio, genereremo un [iCVV](terminology.md#terms.icvv) per un determinato PAN con gli input di`PAN`, un codice di servizio (come definito da ISO/IEC 7813) di 999 e la data di scadenza della carta.   
Per tutti i parametri disponibili, vedere [CardVerificationValue1](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html) nella guida di riferimento dell'API.   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/c7dsi763r6s7lfp3 --primary-account-number=171234567890123 --generation-attributes CardVerificationValue1='{CardExpiryDate=1127,ServiceCode=999}'
```

```
                     {
                         "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/c7dsi763r6s7lfp3",
                         "KeyCheckValue": "1201FB",
                         "ValidationData": "532"
                     }
```

## Convalida iCVV
<a name="use-cases-issuers.generalfunctions.icvv.verify"></a>

**Example**  
Per la convalida, gli input sono CVK, un codice di servizio 999`PAN`, la data di scadenza della carta e l'ICVV fornito durante la transazione per la convalida.   
[Per tutti i parametri disponibili, vedere, CardVerificationValue 1 nella guida di riferimento delle API.](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html)   
iCVV non è un valore inserito dall'utente (come CVV2), ma in genere è incorporato in una EMV/chip scheda. Si dovrebbe valutare se debba sempre essere convalidato quando fornito.

```
$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/c7dsi763r6s7lfp3 --primary-account-number=171234567890123 --verification-attributes CardVerificationValue1='{CardExpiryDate=1127,ServiceCode=999} --validation-data 532
```

```
{
                       "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/c7dsi763r6s7lfp3",
                       "KeyCheckValue": "1201FB",
                       "ValidationData": "532"
   }
```

# Verifica un ARQC EMV e genera un ARPC
<a name="use-cases-issuers.generalfunctions.arqc"></a>

[ARQC](terminology.md#terms.arqc) (Authorization Request Cryptogram) è un crittogramma generato da una scheda EMV (chip) e utilizzato per convalidare i dettagli della transazione e l'uso di una carta autorizzata. Incorpora i dati della carta, del terminale e della transazione stessa.

Al momento della convalida sul backend, gli stessi input vengono forniti a AWS Payment Cryptography, il crittogramma viene ricreato internamente e questo viene confrontato con il valore fornito con la transazione. In questo senso, è simile a un MAC. [EMV 4.4 Book 2](https://www.emvco.com/specifications/?post_id=80377) definisce tre aspetti di questa funzione: metodi di derivazione delle chiavi (noti come chiave di sessione comune - CSK) per generare chiavi di transazione monouso, un payload minimo e metodi per generare una risposta (ARPC).

 I singoli schemi di carte possono specificare campi transazionali aggiuntivi da incorporare o l'ordine in cui tali campi vengono visualizzati. Esistono anche altri schemi di derivazione specifici dello schema (generalmente obsoleti), trattati altrove in questa documentazione. 

Per ulteriori informazioni, consulta [VerifyCardValidationData](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_VerifyCardValidationData.html)la guida alle API.

## Crea la chiave
<a name="use-cases-issuers.generalfunctions.arqc.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CVN18"},{"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/pw3s6nl62t5ushfk",
                    "KeyAttributes": {
                        "KeyUsage": "TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS",
                        "KeyClass": "SYMMETRIC_KEY",
                        "KeyAlgorithm": "TDES_2KEY",
                        "KeyModesOfUse": {
                            "Encrypt": false,
                            "Decrypt": false,
                            "Wrap": false,
                            "Unwrap": false,
                            "Generate": false,
                            "Sign": false,
                            "Verify": false,
                            "DeriveKey": true,
                            "NoRestrictions": false
                        }
                    },
                    "KeyCheckValue": "08D7B4",
                    "KeyCheckValueAlgorithm": "ANSI_X9_24",
                    "Enabled": true,
                    "Exportable": true,
                    "KeyState": "CREATE_COMPLETE",
                    "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                    "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                    "UsageStartTimestamp": "2024-03-07T06: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/pw3s6nl62t5ushfk.* Ne hai bisogno nel passaggio successivo.

## Genera un ARQC
<a name="use-cases-issuers.generalfunctions.arqc.generate"></a>

L'ARQC è generato esclusivamente da una scheda EMV. Pertanto, AWS Payment Cryptography non è in grado di generare un payload di questo tipo. A scopo di test, sono disponibili online diverse librerie in grado di generare un payload appropriato oltre a valori noti generalmente forniti dai vari schemi. 

## Convalida un ARQC
<a name="use-cases-issuers.generalfunctions.arqc.verify"></a>

**Example**  
Se AWS Payment Cryptography è in grado di convalidare l'ARQC, viene restituito un http/200. Un ARPC (risposta) può essere fornito facoltativamente e incluso nella risposta dopo la convalida dell'ARQC.  

```
$ aws payment-cryptography-data verify-auth-request-cryptogram --auth-request-cryptogram 61EDCC708B4C97B4 --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk --major-key-derivation-mode EMV_OPTION_A --transaction-data 00000000170000000000000008400080008000084016051700000000093800000B1F2201030000000000000000000000000000000000000000000000000000008000000000000000 --session-key-derivation-attributes='{"EmvCommon":{"ApplicationTransactionCounter":"000B", "PanSequenceNumber":"01","PrimaryAccountNumber":"9137631040001422"}}' --auth-response-attributes='{"ArpcMethod2":{"CardStatusUpdate":"12345678"}}'
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "KeyCheckValue": "08D7B4",
    "AuthResponseValue":"2263AC85"
}
```

# Genera e verifica un MAC EMV
<a name="use-cases-issuers.generalfunctions.emvmac"></a>

EMV MAC è un MAC che utilizza l'input di una chiave derivata EMV e quindi esegue un MAC ISO9797 -3 (Retail) sui dati risultanti. EMV MAC viene in genere utilizzato per inviare comandi a una scheda EMV, ad esempio per sbloccare gli script. 

**Nota**  
 AWS La crittografia dei pagamenti non convalida il contenuto dello script. Consultate il manuale dello schema o della carta per i dettagli sui comandi specifici da includere. 

Per ulteriori informazioni, [MacAlgorithmEmv](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_MacAlgorithmEmv.html)consulta la guida alle API.

**Topics**
+ [Crea la chiave](#use-cases-issuers.generalfunctions.emvmac.setup)
+ [Genera un MAC EMV](#use-cases-issuers.generalfunctions.emvmac.generate)

## Crea la chiave
<a name="use-cases-issuers.generalfunctions.emvmac.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E2_EMV_MKEY_INTEGRITY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CVN18"},{"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/pw3s6nl62t5ushfk",
            "KeyAttributes": {
                "KeyUsage": "TR31_E2_EMV_MKEY_INTEGRITY",
                "KeyClass": "SYMMETRIC_KEY",
                "KeyAlgorithm": "TDES_2KEY",
                "KeyModesOfUse": {
                    "Encrypt": false,
                    "Decrypt": false,
                    "Wrap": false,
                    "Unwrap": false,
                    "Generate": false,
                    "Sign": false,
                    "Verify": false,
                    "DeriveKey": true,
                    "NoRestrictions": false
                }
            },
            "KeyCheckValue": "08D7B4",
            "KeyCheckValueAlgorithm": "ANSI_X9_24",
            "Enabled": true,
            "Exportable": true,
            "KeyState": "CREATE_COMPLETE",
            "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
            "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
            "UsageStartTimestamp": "2024-03-07T06: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/pw3s6nl62t5ushfk.* Ne hai bisogno nel passaggio successivo.

## Genera un MAC EMV
<a name="use-cases-issuers.generalfunctions.emvmac.generate"></a>

Il flusso tipico prevede che un processo di backend generi uno script EMV (ad esempio card unblock), lo firmi utilizzando questo comando (che ricava una chiave monouso specifica per una scheda particolare) e quindi restituisca il MAC. Quindi il comando \$1 MAC viene inviato alla scheda da applicare. L'invio del comando alla carta non rientra nell'ambito della crittografia dei AWS pagamenti. 

**Nota**  
 Questo comando è destinato ai comandi quando non vengono inviati dati crittografati (come il PIN). EMV Encrypt può essere combinato con questo comando per aggiungere dati crittografati allo script dell'emittente prima di richiamare questo comando 

Dati dei messaggi  
I dati del messaggio includono l'intestazione e il comando APDU. Sebbene ciò possa variare in base all'implementazione, questo esempio è l'intestazione APDU per unblock (84 24 00 00 08), seguita da ATC (0007) e quindi ARQC della transazione precedente (999E57 F47CACE). FD0 Il servizio non convalida il contenuto di questo campo.

Modalità di derivazione della chiave di sessione  
Questo campo definisce come viene generata la chiave di sessione. EMV\$1COMMON\$1SESSION\$1KEY viene generalmente utilizzato per le nuove implementazioni, mentre è possibile utilizzare anche EMV2000 \$1 AMEX \$1 MASTERCARD\$1SESSION\$1KEY \$1 VISA. 

MajorKeyDerivationMode  
EMV definisce la modalità A, B o C. La modalità A è la più comune e la crittografia dei pagamenti attualmente supporta la modalità A o la modalità B. AWS 

PAN  
Il numero di conto, generalmente disponibile nel campo del chip 5A o nel ISO8583 campo 2, ma può anche essere recuperato dal sistema della carta.

PSN  
Il numero di sequenza della carta. Se non viene utilizzato, immettere 00.

SessionKeyDerivationValue  
Si tratta dei dati di derivazione per sessione. Può essere l'ultimo ARQC (ApplicationCryptogram) dal campo 9F26 o l'ultimo ATC da 9F36 a seconda dello schema di derivazione.

Padding  
Il padding viene applicato automaticamente e utilizza il metodo di riempimento 9797-1 2. ISO/IEC 

**Example**  

```
$ aws payment-cryptography-data generate-mac --message-data 84240000080007999E57FD0F47CACE --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk --message-data 8424000008999E57FD0F47CACE0007 --generation-attributes EmvMac="{MajorKeyDerivationMode=EMV_OPTION_A,PanSequenceNumber='00',PrimaryAccountNumber='2235521304123282',SessionKeyDerivationMode=EMV_COMMON_SESSION_KEY,SessionKeyDerivationValue={ApplicationCryptogram='999E57FD0F47CACE'}}"
```

```
{
"KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
"KeyCheckValue": "08D7B4",
"Mac":"5652EEDF83EA0D84"
}
```

# Genera EMV MAC per la modifica del PIN
<a name="use-cases-issuers.generalfunctions.emvpinchange"></a>

La modifica del PIN EMV combina due operazioni: generazione di un MAC per uno script emittente e crittografia di un nuovo PIN per la modifica offline del PIN su una chip card EMV. Questo comando è necessario solo in alcuni paesi in cui il pin è memorizzato sulla chip card (questo è comune nei paesi europei). Viene comunemente utilizzato quando il titolare della carta deve modificare il proprio PIN e il nuovo PIN deve essere trasmesso in modo sicuro alla carta insieme a un MAC per verificare l'autenticità del comando. 

**Nota**  
 Se devi solo inviare comandi alla scheda ma non modificare il PIN, prendi in considerazione l'utilizzo dei comandi [ARPC CSU](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_VerifyAuthRequestCryptogram.html) o [Generate](use-cases-issuers.generalfunctions.emvmac.md) EMV MAC. 

Per ulteriori informazioni, consulta la guida [GenerateMacEmvPinChange](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_GenerateMacEmvPinChange.html)alle API.

## Genera un MAC EMV e un PIN crittografato per la modifica del PIN
<a name="use-cases-issuers.generalfunctions.emvpinchange.generate"></a>

Questa operazione richiede due chiavi: una chiave di integrità EMV (: TR31 \$1E2\$1EMV\$1MKEY\$1INTEGRITY) per la generazione MAC e una chiave di riservatezza EMV (KeyUsage: \$1E4\$1EMV\$1MKEY\$1RISERVATEZZA) per la crittografia del PIN. KeyUsage TR31 Il flusso tipico prevede che un processo di backend generi uno script di modifica del PIN EMV, che include sia il MAC per lo script dell'emittente che il nuovo PIN crittografato. Il comando e il PIN crittografato vengono quindi inviati alla scheda per aggiornare il PIN offline. L'invio del comando alla carta non rientra nell'ambito della crittografia dei AWS pagamenti. 

Dati del messaggio  
I dati del messaggio includono il comando APDU per lo script dell'emittente. Il servizio non convalida il contenuto di questo campo.

Nuovo blocco PIN crittografato  
Il nuovo blocco PIN crittografato che verrà inviato alla carta. Questo deve essere fornito come valore crittografato utilizzando una chiave di crittografia PIN.

Nuovo identificatore PIN PEK  
La chiave utilizzata per crittografare il nuovo PIN prima che venga passato a questa API.

Chiave di integrità della messaggistica sicura  
La chiave di integrità EMV (KeyUsage: TR31 \$1E2\$1EMV\$1MKEY\$1INTEGRITY) utilizzata per la generazione di MAC.

Chiave di riservatezza della messaggistica sicura  
La chiave di riservatezza EMV (KeyUsage: TR31 \$1E4\$1EMV\$1MKEY\$1RISERVATEZZA) utilizzata per la crittografia del PIN.

MajorKeyDerivationMode  
EMV definisce la modalità A, B o C. La modalità A è la più comune e la crittografia dei pagamenti attualmente supporta la modalità A o la modalità B. AWS 

Modalità  
La modalità di crittografia, in genere CBC per le operazioni di modifica del PIN.

PAN  
Il numero di conto, generalmente disponibile nel campo del chip 5A o ISO8583 nel campo 2, ma può anche essere recuperato dal sistema della carta.

PanSequenceNumber  
Il numero di sequenza della carta. Se non viene utilizzato, immettere 00.

ApplicationCryptogram  
Si tratta dei dati di derivazione per sessione, in genere l'ultimo ARQC dal campo 9F26.

PinBlockLengthPosition  
Speciifica dove viene codificata la lunghezza del blocco PIN. In genere impostato su NONE. Controlla le specifiche del tuo schema di carte se non sei sicuro.

PinBlockPaddingType  
Speciifica il tipo di imbottitura per il blocco PIN. In genere impostato su NO\$1PADDING. Controlla le specifiche del tuo schema di carte se non sei sicuro.

**Example**  

```
$ aws payment-cryptography-data generate-mac-emv-pin-change \
    --message-data 00A4040008A000000004101080D80500000001010A04000000000000 \
    --new-encrypted-pin-block 67FB27C75580EFE7 \
    --new-pin-pek-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt \
    --pin-block-format ISO_FORMAT_0 \
    --secure-messaging-confidentiality-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/tqv5yij6wtxx64pi \
    --secure-messaging-integrity-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk \
    --derivation-method-attributes 'EmvCommon={ApplicationCryptogram=1234567890123457,MajorKeyDerivationMode=EMV_OPTION_A,Mode=CBC,PanSequenceNumber=00,PinBlockLengthPosition=NONE,PinBlockPaddingType=NO_PADDING,PrimaryAccountNumber=171234567890123}'
```

```
{
    "SecureMessagingIntegrityKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "SecureMessagingIntegrityKeyCheckValue": "08D7B4",
    "SecureMessagingConfidentialityKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/tqv5yij6wtxx64pi",
    "SecureMessagingConfidentialityKeyCheckValue": "C1EB8F",
    "Mac": "5652EEDF83EA0D84",
    "EncryptedPinBlock": "F1A2B3C4D5E6F7A8"
}
```

# Funzioni specifiche della rete
<a name="use-cases-issuers.networkfunctions"></a>

**Topics**
+ [Funzioni specifiche del visto](use-cases-issuers.networkfunctions.visa.md)
+ [Funzioni specifiche di Mastercard](use-cases-issuers.networkfunctions.mastercard.md)
+ [Funzioni specifiche di American Express](use-cases-issuers.networkfunctions.amex.md)
+ [Funzioni specifiche di JCB](use-cases-issuers.networkfunctions.jcb.md)

# Funzioni specifiche del visto
<a name="use-cases-issuers.networkfunctions.visa"></a>

**Topics**
+ [ARQC -/ CVN18CVN22](#use-cases-issuers.networkfunctions.visa.cvn18)
+ [ARQC - CVN10](#use-cases-issuers.networkfunctions.visa.cvn10)
+ [3DS CAVV V7](#use-cases-issuers.networkfunctions.visa.cavv-v7)
+ [dCVV (Dynamic Card Verification Value) - CVN17](#use-cases-issuers.networkfunctions.visa.dcvv)

## ARQC -/ CVN18CVN22
<a name="use-cases-issuers.networkfunctions.visa.cvn18"></a>

CVN18 e CVN22 utilizza il [metodo CSK di derivazione](use-cases-issuers.generalfunctions.arqc.md) delle chiavi. I dati esatti della transazione variano tra questi due metodi: consulta la documentazione dello schema per i dettagli sulla costruzione del campo dei dati della transazione.

## ARQC - CVN10
<a name="use-cases-issuers.networkfunctions.visa.cvn10"></a>

CVN10 è un vecchio metodo Visa per le transazioni EMV che utilizza la derivazione per chiave della carta anziché la derivazione per sessione (per transazione) e utilizza anche un payload diverso. Per informazioni sul contenuto del payload, si prega di contattare lo schema per ulteriori dettagli.

### Crea chiave
<a name="use-cases-issuers.networkfunctions.visa.cvn10.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CVN10"},{"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/pw3s6nl62t5ushfk",
                "KeyAttributes": {
                    "KeyUsage": "TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS",
                    "KeyClass": "SYMMETRIC_KEY",
                    "KeyAlgorithm": "TDES_2KEY",
                    "KeyModesOfUse": {
                        "Encrypt": false,
                        "Decrypt": false,
                        "Wrap": false,
                        "Unwrap": false,
                        "Generate": false,
                        "Sign": false,
                        "Verify": false,
                        "DeriveKey": true,
                        "NoRestrictions": false
                    }
                },
                "KeyCheckValue": "08D7B4",
                "KeyCheckValueAlgorithm": "ANSI_X9_24",
                "Enabled": true,
                "Exportable": true,
                "KeyState": "CREATE_COMPLETE",
                "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                "UsageStartTimestamp": "2024-03-07T06: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/pw3s6nl62t5ushfk.* Ne hai bisogno nel passaggio successivo.

### Convalida l'ARQC
<a name="use-cases-issuers.networkfunctions.visa.cvn10.validation"></a>

**Example**  
In questo esempio, convalideremo un ARQC generato utilizzando Visa. CVN10   
Se AWS Payment Cryptography è in grado di convalidare l'ARQC, viene restituito un http/200. Se l'arqc non è convalidato, restituirà una risposta http/400.  

```
$ aws payment-cryptography-data verify-auth-request-cryptogram --auth-request-cryptogram D791093C8A921769 \
  --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk \
  --major-key-derivation-mode EMV_OPTION_A \ 
  --transaction-data 00000000170000000000000008400080008000084016051700000000093800000B03011203000000 \
  --session-key-derivation-attributes='{"Visa":{"PanSequenceNumber":"01" \ 
  ,"PrimaryAccountNumber":"9137631040001422"}}'
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "KeyCheckValue": "08D7B4"
  }
```

## 3DS CAVV V7
<a name="use-cases-issuers.networkfunctions.visa.cavv-v7"></a>

Per le transazioni Visa Secure (3DS), l'Access Control Server (ACS) dell'emittente genera un CAVV (Cardholder Authentication Verification Value). Il CAVV è la prova che l'autenticazione del titolare della carta è avvenuta, è unico per ogni transazione di autenticazione e viene fornito dall'acquirente nel messaggio di autorizzazione. CAVV v7 vincola all'approvazione i dati aggiuntivi sulla transazione, inclusi elementi come il nome del commerciante, l'importo dell'acquisto e la data di acquisto. In questo modo, è effettivamente un hash crittografico del payload della transazione.

Dal punto di vista crittografico, CAVV V7 utilizza l'algoritmo CVV, ma gli input sono stati tutti una changed/repurposed. Please consult appropriate third party/Visa documentazione su come produrre gli input per generare un payload CAVV V7.

### Crea la chiave
<a name="use-cases-issuers.networkfunctions.visa.cavv-v7.setup"></a>

```
$ 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":"CAVV-V7"},{"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/dnaeyrjgdjjtw6dk",
                "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": "F3FB13",
                "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/dnaeyrjgdjjtw6dk.* Ne hai bisogno nel passaggio successivo.

### Genera un CAVV V7
<a name="use-cases-issuers.networkfunctions.visa.cavv-v7.generate"></a>

**Example**  
In questo esempio, genereremo un CAVV V7 per una determinata transazione con input come specificato nelle specifiche. Nota che per questo algoritmo, i campi possono essere riutilizzati/riutilizzati, quindi non si deve presumere che le etichette dei campi corrispondano agli input.   
Per tutti i parametri disponibili, vedi [CardVerificationValue1](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html) nella guida di riferimento delle API.   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/dnaeyrjgdjjtw6dk --primary-account-number=171234567890123 --generation-attributes CardVerificationValue1='{CardExpiryDate=9431,ServiceCode=431}'
```

```
              {
                  "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/dnaeyrjgdjjtw6dk",
                  "KeyCheckValue": "F3FB13",
                  "ValidationData": "491"
              }
```

### Convalida CAVV V7
<a name="use-cases-issuers.networkfunctions.visa.cavv-v7.verify"></a>

**Example**  
Per la convalida, gli input sono CVK, i valori di input calcolati e il CAVV fornito durante la transazione per la convalida.   
[Per tutti i parametri disponibili, vedere, CardVerificationValue 1 nella guida di riferimento delle API.](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_CardVerificationValue1.html)   
CAVV non è un valore inserito dall'utente (come CVV2) ma viene calcolato dall'emittente ACS. Si dovrebbe valutare se debba sempre essere convalidato quando fornito.

```
$ aws payment-cryptography-data verify-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/dnaeyrjgdjjtw6dk --primary-account-number=171234567890123 --verification-attributes CardVerificationValue1='{CardExpiryDate=9431,ServiceCode=431} --validation-data 491
```

```
{
                "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/dnaeyrjgdjjtw6dk",
                "KeyCheckValue": "F3FB13",
                "ValidationData": "491"
}
```

## dCVV (Dynamic Card Verification Value) - CVN17
<a name="use-cases-issuers.networkfunctions.visa.dcvv"></a>

dCVV (dynamic Card Verification Value) è un crittogramma dinamico specifico per Visa utilizzato per le transazioni EMV senza contatto. È noto come uno dei primi EMV e offre una maggiore sicurezza generando un valore di verifica unico per ogni transazione. Il dCvv utilizza input tra cui il Primary Account Number (PAN), il PAN Sequence Number (PSN), l'Application Transaction Counter (ATC), il numero imprevedibile e i dati di traccia. È ancora utilizzato in alcuni luoghi, ma è stato per lo più sostituito da altri algoritmi come. CVN18

Per tutti i parametri disponibili, [DynamicCardVerificationValue](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_DynamicCardVerificationValue.html)consulta la guida di riferimento delle API.

### Crea chiave
<a name="use-cases-issuers.networkfunctions.visa.dcvv.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E4_EMV_MKEY_DYNAMIC_NUMBERS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"DCVV"},{"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/mw7dn3qxvkfh8ztc",
                "KeyAttributes": {
                    "KeyUsage": "TR31_E4_EMV_MKEY_DYNAMIC_NUMBERS",
                    "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": "A8E4D2",
                "KeyCheckValueAlgorithm": "ANSI_X9_24",
                "Enabled": true,
                "Exportable": true,
                "KeyState": "CREATE_COMPLETE",
                "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                "CreateTimestamp": "2025-02-02T11:45:30.648000-08:00",
                "UsageStartTimestamp": "2025-02-02T11:45:30.626000-08:00"
            }
        }
```

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

### Genera un dCVV
<a name="use-cases-issuers.networkfunctions.visa.dcvv.generate"></a>

**Example**  
In questo esempio, genereremo un dCVV per una transazione EMV senza contatto. Gli input includono il PAN, il numero di sequenza PAN, l'Application Transaction Counter, il numero imprevedibile e i dati di traccia.   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/mw7dn3qxvkfh8ztc \
    --primary-account-number=5111112627662122 \
    --generation-attributes DynamicCardVerificationValue='{ApplicationTransactionCounter=01,PanSequenceNumber=00,TrackData=12345,UnpredictableNumber=123}' \
    --validation-data-length 5
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/mw7dn3qxvkfh8ztc",
    "KeyCheckValue": "A8E4D2",
    "ValidationData": "36667"
}
```

### Convalida dCVV
<a name="use-cases-issuers.networkfunctions.visa.dcvv.verify"></a>

**Example**  
In questo esempio, convalideremo un DCVV fornito durante una transazione. Gli stessi input utilizzati per la generazione devono essere forniti per la convalida.   
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/mw7dn3qxvkfh8ztc \
    --primary-account-number=5111112627662122 \
    --validation-data=36667 \
    --verification-attributes DynamicCardVerificationValue='{ApplicationTransactionCounter=01,PanSequenceNumber=00,TrackData=12345,UnpredictableNumber=123}'
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/mw7dn3qxvkfh8ztc",
    "KeyCheckValue": "A8E4D2"
}
```

# Funzioni specifiche di Mastercard
<a name="use-cases-issuers.networkfunctions.mastercard"></a>

**Topics**
+ [DCVC3](#use-cases-issuers.networkfunctions.mastercard.dcvc)
+ [ARQC -/ CVN14CVN15](#use-cases-issuers.networkfunctions.mastercard.cvn14)
+ [ARQC -/ CVN12CVN13](#use-cases-issuers.networkfunctions.mastercard.cvn12)
+ [3DS AAV SPA2](#use-cases-issuers.networkfunctions.mastercard.spa2aav)

## DCVC3
<a name="use-cases-issuers.networkfunctions.mastercard.dcvc"></a>

DCVC3 è antecedente agli CVN12 schemi EMV CSK e Mastercard e rappresenta un altro approccio all'utilizzo delle chiavi dinamiche. A volte viene riutilizzato anche per altri casi d'uso. In questo schema, gli input sono dati PAN, PSN, Track1/Track2, un numero imprevedibile e un contatore di transazioni (ATC).

### Crea chiave
<a name="use-cases-issuers.networkfunctions.mastercard.dcvc3.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E4_EMV_MKEY_DYNAMIC_NUMBERS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"DCVC3"},{"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/hrh6qgbi3sk4y3wq",
                "KeyAttributes": {
                    "KeyUsage": "TR31_E4_EMV_MKEY_DYNAMIC_NUMBERS",
                    "KeyClass": "SYMMETRIC_KEY",
                    "KeyAlgorithm": "TDES_2KEY",
                    "KeyModesOfUse": {
                        "Encrypt": false,
                        "Decrypt": false,
                        "Wrap": false,
                        "Unwrap": false,
                        "Generate": false,
                        "Sign": false,
                        "Verify": false,
                        "DeriveKey": true,
                        "NoRestrictions": false
                    }
                },
                "KeyCheckValue": "08D7B4",
                "KeyCheckValueAlgorithm": "ANSI_X9_24",
                "Enabled": true,
                "Exportable": true,
                "KeyState": "CREATE_COMPLETE",
                "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                "UsageStartTimestamp": "2024-03-07T06: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/hrh6qgbi3sk4y3wq.* Ne hai bisogno nel passaggio successivo.

### Genera un DCVC3
<a name="use-cases-issuers.networkfunctions.mastercard.dcvc3.generate"></a>

**Example**  
Sebbene DCVC3 sia generalmente generato da una chip card, può anche essere generato manualmente, come in questo esempio   

```
$ aws payment-cryptography-data generate-card-validation-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk --primary-account-number=5413123456784808 --generation-attributes DynamicCardVerificationCode='{ApplicationTransactionCounter=0000,TrackData=5241060000000069D13052020000000000003F,PanSequenceNumber=00,UnpredictableNumber=00000000}''
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "KeyCheckValue": "08D7B4",
    "ValidationData": "865"
  }
```

### Convalida il DCVC3
<a name="use-cases-issuers.networkfunctions.mastercard.dcvc3.validation"></a>

**Example**  
In questo esempio, convalideremo un. DCVC3 Nota che ATC dovrebbe essere fornito come numero esadecimale, ad esempio un contatore di 11 dovrebbe essere rappresentato come 000B. Il servizio prevede un valore a 3 cifre DCVC3, quindi se hai memorizzato un valore di 4 (o 5) cifre, tronca semplicemente i caratteri a sinistra fino a ottenere 3 cifre (ad esempio 15321 dovrebbe avere un valore dei dati di convalida pari a 321).   
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/pw3s6nl62t5ushfk --primary-account-number=5413123456784808 --verification-attributes DynamicCardVerificationCode='{ApplicationTransactionCounter=000B,TrackData=5241060000000069D13052020000000000003F,PanSequenceNumber=00,UnpredictableNumber=00000001}' --validation-data 398
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "KeyCheckValue": "08D7B4"
  }
```

## ARQC -/ CVN14CVN15
<a name="use-cases-issuers.networkfunctions.mastercard.cvn14"></a>

CVN14 e CVN15 utilizza il metodo [EMV CSK](use-cases-issuers.generalfunctions.arqc.md) di derivazione delle chiavi. I dati esatti delle transazioni variano tra questi due metodi: consulta la documentazione dello schema per i dettagli sulla costruzione del campo dei dati delle transazioni.

## ARQC -/ CVN12CVN13
<a name="use-cases-issuers.networkfunctions.mastercard.cvn12"></a>

CVN12 e CVN13 sono un vecchio metodo specifico di MasterCard per le transazioni EMV che incorporano un numero imprevedibile nella derivazione per transazione e utilizzano anche un payload diverso. Per informazioni sul contenuto del payload, si prega di contattare lo schema.

### Crea chiave
<a name="use-cases-issuers.networkfunctions.mastercard.cvn12.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CVN12"},{"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/pw3s6nl62t5ushfk",
                "KeyAttributes": {
                    "KeyUsage": "TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS",
                    "KeyClass": "SYMMETRIC_KEY",
                    "KeyAlgorithm": "TDES_2KEY",
                    "KeyModesOfUse": {
                        "Encrypt": false,
                        "Decrypt": false,
                        "Wrap": false,
                        "Unwrap": false,
                        "Generate": false,
                        "Sign": false,
                        "Verify": false,
                        "DeriveKey": true,
                        "NoRestrictions": false
                    }
                },
                "KeyCheckValue": "08D7B4",
                "KeyCheckValueAlgorithm": "ANSI_X9_24",
                "Enabled": true,
                "Exportable": true,
                "KeyState": "CREATE_COMPLETE",
                "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                "UsageStartTimestamp": "2024-03-07T06: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/pw3s6nl62t5ushfk.* Ne hai bisogno nel passaggio successivo.

### Convalida l'ARQC
<a name="use-cases-issuers.networkfunctions.mastercard.cvn12.validation"></a>

**Example**  
In questo esempio, convalideremo un ARQC generato utilizzando Mastercard. CVN12   
Se AWS Payment Cryptography è in grado di convalidare l'ARQC, viene restituito un http/200. Se l'arqc non è convalidato, restituirà una risposta http/400.  

```
$ aws payment-cryptography-data verify-auth-request-cryptogram --auth-request-cryptogram 31BE5D49F14A5F01 \
  --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk \
  --major-key-derivation-mode EMV_OPTION_A \ 
  --transaction-data 00000000170000000000000008400080008000084016051700000000093800000B1F2201030000000000000000000000000000000000000000000000000000008000000000000000 \
  --session-key-derivation-attributes='{"MastercardSessionKey":{"ApplicationTransactionCounter":"000B","PanSequenceNumber":"01","PrimaryAccountNumber":"5413123456784808","UnpredictableNumber":"00000001"}}'
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
    "KeyCheckValue": "08D7B4"
  }
```

## 3DS AAV SPA2
<a name="use-cases-issuers.networkfunctions.mastercard.spa2aav"></a>

SPA2 AAV (Account Authentication Value) viene utilizzato per le transazioni con Mastercard 3DS (noto anche come Mastercard Idenity Check). Fornisce l'autenticazione crittografica per le transazioni di e-commerce utilizzando la generazione MAC basata su HMAC. L'AAV viene generato utilizzando dati specifici della transazione e una chiave segreta condivisa.

### Crea chiave
<a name="use-cases-issuers.networkfunctions.mastercard.spa2aav.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=HMAC_SHA256,KeyUsage=TR31_M7_HMAC_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"SPA2_AAV"},{"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-west-2:111122223333:key/q5vjtshsg67cz5gn",
                "KeyAttributes": {
                    "KeyUsage": "TR31_M7_HMAC_KEY",
                    "KeyClass": "SYMMETRIC_KEY",
                    "KeyAlgorithm": "HMAC_SHA256",
                    "KeyModesOfUse": {
                        "Encrypt": false,
                        "Decrypt": false,
                        "Wrap": false,
                        "Unwrap": false,
                        "Generate": true,
                        "Sign": false,
                        "Verify": true,
                        "DeriveKey": false,
                        "NoRestrictions": false
                    }
                },
                "KeyCheckValue": "C661F9",
                "KeyCheckValueAlgorithm": "HMAC",
                "Enabled": true,
                "Exportable": true,
                "KeyState": "CREATE_COMPLETE",
                "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                "UsageStartTimestamp": "2024-03-07T06:41:46.626000-07:00"
            }
        }
```

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

### Genera SPA2 AAV
<a name="use-cases-issuers.networkfunctions.mastercard.spa2aav.generate"></a>

**Example**  
In questo esempio, genereremo il componente Issuer Authentication Value ( SPA2 IAV) dell'AAV utilizzando la generazione MAC HMAC. I dati del messaggio contengono le informazioni specifiche della transazione che verranno autenticate. Il formato dei dati dei messaggi deve seguire le SPA2 specifiche di Mastercard e non è trattato in questo esempio.  
Consulta le specifiche della tua Mastercard per la formattazione necessaria per inserire lo IAV nel valore AAV.

```
$ aws payment-cryptography-data generate-mac --key-identifier arn:aws:payment-cryptography:us-west-2:111122223333:key/q5vjtshsg67cz5gn --message-data "2226400099919520FFFFd8b448be65694fe7b42f836bad396e9d" --generation-attributes Algorithm=HMAC --region us-west-2
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-west-2:111122223333:key/q5vjtshsg67cz5gn",
    "KeyCheckValue": "C661F9",
    "Mac": "6FB2405E9D8A4C1F7B173F73ADD1A6DC358531CAB0E9994FC5B62012ADDE91FC"
}
```

### SPA2 Verifica AAV
<a name="use-cases-issuers.networkfunctions.mastercard.spa2aav.verify"></a>

**Example**  
In questo esempio, verificheremo un SPA2 AAV. Per la verifica vengono forniti gli stessi dati del messaggio e lo stesso valore MAC.  
Se AWS Payment Cryptography è in grado di convalidare il MAC, viene restituito un http/200. Se il MAC non è convalidato, restituirà una risposta http/400.  

```
$ aws payment-cryptography-data verify-mac --key-identifier arn:aws:payment-cryptography:us-west-2:111122223333:key/q5vjtshsg67cz5gn --message-data "2226400099919520FFFFd8b448be65694fe7b42f836bad396e9d" --mac "6FB2405E9D8A4C1F7B173F73ADD1A6DC358531CAB0E9994FC5B62012ADDE91FC" --verification-attributes Algorithm=HMAC --region us-west-2
```

```
{
    "KeyArn": "arn:aws:payment-cryptography:us-west-2:111122223333:key/q5vjtshsg67cz5gn",
    "KeyCheckValue": "C661F9"
}
```

# Funzioni specifiche di American Express
<a name="use-cases-issuers.networkfunctions.amex"></a>

**Topics**
+ [CSC1](#use-cases-issuers.networkfunctions.amex.csc)
+ [CSC2](#use-cases-issuers.networkfunctions.amex.csc2)
+ [iCSC](#use-cases-issuers.networkfunctions.amex.csc3)
+ [3DS AVV](#use-cases-issuers.networkfunctions.amex.3dsaevv)

## CSC1
<a name="use-cases-issuers.networkfunctions.amex.csc"></a>

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](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_AmexCardSecurityCodeVersion1.html) nella guida di riferimento dell'API. 

### Crea chiave
<a name="use-cases-issuers.networkfunctions.amex.csc.setup"></a>

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.csc1.generate"></a>

**Example**  

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.csc1.validation"></a>

**Example**  
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
<a name="use-cases-issuers.networkfunctions.amex.csc2"></a>

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](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_AmexCardSecurityCodeVersion2.html) nella guida di riferimento delle API. 

### Crea chiave
<a name="use-cases-issuers.networkfunctions.amex.csc2.setup"></a>

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.csc2.generate"></a>

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

**Example**  

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.csc2.validation"></a>

**Example**  
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
<a name="use-cases-issuers.networkfunctions.amex.csc3"></a>

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](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_AmexCardSecurityCodeVersion2.html) nella guida di riferimento delle API. 

### Crea chiave
<a name="use-cases-issuers.networkfunctions.amex.csc3.setup"></a>

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.icsc.generate"></a>

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.

**Example**  

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.icsc.validation"></a>

**Example**  
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
<a name="use-cases-issuers.networkfunctions.amex.3dsaevv"></a>

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](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_AmexCardSecurityCodeVersion2.html) nella guida di riferimento delle API. 

### Crea chiave
<a name="use-cases-issuers.networkfunctions.amex.3dsaevv.setup"></a>

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.3dsaevv.generate"></a>

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.

**Example**  

```
$ 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
<a name="use-cases-issuers.networkfunctions.amex.3dsaevv.validation"></a>

**Example**  
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
}
```

# Funzioni specifiche di JCB
<a name="use-cases-issuers.networkfunctions.jcb"></a>

**Topics**
+ [ARQC - CVN04](#use-cases-issuers.networkfunctions.jcb.cvn04)
+ [ARQC - CVN01](#use-cases-issuers.networkfunctions.jcb.cvn01)

## ARQC - CVN04
<a name="use-cases-issuers.networkfunctions.jcb.cvn04"></a>

JCB CVN04 utilizza il metodo CSK di derivazione delle [chiavi](use-cases-issuers.generalfunctions.arqc.md). Consulta la documentazione dello schema per i dettagli sulla costruzione del campo dei dati della transazione.

## ARQC - CVN01
<a name="use-cases-issuers.networkfunctions.jcb.cvn01"></a>

CVN01 è un vecchio metodo JCB per le transazioni EMV che utilizza la derivazione per chiave della carta anziché la derivazione per sessione (per transazione) e utilizza anche un payload diverso. Questo messaggio viene utilizzato anche da Visa, quindi il nome dell'elemento ha quel nome anche se viene utilizzato anche per JCB. Per informazioni sul contenuto del payload, si prega di contattare la documentazione dello schema.

### Crea chiave
<a name="use-cases-issuers.networkfunctions.jcb.cvn01.setup"></a>

```
$ aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{DeriveKey=true}' --tags='[{"Key":"KEY_PURPOSE","Value":"CVN10"},{"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/pw3s6nl62t5ushfk",
                            "KeyAttributes": {
                                "KeyUsage": "TR31_E0_EMV_MKEY_APP_CRYPTOGRAMS",
                                "KeyClass": "SYMMETRIC_KEY",
                                "KeyAlgorithm": "TDES_2KEY",
                                "KeyModesOfUse": {
                                    "Encrypt": false,
                                    "Decrypt": false,
                                    "Wrap": false,
                                    "Unwrap": false,
                                    "Generate": false,
                                    "Sign": false,
                                    "Verify": false,
                                    "DeriveKey": true,
                                    "NoRestrictions": false
                                }
                            },
                            "KeyCheckValue": "08D7B4",
                            "KeyCheckValueAlgorithm": "ANSI_X9_24",
                            "Enabled": true,
                            "Exportable": true,
                            "KeyState": "CREATE_COMPLETE",
                            "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY",
                            "CreateTimestamp": "2024-03-07T06:41:46.648000-07:00",
                            "UsageStartTimestamp": "2024-03-07T06: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/pw3s6nl62t5ushfk.* Ne hai bisogno nel passaggio successivo.

### Convalida l'ARQC
<a name="use-cases-issuers.networkfunctions.jcb.cvn01.validation"></a>

**Example**  
In questo esempio, convalideremo un ARQC generato utilizzando JCB. CVN01 Questo utilizza le stesse opzioni del metodo Visa, da cui il nome del parametro.   
Se AWS Payment Cryptography è in grado di convalidare l'ARQC, viene restituito un http/200. Se l'arqc non è convalidato, restituirà una risposta http/400.  

```
$ aws payment-cryptography-data verify-auth-request-cryptogram --auth-request-cryptogram D791093C8A921769 \
              --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk \
              --major-key-derivation-mode EMV_OPTION_A \ 
              --transaction-data 00000000170000000000000008400080008000084016051700000000093800000B03011203000000 \
              --session-key-derivation-attributes='{"Visa":{"PanSequenceNumber":"01" \ 
              ,"PrimaryAccountNumber":"9137631040001422"}}'
```

```
{
                "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/pw3s6nl62t5ushfk",
                "KeyCheckValue": "08D7B4"
              }
```

# Agevolatori di acquisizione e pagamento
<a name="use-cases-acquirers"></a>

Gli acquirenti PSPs e i facilitatori di pagamento hanno in genere una serie di requisiti crittografici diversi rispetto agli emittenti. Casi di utilizzo comune comprendono: 

**Decrittografia dei dati**  <a name="use-cases-acquirers.decryptdata"></a>
I dati (in particolare i dati pan) possono essere crittografati da un terminale di pagamento e devono essere decrittografati dal backend. [Decrypt Data e Encrypt Data](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_DecryptData.html) supportano una varietà di metodi, tra cui tecniche di derivazione TDES, AES e DUKPT. Il servizio AWS Payment Cryptography stesso è inoltre conforme allo standard PCI P2PE ed è registrato come componente di decrittografia PCI P2PE. 

**TranslatePin**  <a name="use-cases-acquirers.translatepin"></a>
Per mantenere la conformità al PCI PIN, i sistemi di acquisizione non devono avere i PIN del titolare della carta in chiaro dopo che sono stati inseriti su un dispositivo sicuro. Pertanto, per trasferire il pin dal terminale a un sistema a valle (come una rete di pagamento o un emittente), è necessario ricrittografarlo utilizzando una chiave diversa da quella utilizzata dal terminale di pagamento. [Translate Pin](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_TranslatePinData.html) lo fa convertendo un pin crittografato da una chiave all'altra in modo sicuro con il servicebbb. Utilizzando questo comando, i pin possono essere convertiti tra vari schemi come la derivazione TDES, AES e DUKPT e formati di blocchi di pin come ISO-0, ISO-3 e ISO-4. 

**VerifyMac**  <a name="use-cases-acquirers.verifymac"></a>
I dati di un terminale di pagamento possono essere sottoposti a MAC per garantire che non siano stati modificati durante il transito. [Verify Mac](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_VerifyMac.html) GenerateMac supporta una varietà di tecniche che utilizzano chiavi simmetriche, tra cui tecniche di derivazione TDES, AES e DUKPT da utilizzare con l'algoritmo 1 ISO-9797-1, l'algoritmo 3 ISO-9797-1 (Retail MAC) e le tecniche CMAC. 

**Topics**
+ [Uso dei tasti dinamici](use-cases-acquirers-dynamickeys.md)

# Uso dei tasti dinamici
<a name="use-cases-acquirers-dynamickeys"></a>

 Dynamic Keys consente di utilizzare chiavi monouso o a uso limitato per operazioni crittografiche come. `[EncryptData](https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_EncryptData.html)` Questo flusso può essere utilizzato quando il materiale chiave ruota frequentemente (ad esempio in ogni transazione con carta) e si desidera evitare di importare il materiale chiave nel servizio. [Le chiavi di breve durata possono essere utilizzate come parte di SoftPOS/mPOC o di altre soluzioni.](terminology.md#terms.mpoc) 

**Nota**  
 Questo può essere utilizzato al posto del flusso tipico che utilizza la crittografia dei AWS pagamenti, in cui le chiavi crittografiche vengono create o importate nel servizio e le chiavi vengono specificate utilizzando un alias di chiave o una chiave arn. 

Le seguenti operazioni supportano Dynamic Keys:
+ EncryptData
+ DecryptData
+ ReEncryptData
+ TranslatePin

## Decrittografia dei dati
<a name="use-case-acquirers-dynamickeys.examples.decryptdata"></a>

 L'esempio seguente mostra l'utilizzo di Dynamic Keys insieme al comando decrypt. L'identificatore di chiave in questo caso è la chiave di avvolgimento (KEK) che protegge la chiave di decrittografia (fornita nel parametro wrapped-key in formato TR-31). La chiave avvolta deve essere lo scopo principale di D0 da utilizzare con il comando decrypt insieme a una modalità di utilizzo di B o D. 

**Example**  

```
$ aws payment-cryptography-data decrypt-data --key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ov6icy4ryas4zcza --cipher-text 1234123412341234123412341234123A --decryption-attributes 'Symmetric={Mode=CBC,InitializationVector=1234123412341234}'   --wrapped-key WrappedKeyMaterial={"Tr31KeyBlock"="D0112D0TN00E0000B05A6E82D7FC68B95C84306634B0000DA4701BE9BCA318B3A30A400B059FD4A8DE19924A9D3EE459F24FDE680F8E4A40"}
```

```
{
   "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/ov6icy4ryas4zcza",
   "KeyCheckValue": "0A3674",
   "PlainText": "2E138A746A0032023BEF5B85BA5060BA"
}
```

## Traduzione di un pin
<a name="use-case-acquirers-dynamickeys.examples.translatepin"></a>

 L'esempio seguente mostra l'utilizzo di Dynamic Keys insieme al comando translate pin per tradurre da una chiave dinamica a una chiave di lavoro Acquirer semi-statica (AWK). L'identificatore della chiave in ingresso in questo caso è la chiave di avvolgimento (KEK) che protegge la chiave di crittografia dinamica dei pin (PEK) fornita nel formato TR-31. La chiave incapsulata deve essere lo scopo principale `P0` insieme alla modalità di utilizzo di B o D. L'identificatore di chiave in uscita è una chiave di tipo e una modalità di utilizzo di Encrypt=True, wrap=True `TR31_P0_PIN_ENCRYPTION_KEY` 

**Example**  

```
$ aws payment-cryptography-data translate-pin-data --encrypted-pin-block "C7005A4C0FA23E02" --incoming-translation-attributes=IsoFormat0='{PrimaryAccountNumber=171234567890123}' --incoming-key-identifier alias/PARTNER1_KEK  --outgoing-key-identifier alias/ACQUIRER_AWK_PEK --outgoing-translation-attributes IsoFormat0="{PrimaryAccountNumber=171234567890123}"  --incoming-wrapped-key WrappedKeyMaterial={"Tr31KeyBlock"="D0112P0TB00S0000EB5D8E63076313162B04245C8CE351C956EA4A16CC32EB3FB61DE3FC75C751734B773F5B645943A854C65740738B8304"}
```

```
{
   "PinBlock": "2E66192BDA390C6F",
   "KeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/ov6icy4ryas4zcza",
   "KeyCheckValue": "0A3674"
}
```