Tpm2Lib.AuthSession.Init C# (CSharp) Method

Init() private method

Sets parameters associated with the session.
private Init ( AuthSession Params ) : void
Params AuthSession
return void
        internal void Init (AuthSession Params)
        {
            SessionType = Params.SessionType;
            BindObject = Params.BindObject;
            NonceCaller = Params.NonceCaller;
            NonceTpm = Params.NonceTpm;
            Symmetric = Params.Symmetric;
            AuthHash = Params.AuthHash;
            AuthHandle = Params.AuthHandle;
            // When salt is required, destination session will have it set directly by the user
            if (Params.Salt != SaltNeeded)
                Salt = null;
        }

Usage Example

Example #1
0
 /// <summary>
 /// Copies parameters associated with the session handle encapsulated in the
 /// sess argument into the sess object. These parameters are the ones passed
 /// to the StartAuthSession command. They are remembered by this Tpm2 object,
 /// until this method is called.
 /// 
 /// Note that _InitializeSession() can be used only once for the given session
 /// handle, as the associated parameters are erased from Tpm2 Object after
 /// they were copied into AuthSession object for the first time.
 /// </summary>
 /// <param name="sess"></param>
 internal bool _InitializeSession(AuthSession sess)
 {
     if (!sess.Initialized())
     {
         if (!SessionParams.ContainsKey(sess))
         {
             // There are no session parameters associated with the session
             // handle (e.g., when the session was created by other Tpm2 object).
             return false;
         }
         sess.Init(SessionParams[sess]);
         sess.CalcSessionKey();
         SessionParams.Remove(sess);
     }
     return true;
 }