C# Class Tpm2Lib.AuthSession

AuthSession encapsulates HMAC, policy, encryption/decryption, and audit sessions, i.e. all session types that are represented by a TPM handle created by means of TPM2_StartAuthSession command.
Inheritance: SessionBase
Exibir arquivo Open project: Microsoft/TSS.MSR Class Usage Examples

Public Properties

Property Type Description
Attrs SessionAttr
AuthHash TpmAlgId
BindObject TpmHandle
NonceCaller byte[]
NonceTpm byte[]
Salt byte[]
SessionKey byte[]
SessionType TpmSe
Symmetric SymDef

Public Methods

Method Description
AuthSession ( ParametrizedHandle ph ) : System
AuthSession ( TpmHandle h ) : System

Constructs an object encapsulating a session opened in TPM. The Tpm2 object that was used to create the session tracks other information associated with it and uses it to compute session key and command/response HMAC.

NewNonceCaller ( ) : void
RunPolicy ( Tpm2 tpm, PolicyTree policyTree, string branchToEvaluate = null, bool allowErrors = false ) : TpmRc

Run a path on the policy tree. The path is identified by the leaf identifier string. A session is created and returned. If allowErrors is true then errors returned do not cause an exception (but are returned in the response code).

SetNonceTpm ( byte nonceTpm ) : void

Protected Methods

Method Description
AuthSession ( ) : System

Private Methods

Method Description
AuthSession ( TpmSe sessionType, TpmHandle tpmKey, TpmHandle bindObject, byte nonceCaller, byte nonceTpm, SymDef symmetric, TpmAlgId authHash ) : System

Constructs a temporary object to hold parameters of a session. Intended only for internal use by the Tpm2 class.

CalcSessionKey ( ) : void

Calculate the session-key from the nonces and salt/bound values (if present)

CanEncrypt ( ) : bool

Checks whether the given session can be used for parameter encryption.

GetAuthHmac ( byte parmHash, Direction direction, byte nonceDec = null, byte nonceEnc = null ) : byte[]

Calculate and return the auth-hmac (or plaintext auth if it is a policy session with PlaintextAuth set) based on the current session parms.

Init ( AuthSession Params ) : void

Sets parameters associated with the session.

Initialized ( ) : bool

Returns true if the parameters associated with the session context in TPM have been set in this object.

ParmEncrypt ( byte parm, Direction inOrOut ) : byte[]

Method Details

AuthSession() protected method

protected AuthSession ( ) : System
return System

AuthSession() public method

public AuthSession ( ParametrizedHandle ph ) : System
ph ParametrizedHandle
return System

AuthSession() public method

Constructs an object encapsulating a session opened in TPM. The Tpm2 object that was used to create the session tracks other information associated with it and uses it to compute session key and command/response HMAC.
public AuthSession ( TpmHandle h ) : System
h TpmHandle
return System

NewNonceCaller() public method

public NewNonceCaller ( ) : void
return void

RunPolicy() public method

Run a path on the policy tree. The path is identified by the leaf identifier string. A session is created and returned. If allowErrors is true then errors returned do not cause an exception (but are returned in the response code).
public RunPolicy ( Tpm2 tpm, PolicyTree policyTree, string branchToEvaluate = null, bool allowErrors = false ) : TpmRc
tpm Tpm2
policyTree PolicyTree
branchToEvaluate string
allowErrors bool
return TpmRc

SetNonceTpm() public method

public SetNonceTpm ( byte nonceTpm ) : void
nonceTpm byte
return void

Property Details

Attrs public_oe property

public SessionAttr Attrs
return SessionAttr

AuthHash public_oe property

Hash algorithm used by this session.
public TpmAlgId AuthHash
return TpmAlgId

BindObject public_oe property

public TpmHandle,Tpm2Lib BindObject
return TpmHandle

NonceCaller public_oe property

public byte[] NonceCaller
return byte[]

NonceTpm public_oe property

public byte[] NonceTpm
return byte[]

Salt public_oe property

public byte[] Salt
return byte[]

SessionKey public_oe property

public byte[] SessionKey
return byte[]

SessionType public_oe property

public TpmSe SessionType
return TpmSe

Symmetric public_oe property

Symmetric cipher to be used for encrypting and decrypting sessions.
public SymDef,Tpm2Lib Symmetric
return SymDef