diff --git a/edgelet/hsm-sys/azure-iot-hsm-c/src/edge_hsm_client_store.c b/edgelet/hsm-sys/azure-iot-hsm-c/src/edge_hsm_client_store.c index 37c27f1f93b..feb42b53f09 100644 --- a/edgelet/hsm-sys/azure-iot-hsm-c/src/edge_hsm_client_store.c +++ b/edgelet/hsm-sys/azure-iot-hsm-c/src/edge_hsm_client_store.c @@ -2676,6 +2676,12 @@ static int edge_hsm_client_store_insert_encryption_key LOG_DEBUG("HSM store already has encryption key set %s", key_name); result = 0; } + else if ((load_encryption_key_from_file(g_crypto_store, key_name) == 0) && + key_exists((CRYPTO_STORE*)handle, HSM_KEY_ENCRYPTION, key_name)) + { + LOG_DEBUG("HSM store already has encryption key set %s", key_name); + result = 0; + } else { size_t key_size = 0;