Tpm2Lib.TpmHash.DigestSize C# (CSharp) Method

DigestSize() public static method

Return the length of the output of the hash function in bytes
public static DigestSize ( TpmAlgId hashAlg ) : ushort
hashAlg TpmAlgId
return ushort
        public static ushort DigestSize(TpmAlgId hashAlg)
        {
            return (ushort)CryptoLib.DigestSize(hashAlg);
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Calculate the session-key from the nonces and salt/bound values (if present)
        /// </summary>
        public void CalcSessionKey()
        {
            if (Salt == SaltNeeded)
            {
                Globs.Throw("Unencrypted salt value must be provided for the session" +
                            Handle.handle.ToString("X8"));
            }

            // Compute Handle.Auth in accordance with Part 1, 19.6.8.
            if (Salt == null && BindObject == TpmRh.Null)
            {
                SessionKey = new byte[0];
                return;
            }

            byte[] auth    = Globs.TrimTrailingZeros(BindObject.Auth);
            byte[] hmacKey = Globs.Concatenate(auth, Salt);
            SessionKey = KDF.KDFa(AuthHash, hmacKey, "ATH", NonceTpm, NonceCaller,
                                  TpmHash.DigestSize(AuthHash) * 8);
        }
All Usage Examples Of Tpm2Lib.TpmHash::DigestSize