aws-samples / aws-cloudhsm-jce-examples

Sample applications demonstrating how to use the CloudHSM JCE
MIT No Attribution
37 stars 57 forks source link

While running KeyUtilitiesRunner reported error Communication with the device was lost during the execution of the function #62

Open dhruv09 opened 2 years ago

dhruv09 commented 2 years ago

Exception in thread "main" com.amazonaws.cloudhsm.jce.jni.exception.ProviderException: The underlying Provider connection was lost: Communication with the device was lost during the execution of the function. at com.amazonaws.cloudhsm.jce.jni.CloudHsmObjectFinder.do_find(Native Method) at com.amazonaws.cloudhsm.jce.jni.CloudHsmObjectFinder.find(CloudHsmObjectFinder.java:10) at com.amazonaws.cloudhsm.jce.provider.CloudHsmKeyStore.engineGetKey(CloudHsmKeyStore.java:522) at com.amazonaws.cloudhsm.jce.provider.KeyStoreWithAttributes.getKey(KeyStoreWithAttributes.java:182) at com.amazonaws.cloudhsm.examples.KeyUtilitiesRunner.getKeyByUsingAttributesMap(KeyUtilitiesRunner.java:222) at com.amazonaws.cloudhsm.examples.KeyUtilitiesRunner.main(KeyUtilitiesRunner.java:167)

Please help!!

ankushgarg1998 commented 1 year ago

Hi @dhruv09 It's likely that you're not providing login credentials to the HSM while running the jar.

You might be running:

$ java -jar target/assembly/cloudhsm-keystore-runner.jar --store <keystore_location> --password <keystore_password>

While actually, you should be running:

$ java -DHSM_USER=<cu_username> -DHSM_PASSWORD=<cu_password> -jar target/assembly/cloudhsm-keystore-runner.jar --store <keystore_location> --password <keystore_password>