I want to build a deterministic key derivation tree, where the root is stored securely in a centralized service and the leaves are embedded in a multitude of devices. When a device wants to communicate with the back-end, the device supplies its ID and salt, and the centralized services derives the device-specific key from the root key and the device ID and salt.
Usually I would favor HKDF or another well known key derivation function for this purpose. But as we intend to run the whole service on a cloud provider, our choice of secure key storage is more limited.
Azure Key Vault has experimental support for AES-GCM on their managed HSMs. My idea is to use the device salt as input nonce (IV) of AES-GCM and device ID as associated data input and no plaintext as input. As output of AES-GCM I would use the generated tag as deterministic pseudo random key:
$\text{KDF}(key, salt, id) := \text{AES-GCM-encryption}(key, \epsilon, salt, id)$
where $key$ is the global root secret stored in the key vault, $\epsilon$ is the empty string used as plaintext GCM input, $salt$ is a 96 bit value used as $nonce$ in GCM, and $id$ is a variable length device identifying string that no device shares with another and is used as associated data input in GCM.
Is that construction secure…
- assuming the salt / nonce is globally unique among the whole lifetime of the the key and over all device IDs?
- assuming the salt / "nonce" is only unique for a specific ID and there can be several devices that share the same salt by accident (due to a collision of random values)?
Intuitively, I am pretty certain that with a globally unique salt, this construction should be a secure key derivation function. But this is hard to achieve for the use case we have in mind.