- Newest
- Most votes
- Most comments
Yes, it is possible to import an existing certificate that was signed using a CloudHSM key on Linux into a Windows instance using the CloudHSM KSP. Here's how you can do it:
-
First, you need to import the certificate into the Windows certificate store. You can do this using the Windows Certificate Import Wizard or by using the certutil command-line tool.
-
Once the certificate is in the Windows certificate store, you need to associate it with the private key in the CloudHSM. This is where the CloudHSM Key Storage Provider (KSP) comes into play.
-
Use the import_key.exe utility, which is included in CloudHSM version 3.0 and higher, to import the key's metadata into the local certificate store and associate it with the certificate.
-
To use import_key.exe, you'll need to know the Unique Container Name and Serial Number of the certificate. You can find these using a utility like certutil.
-
Run the import_key.exe utility to associate the AWS CloudHSM private key with the certificate. The command will look something like this:
import_key.exe --cavium-pkcs11 --token-label <HSM user name> --token-pin <HSM user password> --key-label <key label> --cert-label <certificate label>
-
After associating the key, update the certificate store using certutil to ensure the changes are reflected.
Once you've completed these steps, you should be able to use the imported certificate with signtool.exe for code signing on your Windows instance, just as you were using it with jarsigner on Linux.
Remember, the key itself remains securely stored in the CloudHSM, while the certificate and the association between the certificate and the key are managed by the Windows certificate store and the CloudHSM KSP.
Sources
Associate an AWS CloudHSM key with a certificate - AWS CloudHSM
Use Microsoft SignTool with Client SDK 5 to sign files - AWS CloudHSM
Relevant content
- asked 6 months ago
- asked 8 months ago
- asked a month ago
- AWS OFFICIALUpdated a year ago

The
import_key.exeutility does not appear to be included in CloudHSM SDK 5, or the Key storage provider (KSP) for AWS CloudHSM Client SDK 5. Mention is made of it in the documentation for SDK 3, so perhaps it was removed. Certainly, there's no equivalent of the SDK 3 documentation page 'Associate an AWS CloudHSM key with a certificate' (https://docs.aws.amazon.com/cloudhsm/latest/userguide/ksp-library-associate-key-certificate.html) for SDK 5@MattP Have you found a solution for this with SDK 5? I'm facing the same problem. I've imported the certificate into Windows store, but it isn't associated with the private key in CloudHSM. This command fails with CRYPT_E_NOT_FOUND. The CloudHSM KSP log shows a successful login but cloudhsm_ksp::cloudhsm_ksp::error::enum_keys_error. certutil -user -f -csp "CloudHSM Key Storage Provider" -repairstore CA <hash> CA "Intermediate Certification Authorities"
@Greg Pflaum We haven't found a solution yet. We're in contact with AWS support and it's being looked at by them, but I've got no idea how long that will take, or if there's any way to solve it with the currently-released CloudHSM SDK...