- Newest
- Most votes
- Most comments
When using keytool with AWS CloudHSM, you need to specify the CloudHSM key store type and Java classpath directly in your keytool command rather than expecting it to appear in your system's default providers list.
For keytool commands with AWS CloudHSM, you should include these specific arguments:
For Linux:
-storetype CLOUDHSM -J-classpath '-J/opt/cloudhsm/java/*'
For Windows:
-storetype CLOUDHSM -J-classpath '-J"C:\Program Files\Amazon\CloudHSM\java\*"'
The CloudHSM provider isn't registered as a standard KeyStore provider that would appear in your provider list. Instead, the -J-classpath argument dynamically adds the CloudHSM Java libraries to the classpath when keytool runs, making the CLOUDHSM store type available for that specific command execution.
For example, to import a certificate, your full command would look like:
keytool -importcert -noprompt -alias <key pair label> \
-file my_certificate.crt \
-keystore example_keystore.store \
-storetype CLOUDHSM \
-J-classpath '-J/opt/cloudhsm/java/*'
This approach allows keytool to recognize and use the CLOUDHSM store type for that specific command execution without requiring it to be permanently registered in your system's provider list.
Sources
Use AWS CloudHSM key store with keytool using Client SDK 5 - AWS CloudHSM
Import a working certificate into AWS CloudHSM key store using keytool - AWS CloudHSM
answered a year ago
Relevant content
asked 3 years ago
asked a year ago
asked 3 years ago

The keytool command mentioned above throws the following error which leads me to believe that the keytool is expecting the Keystore to already exist. There is no information in the documentation to create this keystore. keytool error: java.security.KeyStoreException: CLOUDHSM not found