I was using Tspi_Key_UnloadKey() function in my code for cleaning state. However, what I discovered that after UnloadKey() was used any subsequent operations with this key will fail despite the fact that Tspi_Context_LoadKeyByUUID() returns success. Here is the faulty sequence:
Tspi_Context_LoadKeyByUUID()
Tspi_Data_Bind()
Tspi_Key_UnloadKey()
Tspi_Context_LoadKeyByUUID()
Tspi_Data_Bind() - crash and burn
I'm attaching a test case for this issue. Feel free to include it in you test suite.