本文整理汇总了C#中Tpm2Lib.TpmHandle类的典型用法代码示例。如果您正苦于以下问题:C# TpmHandle类的具体用法?C# TpmHandle怎么用?C# TpmHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TpmHandle类属于Tpm2Lib命名空间,在下文中一共展示了TpmHandle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StartAuthSessionEx
/// <summary>
/// Create a simple bound but unseeded session.
/// </summary>
public AuthSession StartAuthSessionEx(
TpmHandle boundEntity,
TpmSe sessionType,
TpmAlgId authHash,
SessionAttr initialialAttrs = SessionAttr.ContinueSession,
SymDef symDef = null,
int nonceCallerSize = 0)
{
byte[] nonceTpm;
var EmptySalt = new byte[0];
if (nonceCallerSize == 0)
{
nonceCallerSize = CryptoLib.DigestSize(authHash);
}
AuthSession sess = StartAuthSession(TpmRh.Null, boundEntity,
GetRandomBytes(nonceCallerSize),
EmptySalt, sessionType,
symDef ?? new SymDef(),
authHash, out nonceTpm)
+ initialialAttrs;
_InitializeSession(sess);
return sess;
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:29,代码来源:Tpm2Abstractions.cs
示例2: Destroy
public void Destroy()
{
TpmHandle nvHandle = new TpmHandle(AIOTH_PERSISTED_URI_INDEX + logicalDeviceId);
TpmHandle ownerHandle = new TpmHandle(TpmRh.Owner);
TpmHandle hmacKeyHandle = new TpmHandle(AIOTH_PERSISTED_KEY_HANDLE + logicalDeviceId);
// Open the TPM
Tpm2Device tpmDevice = new TbsDevice();
tpmDevice.Connect();
var tpm = new Tpm2(tpmDevice);
// Destyroy the URI
tpm.NvUndefineSpace(ownerHandle, nvHandle);
// Destroy the HMAC key
tpm.EvictControl(ownerHandle, hmacKeyHandle, hmacKeyHandle);
// Dispose of the TPM
tpm.Dispose();
}
开发者ID:SlavyMihov,项目名称:security,代码行数:20,代码来源:Limpet.cs
示例3: CreateObjectContext
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;
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:22,代码来源:SlotContext.cs
示例4: SlotTypeFromHandle
internal static SlotType SlotTypeFromHandle(TpmHandle h)
{
switch (h.GetType())
{
case Ht.Transient:
return SlotType.ObjectSlot;
case Ht.PolicySession:
case Ht.HmacSession:
return SlotType.SessionSlot;
default:
return SlotType.NoSlot;
}
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:13,代码来源:SlotManager.cs
示例5: GetReferencedObjects
/// <summary>
/// Look up TBS ObjectContext records given the handles in the inHandles input parms.
/// </summary>
/// <param name="caller"></param>
/// <param name="inHandles"></param>
/// <returns></returns>
private ObjectContext[] GetReferencedObjects(TbsContext caller, TpmHandle[] inHandles)
{
var neededContexts = new ObjectContext[inHandles.Length];
for (int j = 0; j < inHandles.Length; j++)
{
neededContexts[j] = ContextManager.GetContext(caller, inHandles[j]);
if (neededContexts[j] == null)
{
return null;
}
}
return neededContexts;
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:19,代码来源:SlotManager.cs
示例6: ProcessUpdatedTpmState
/// <summary>
/// Updates TBS context database for commands that either fill or empty slots.
/// </summary>
/// <param name="caller"></param>
/// <param name="command"></param>
/// <param name="responseHandles"></param>
/// <param name="inputObjects"></param>
private void ProcessUpdatedTpmState(TbsContext caller, CommandInfo command, TpmHandle[] responseHandles, ObjectContext[] inputObjects)
{
switch (command.CommandCode)
{
// Commands that fill a slot (apart from contextLoad, which is more complex)
case TpmCc.Load:
case TpmCc.LoadExternal:
case TpmCc.CreatePrimary:
case TpmCc.HmacStart:
case TpmCc.HashSequenceStart:
case TpmCc.StartAuthSession:
var t = new TpmHandle(responseHandles[0].handle);
// ReSharper disable once UnusedVariable
ObjectContext context2 = ContextManager.CreateObjectContext(caller, t);
break;
case TpmCc.ContextLoad:
case TpmCc.ContextSave:
throw new Exception("ProcessUpdatedTpmState: Should not be here");
case TpmCc.FlushContext:
case TpmCc.SequenceComplete:
ContextManager.Remove(inputObjects[0]);
break;
case TpmCc.EventSequenceComplete:
ContextManager.Remove(inputObjects[1]);
break;
}
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:34,代码来源:SlotManager.cs
示例7: PolicySecretCallback2
/// <summary>
/// This callback function provides authorization in the form of an HMAC session
/// </summary>
static public void PolicySecretCallback2(
PolicyTree policyTree,
TpmPolicySecret ace,
out SessionBase authorizingSession,
out TpmHandle authorizedEntityHandle,
out bool flushAuthEntity)
{
AuthSession s0 = _sharedTpm.StartAuthSessionEx(TpmSe.Hmac, TpmAlgId.Sha1);
authorizingSession = s0;
authorizedEntityHandle = _publicSealedObjectHandle;
flushAuthEntity = true;
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:15,代码来源:Program.cs
示例8: ExecutePolicyNvCallback
/// <summary>
/// Called from TpmPolicyNV.
/// </summary>
/// <returns></returns>
internal void ExecutePolicyNvCallback(TpmPolicyNV ace, out TpmHandle authHandle, out TpmHandle nvHandle, out SessionBase authSession)
{
if (PolicyNVCallback == null)
{
Globs.Throw("No policyNV callback installed.");
authHandle = new TpmHandle();
nvHandle = new TpmHandle();
authSession = new AuthSession(new TpmHandle());
return;
}
PolicyNVCallback(this, ace, out authSession, out authHandle, out nvHandle);
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:16,代码来源:Policy.cs
示例9: TkHashcheck
public TkHashcheck()
{
hierarchy = new TpmHandle();
digest = new byte[0];
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:5,代码来源:X_TpmDefs.cs
示例10: TkAuth
///<param name = "the_tag">ticket structure tag</param>
///<param name = "the_hierarchy">the hierarchy of the object used to produce the ticket</param>
///<param name = "the_digest">This shall be the HMAC produced using a proof value of hierarchy.</param>
public TkAuth(
TpmSt the_tag,
TpmHandle the_hierarchy,
byte[] the_digest
)
{
this.tag = the_tag;
this.hierarchy = the_hierarchy;
this.digest = the_digest;
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:13,代码来源:X_TpmDefs.cs
示例11: TkVerified
///<param name = "the_hierarchy">the hierarchy containing keyName</param>
///<param name = "the_digest">This shall be the HMAC produced using a proof value of hierarchy.</param>
public TkVerified(
TpmHandle the_hierarchy,
byte[] the_digest
)
{
this.hierarchy = the_hierarchy;
this.digest = the_digest;
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:10,代码来源:X_TpmDefs.cs
示例12: SignAsync
public async Task<ISignatureUnion> SignAsync(
TpmHandle keyHandle,
byte[] digest,
ISigSchemeUnion inScheme,
TkHashcheck validation)
{
var inS = new Tpm2SignRequest {
keyHandle = keyHandle,
digest = digest,
inScheme = inScheme,
validation = validation
};
TpmStructureBase outSBase = null;
await Task.Run(() => DispatchMethod(TpmCc.Sign, inS, typeof (Tpm2SignResponse), out outSBase, 1, 0));
var outS = (Tpm2SignResponse)outSBase;
return outS.signature;
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:17,代码来源:Tpm2Abstractions.cs
示例13: CreateAsync
public async Task<Tpm2CreateResponse> CreateAsync(
TpmHandle parentHandle,
SensitiveCreate inSensitive,
TpmPublic inPublic,
byte[] outsideInfo,
PcrSelection[] creationPCR)
{
var inS = new Tpm2CreateRequest {
parentHandle = parentHandle,
inSensitive = inSensitive,
inPublic = inPublic,
outsideInfo = outsideInfo,
creationPCR = creationPCR
};
TpmStructureBase outSBase = null;
await Task.Run(() => DispatchMethod(TpmCc.Create, inS, typeof (Tpm2CreateResponse), out outSBase, 1, 0));
var outS = (Tpm2CreateResponse)outSBase;
return outS;
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:19,代码来源:Tpm2Abstractions.cs
示例14: ExecutePolicySecretCallback
/// <summary>
/// Called from TpmPolicySecret.
/// </summary>
/// <returns></returns>
internal void ExecutePolicySecretCallback(TpmPolicySecret ace, out SessionBase authorizingSession, out TpmHandle authorizedEntityHandle, out bool flushAuthEntity)
{
if (PolicySecretCallback == null)
{
Globs.Throw("No policy secret callback installed.");
authorizingSession = new AuthSession(new TpmHandle());
authorizedEntityHandle = new TpmHandle();
flushAuthEntity = false;
return;
}
PolicySecretCallback(this, ace, out authorizingSession, out authorizedEntityHandle, out flushAuthEntity);
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:16,代码来源:Policy.cs
示例15: PolicySecretCallback
/// <summary>
/// This callback function provides authorization in plain text
/// </summary>
static public void PolicySecretCallback(
PolicyTree policyTree,
TpmPolicySecret ace,
out SessionBase authorizingSession,
out TpmHandle authorizedEntityHandle,
out bool flushAuthEntity)
{
authorizingSession = _publicAuthorizationValue;
authorizedEntityHandle = _publicSealedObjectHandle;
flushAuthEntity = false;
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:14,代码来源:Program.cs
示例16: HandleArray
///<param name = "the_handle">an array of handles</param>
public HandleArray(
TpmHandle[] the_handle
)
{
this.handle = the_handle;
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:7,代码来源:X_TpmDefs.cs
示例17: AuthCommand
public AuthCommand()
{
sessionHandle = new TpmHandle();
nonce = new byte[0];
sessionAttributes = new SessionAttr();
hmac = new byte[0];
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:7,代码来源:X_TpmDefs.cs
示例18: CleanTpm
private void CleanTpm()
{
var loaded = new TpmHandle[3][];
loaded[0] = GetLoadedEntities(Tpm, Ht.Transient);
loaded[1] = GetLoadedEntities(Tpm, Ht.LoadedSession);
loaded[2] = GetLoadedEntities(Tpm, TpmHelpers.GetEnumerator<Ht>("ActiveSession", "SavedSession"));
foreach (TpmHandle[] arr in loaded)
{
foreach (TpmHandle h in arr)
{
Tpm.FlushContext(h);
}
}
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:14,代码来源:SlotManager.cs
示例19: ReplaceHandlesIn
/// <summary>
/// Modifies the handles and sessions arrays so that they contain the translated handles.
/// </summary>
/// <param name="handles"></param>
/// <param name="sessions"></param>
/// <param name="theObjects"></param>
/// <param name="theSessions"></param>
private void ReplaceHandlesIn(TpmHandle[] handles, SessionIn[] sessions, ObjectContext[] theObjects, ObjectContext[] theSessions)
{
for (int j = 0; j < handles.Length; j++)
{
handles[j] = theObjects[j].TheTpmHandle;
}
for (int j = 0; j < sessions.Length; j++)
{
sessions[j].handle = theSessions[j].TheTpmHandle;
}
}
开发者ID:Microsoft,项目名称:TSS.MSR,代码行数:18,代码来源:SlotManager.cs
示例20: NvPublic
public NvPublic()
{
nvIndex = new TpmHandle();
nameAlg = TpmAlgId.Null;
attributes = new NvAttr();
authPolicy = new byte[0];
}
开发者ID:vishalishere,项目名称:TSS.MSR,代码行数:7,代码来源:X_TpmDefs.cs
注:本文中的Tpm2Lib.TpmHandle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论