

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

# AWS CloudHSM Client SDK 3 verifica le prestazioni HSM con lo strumento pkpspeed
<a name="troubleshooting-verify-hsm-performance"></a>

Questo argomento descrive come verificare le prestazioni del modulo di sicurezza AWS CloudHSM hardware (HSM) con Client SDK 3.

Per verificare le prestazioni del HSMs AWS CloudHSM cluster, è possibile utilizzare lo strumento pkpspeed (Linux) o pkpspeed\$1blocking (Windows) incluso in Client SDK 3. Lo strumento pkpspeed viene eseguito in condizioni ideali e chiama direttamente l'HSM per eseguire le operazioni senza passare attraverso un SDK come. PKCS11 Si consiglia di testare il carico dell'applicazione in modo indipendente per determinare le esigenze di scalabilità specifiche. Non è consigliabile eseguire i seguenti test: Random (I), ModExp (R) ed EC point mul (Y).

 Per ulteriori informazioni sull'installazione del client in un'istanza EC2 per Linux, consulta [Installa e configura il AWS CloudHSM client per CMU (Linux)](cmu-install-and-configure-client-linux.md). Per ulteriori informazioni sull'installazione del client in un'istanza di Windows, consulta [Installare e configurare il AWS CloudHSM client per CMU (Windows)](cmu-install-and-configure-client-win.md). 

Dopo aver installato e configurato il AWS CloudHSM client, esegui il comando seguente per avviarlo.

------
#### [ Amazon Linux ]

```
$ sudo start cloudhsm-client
```

------
#### [ Amazon Linux 2 ]

```
$ sudo service cloudhsm-client start
```

------
#### [ CentOS 7 ]

```
$ sudo service cloudhsm-client start
```

------
#### [ CentOS 8 ]

```
$ sudo service cloudhsm-client start
```

------
#### [ RHEL 7 ]

```
$ sudo service cloudhsm-client start
```

------
#### [ RHEL 8 ]

```
$ sudo service cloudhsm-client start
```

------
#### [ Ubuntu 16.04 LTS ]

```
$ sudo service cloudhsm-client start
```

------
#### [ Ubuntu 18.04 LTS ]

```
$ sudo service cloudhsm-client start
```

------
#### [ Windows ]
+ Per client Windows dalla versione 1.1.2\$1:

  ```
  C:\Program Files\Amazon\CloudHSM>net.exe start AWSCloudHSMClient
  ```
+ Per client Windows 1.1.1 e versioni precedenti:

  ```
  C:\Program Files\Amazon\CloudHSM>start "cloudhsm_client" cloudhsm_client.exe C:\ProgramData\Amazon\CloudHSM\data\cloudhsm_client.cfg
  ```

------

