In the future we may be setting up a system to secure a large number of symmetric (device) keys (a few million) by using HSMs. So, the keys themselves will be stored outside the HSM, but they will be stored encrypted by a key that resides in the HSM.

We will setup two such systems with HSMs potentially from different manufacturers.

One requirement is that it must be possible to exchange the keys from one system to the other.

So, is there a secure and standardized way to exchange key material between HSMs of different manufacturers? If so, which standards are applicable here, and are they commonly implemented by HSM manufacturers?


2 Answers 2


No, there's no standardized way to exchange key material between HSM (and often not even between HSM of the same manufacturer, although manufacturers may provide a backup/restore or replication capability that works at least within the same model). As far as an HSM is concerned, the world is divided in two: inside and outside. What is outside is not trusted. From the point of view of HSM1, HSM2 is outside and therefore not trusted, so HSM1 won't give up its keys to HSM2.

Assuming that you keep a single copy of the wrapped application keys (plus their identical backups), both HSM need to have the same wrapping key. Either create that key outside the HSM and import it to both, or create that key inside one HSM, export it, and import it into the other HSM. After import, make sure to switch the key attributes to be non-exportable.

Even with a single HSM, you would need to have a copy of the wrapping key outside the HSM for backup purposes. This copy (or more precisely all the backup copies) must of course be stored securely. Depending on your security requirements, this could be a piece of paper stored in a safe, or key shares where several company officers are responsible for securing their own shares and K shares among N are necessary to reconstruct the key. As far as I know, there's no standard way to create these key shares, but one HSM may have this as a proprietary featue.

  • $\begingroup$ wrapping key is stored securely. But after export of the key K (wrapped/encrypted by wrapping key) from HSM1 and before import to HSM2 this key K will be stored not securely in some not secure storage. Is storing of encrypted key K safe? Imagine that padding is good, wrapping key is good. I ask because some vendors of HSM do not allow export to not secure storage - they allow only backup to another HSM. Why... - the key K is encrypted $\endgroup$
    – Vlad
    Nov 29, 2022 at 7:26
  • 1
    $\begingroup$ @Vlad You can store a wrapped key insecurely, without risking the key material directly. That's the point of wrapping. HSM may restrict what you can do with a wrapped key to prevent it from being used out of policy (e.g. for an unintended purpose, or after it's expired). $\endgroup$ Nov 29, 2022 at 10:09
  • $\begingroup$ Thank you! Unfortunately I noticed your answer only now. And created the question few days ago - maybe it will be interesting for you to answer: crypto.stackexchange.com/questions/103060/… $\endgroup$
    – Vlad
    Dec 4, 2022 at 13:18

I am not 100% sure when you say "exchange the keys from one to other system". This is how i would do it.

Assuming You have two HSM's (Thales-A, Safenet-B)
1. Create a ZMK at one of HSM and import it in other HSM's using console commands. Once you do this you will have clear ZMK ,"ZMK encrypted under A's LMK" call it ZMK_A and "ZMK encrypted under B's LMK" call it ZMK_B.

2. Whenever you want to exchange a key "TPK" from A to B you can simply export it using host command and ZMK_A as master key for export to get TPK_ZMK, you can import TPK_ZMK to TPK_LMK using Host command with ZMK_B as master key.

3. You can follow same process vice versa.

Only problem is you cant import and export ZMK itself using host commands, you have to do it on hsm console(step 1).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.