Tpm2Lib.Tbs.DisposeContext C# (CSharp) Method

DisposeContext() public method

Removes all TPM objects referenced by this context and then removes the context from the TBS database.
public DisposeContext ( TbsContext c ) : void
c TbsContext
return void
        public void DisposeContext(TbsContext c)
        {
            lock (this)
            {
                foreach (ObjectContext o in ContextManager.ObjectContexts)
                {
                    if (o.Owner != c)
                    {
                        continue;
                    }
                    if (o.Loaded)
                    {
                        Tpm.FlushContext(o.TheTpmHandle);
                        o.Loaded = false;
                    }
                    else
                    {
                        if (o.TheSlotType == SlotType.SessionSlot)
                        {
                            // TODO: Need to flush saved sessions?
                            // Tpm.FlushContext(o.TheTpmHandle);
                            Tpm.FlushContext(o.Context.savedHandle);
                        }
                    }
                }
                ContextManager.RemoveAll(c);
            }
        }

Usage Example

コード例 #1
0
ファイル: SlotManager.cs プロジェクト: pdb0102/TSS.MSR
 protected sealed override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Tbs.DisposeContext(this);
     }
     base.Dispose(disposing);
 }