Se il software client è già stato installato, potrebbe essere necessario scaricare e installare la versione più recente per ottenere pkpspeed. Lo strumento pkpspeed è disponibile in `/opt/cloudhsm/bin/pkpspeed` in Linux o in `C:\Program Files\Amazon\CloudHSM\` in Windows. 

Per usare pkpspeed eseguire il comando **pkpspeed** o **pkpspeed\$1blocking.exe**, specificando il nome utente e la password di un utente di crittografia (CU) nel modulo HSM. Impostare quindi le opzioni per l'utilizzo tenendo presente le seguenti raccomandazioni. 

## Consigli sui test
<a name="w2aac37c11c17"></a>
+ Per testare le prestazioni delle operazioni di firma e verifica RSA, scegliere il tipo di crittografia `RSA_CRT` in Linux o l'opzione B in Windows. Non scegliere `RSA` (opzione A in Windows). I tipi di crittografia sono equivalenti, ma `RSA_CRT` è ottimizzato per le prestazioni. 
+ Iniziare con un numero ridotto di thread. Per testare le prestazioni AES, un thread è in genere sufficiente a mostrare le prestazioni massime. Per testare le prestazioni RSA (`RSA_CRT`), tre o quattro thread sono in genere sufficienti. 

## Opzioni configurabili per lo strumento pkpspeed
<a name="w2aac37c11c19"></a>
+ **Modalità FIPS**: AWS CloudHSM è sempre in modalità FIPS (vedi [AWS CloudHSM FAQs](https://aws.amazon.com/cloudhsm/faqs/)per i dettagli). Ciò può essere verificato utilizzando gli strumenti CLI come documentato nella Guida per l' AWS CloudHSM utente ed eseguendo il ** [Ottieni informazioni sull'hardware per ogni HSM in un AWS CloudHSM cluster con CMU](cloudhsm_mgmt_util-getHSMInfo.md) ** comando che indicherà lo stato della modalità FIPS.
+ **Tipo di test (con o senza blocchi)**: specifica come vengono eseguite le operazioni con thread. Molto probabilmente si ottengono risultati migliori usando test senza blocchi. in quanto utilizzano thread e concorrenza.
+ **Numero di thread**: il numero di thread con cui eseguire il test.
+ **Tempo in secondi per eseguire il test (max = 600)**: lo strumento pkpspeed genera risultati misurati in OPERAZIONI/secondo e riferisce questo valore per ogni secondo di esecuzione del test. Ad esempio, se il test viene eseguito per 5 secondi, l'output potrebbe essere simile ai seguenti valori di esempio:
  + `OPERATIONS/second 821/1`
  + `OPERATIONS/second 833/1`
  + `OPERATIONS/second 845/1`
  + `OPERATIONS/second 835/1`
  + `OPERATIONS/second 837/1`

## Test che possono essere eseguiti con lo strumento pkpspeed
<a name="w2aac37c11c21"></a>
+ **AES GCM**: testa la crittografia di tipo AES GCM.
+ **Basic 3DES CBC**: testa la crittografia di tipo 3DES CBC. Vedi la nota [1](#verify-hsm-performance-note-1) di seguito per una modifica imminente.
+ **AES di base: verifica la crittografia AES**. CBC/ECB 
+ **Digest**: testa l'hash digest.
+ **Firma ECDSA**: testa la firma ECDSA.
+ **Verifica ECDSA**: testa la verifica ECDSA.
+ **FIPS Random**: testa la generazione di un numero casuale conforme a FIPS (nota: il test può essere utilizzato solo in modalità con blocco).
+ **HMAC**: testa HMAC.
+ **Random**: questo test non è rilevante perché sono in uso HSM FIPS 140-2.
+ **RSA non-CRT rispetto a RSA\$1CRT**: testa le operazioni di firma e verifica RSA.
+ **RSA OAEP Enc**: testa la crittografia RSA OAEP.
+ **RSA OAEP Dec**: testa la decrittografia RSA OAEP.
+ **Decrittografia a chiave privata RSA non-CRT**: testa la crittografia a chiave privata RSA (non ottimizzata).
+ **Decrittografia a chiave privata RSA CRT**: testa la crittografia a chiave privata RSA (ottimizzata).
+ **Firma RSA PSS**: testa la firma RSA PSS.
+ **Verifica RSA PSS**: testa la verifica RSA PSS.
+ **Crittografia a chiave pubblica RSA**: testa la crittografia a chiave pubblica RSA.

La crittografia a chiave pubblica RSA, la decrittografia privata RSA non-CRT e la decrittografia a chiave privata RSA CRT richiedono inoltre all'utente di rispondere a quanto segue:

```
Do you want to use static key [y/n]
```

Se si inserisce `y`, una chiave precalcolata viene importata nell'HSM.

Se si inserisce `n`, viene generata una nuova chiave.

[1] In conformità con le linee guida del NIST, ciò non è consentito per i cluster in modalità FIPS dopo il 2023. Per i cluster in modalità non FIPS, è ancora consentito dopo il 2023. Per informazioni dettagliate, vedi [Conformità FIPS 140: meccanismo di deprecazione 2024](compliance-dep-notif.md#compliance-dep-notif-1).

## Esempi
<a name="w2aac37c11c23"></a>

Gli esempi seguenti mostrano le opzioni che è possibile scegliere con pkpspeed (Linux) o pkpspeed\$1blocking (Windows) per testare le prestazioni del modulo HSM per le operazioni RSA e AES. 

**Example - Uso di pkpspeed per testare le prestazioni RSA**  
È possibile eseguire questo esempio in Windows, Linux e in sistemi operativi compatibili.  
Utilizzare queste istruzioni per Linux e sistemi operativi compatibili.  

```
/opt/cloudhsm/bin/pkpspeed -s CU user name -p password

