C# Class Policy.Program

Main class to contain this sample program.
Afficher le fichier Open project: Microsoft/TSS.MSR

Méthodes publiques

Méthode Description
PolicySecretCallback ( PolicyTree policyTree, TpmPolicySecret ace, SessionBase &authorizingSession, TpmHandle &authorizedEntityHandle, bool &flushAuthEntity ) : void

This callback function provides authorization in plain text

PolicySecretCallback2 ( PolicyTree policyTree, TpmPolicySecret ace, SessionBase &authorizingSession, TpmHandle &authorizedEntityHandle, bool &flushAuthEntity ) : void

This callback function provides authorization in the form of an HMAC session

SignerCallback ( PolicyTree policyTree, TpmPolicySigned ace, byte nonceTpm, TpmPublic &verificationKey ) : ISignatureUnion

The callback to sign the TpmPolicySignature challenge from the TPM.

Private Methods

Méthode Description
CreateSealedPrimaryObject ( Tpm2 tpm, byte dataToSeal, byte authValue, byte policy ) : TpmHandle

Create a sealed-object primary that can be accessed with the given policy. SHA256 is assumed.

Main ( string args ) : void

This sample demonstrates the creation of a signing "primary" key and use of this key to sign data, and use of the TPM and Tpm2Lib to validate the signature.

ParseArguments ( IEnumerable args, string &tpmDeviceName ) : bool

Parse the arguments of the program and return the selected values.

PolicyEvaluationWithCallback ( Tpm2 tpm ) : void

Some policies can be evaluated solely from public parts of the policy. Others need a private keyholder to sign some data. Tpm2Lib provides a callback facility for these cases. In this sample the callback signs some data using a software key. But the callback might also ask for a smartcard to sign a challenge, etc.

PolicyEvaluationWithCallback2 ( Tpm2 tpm ) : void

Some policies can be evaluated solely from public parts of the policy. Others needs a private keyholder to sign some data. Tpm2Lib provides a callback facility for these cases. This second sample illustrates the use of callbacks to provide authData.

PolicyOr ( Tpm2 tpm ) : void

This sample illustrates the use of a TpmPolicyOr.

PolicySerialization ( ) : void

This sample demonstrates how policies can be created in a standard form and then shared between hosts.

SamplePolicySerializationAndCallbacks ( Tpm2 tpm ) : void

This sample demonstrates a policy containing ALL policy commands. It also demonstrates serialization of the policy, and the use of callbacks to satisfy the conditions in a policy (e.g. knowledge of a private key, or the NV-index associated with a name.

SimplePolicy ( Tpm2 tpm ) : void

This sample illustrates the use of a simple TPM policy session. The policy demands PCR 1, 2, 3 set to current values, and the command be issued at locality zero.

WriteUsage ( ) : void

Prints instructions for usage of this program.

Method Details

PolicySecretCallback() static public méthode

This callback function provides authorization in plain text
static public PolicySecretCallback ( PolicyTree policyTree, TpmPolicySecret ace, SessionBase &authorizingSession, TpmHandle &authorizedEntityHandle, bool &flushAuthEntity ) : void
policyTree Tpm2Lib.PolicyTree
ace Tpm2Lib.TpmPolicySecret
authorizingSession Tpm2Lib.SessionBase
authorizedEntityHandle Tpm2Lib.TpmHandle
flushAuthEntity bool
Résultat void

PolicySecretCallback2() static public méthode

This callback function provides authorization in the form of an HMAC session
static public PolicySecretCallback2 ( PolicyTree policyTree, TpmPolicySecret ace, SessionBase &authorizingSession, TpmHandle &authorizedEntityHandle, bool &flushAuthEntity ) : void
policyTree Tpm2Lib.PolicyTree
ace Tpm2Lib.TpmPolicySecret
authorizingSession Tpm2Lib.SessionBase
authorizedEntityHandle Tpm2Lib.TpmHandle
flushAuthEntity bool
Résultat void

SignerCallback() public static méthode

The callback to sign the TpmPolicySignature challenge from the TPM.
public static SignerCallback ( PolicyTree policyTree, TpmPolicySigned ace, byte nonceTpm, TpmPublic &verificationKey ) : ISignatureUnion
policyTree Tpm2Lib.PolicyTree The policy tree to check.
ace Tpm2Lib.TpmPolicySigned The policy element (TpmPolicySignature) to evaluate.
nonceTpm byte The nonce from the TPM.
verificationKey Tpm2Lib.TpmPublic
Résultat ISignatureUnion