internal ObjectContext CreateObjectContext(Tbs.TbsContext owner, TpmHandle tpmHandle)
{
Tbs.SlotType newSlotType = Tbs.SlotTypeFromHandle(tpmHandle);
if (newSlotType == Tbs.SlotType.NoSlot)
{
throw new Exception("CreateObjectContext: Should not be here");
}
// Make a new slot context of the requisite type
uint tbsHandle = GetFreeHandle(owner, tpmHandle);
var newContext = new ObjectContext {
OwnerHandle = new TpmHandle(tbsHandle),
TheTpmHandle = tpmHandle,
TheSlotType = newSlotType,
LastUseCount = GetUseCount(),
Loaded = true,
Owner = owner
};
ObjectContexts.Add(newContext);
return newContext;
}