SDK Version: 2.03

        Available Ciphers:
                AES_128
                AES_256
                3DES
                RSA  (non-CRT. modulus size can be 2048/3072)
                RSA_CRT (same as RSA)
For RSA, Exponent will be 65537

Current FIPS mode is: 00002
Enter the number of thread [1-10]: 3
Enter the cipher: RSA_CRT
Enter modulus length: 2048
Enter time duration in Secs: 60
Starting non-blocking speed test using data length of 245 bytes...
[Test duration is 60 seconds]

Do you want to use static key[y/n] (Make sure that KEK is available)?n
```

```
c:\Program Files\Amazon\CloudHSM>pkpspeed_blocking.exe -s CU user name -p password

Please select the test you want to run

RSA non-CRT------------------->A
RSA CRT----------------------->B
Basic 3DES CBC---------------->C
Basic AES--------------------->D
FIPS Random------------------->H
Random------------------------>I
AES GCM ---------------------->K

eXit------------------------>X
B

Running 4 threads for 25 sec

Enter mod size(2048/3072):2048
Do you want to use Token key[y/n]n
Do you want to use static key[y/n] (Make sure that KEK is available)?  n
OPERATIONS/second                821/1
OPERATIONS/second                833/1
OPERATIONS/second                845/1
OPERATIONS/second                835/1
OPERATIONS/second                837/1
OPERATIONS/second                836/1
OPERATIONS/second                837/1
OPERATIONS/second                849/1
OPERATIONS/second                841/1
OPERATIONS/second                856/1
OPERATIONS/second                841/1
OPERATIONS/second                847/1
OPERATIONS/second                838/1
OPERATIONS/second                843/1
OPERATIONS/second                852/1
OPERATIONS/second                837/
```

**Example - Uso di pkpspeed per testare le prestazioni AES**  
Utilizzare queste istruzioni per Linux e sistemi operativi compatibili.  

```
/opt/cloudhsm/bin/pkpspeed -s <CU user name> -p <password>

SDK Version: 2.03

        Available Ciphers:
                AES_128
                AES_256
                3DES
                RSA  (non-CRT. modulus size can be 2048/3072)
                RSA_CRT (same as RSA)
For RSA, Exponent will be 65537

Current FIPS mode is: 00000002
Enter the number of thread [1-10]: 1
Enter the cipher: AES_256
Enter the data size [1-16200]: 8192
Enter time duration in Secs: 60
Starting non-blocking speed test using data length of 8192 bytes...
```

```
c:\Program Files\Amazon\CloudHSM>pkpspeed_blocking.exe -s CU user name -p password
login as USER
Initializing Cfm2 library
        SDK Version: 2.03

 Current FIPS mode is: 00000002
Please enter the number of threads [MAX=400] : 1
Please enter the time in seconds to run the test [MAX=600]: 20


Please select the test you want to run

RSA non-CRT------------------->A
RSA CRT----------------------->B
Basic 3DES CBC---------------->C
Basic AES--------------------->D
FIPS Random------------------->H
Random------------------------>I
AES GCM ---------------------->K

eXit------------------------>X
D

Running 1 threads for 20 sec

Enter the key size(128/192/256):256
Enter the size of the packet in bytes[1-16200]:8192
OPERATIONS/second                9/1
OPERATIONS/second                10/1
OPERATIONS/second                11/1
OPERATIONS/second                10/1
OPERATIONS/second                10/1
OPERATIONS/second                10/...
```