I am in a situation where the keys k1 ("b6b99fb4-01...") and k2 ("d861b2a8-c5...") belong to token T1 and k3 ("p11#4e03...") to T2. My problem is that whenever i open a key on a given token and then a key from the other token, i get the NTE_BAD_KEYSET error message.
k1 > k2 > k3 - BUG
k3 > k2 - BUG
I can open up to 9 keys on a single token and no problem arises.
NCRYPT_KEY_HANDLE k3;
if ((st = NCryptOpenKey(pProvider, &k3, L"p11#4e03e03341f2f35e", 0, 0)) != ERROR_SUCCESS)
{
throw exception("Open key failed !");
}
NCRYPT_KEY_HANDLE k1;
if ((st = NCryptOpenKey(pProvider, &k1, L"b6b99fb4-01c4-fa18-83db-0e2bb1c80476", 0, 0)) != ERROR_SUCCESS)
{
throw exception("Open key failed !");
}
NCRYPT_KEY_HANDLE k2;
if ((st = NCryptOpenKey(pProvider, &k2, L"d861b2a8-c5fc-1327-af01-518731bd4e0b", 0, 0)) != ERROR_SUCCESS)
{
throw exception("Open key failed !");
}
What I am doing wrong ?
Thank you for your time.
User contributions licensed under CC BY-SA 3.0