Tpm2Lib.TpmHash.Extend C# (CSharp) Method

Extend() public method

Replace the hash value with the hash of the concatenation of the current value and the TPM representation of objectToExtend
public Extend ( Object objectToExtend ) : TpmHash
objectToExtend Object
return TpmHash
        public TpmHash Extend(Object objectToExtend)
        {
            byte[] temp = Marshaller.GetTpmRepresentation(objectToExtend);
            HashData = CryptoLib.HashData(HashAlg, HashData, temp);
            return this;
        }

Usage Example

コード例 #1
0
        internal override TpmHash GetPolicyDigest(TpmAlgId hashAlg)
        {
            TpmCc commandCode = 0;

            if (TicketType == TpmSt.AuthSecret)
            {
                commandCode = TpmCc.PolicySecret;
            }
            else if (TicketType == TpmSt.AuthSigned)
            {
                commandCode = TpmCc.PolicySigned;
            }
            else
            {
                Globs.Throw <ArgumentException>("Ticket type is not recognized");
                return(new TpmHash(hashAlg));
            }

            if (ObjectName == null)
            {
                ObjectName = AuthorizingKey.GetName();
            }
            var m = new Marshaller();

            m.Put(commandCode, "ordinal");
            m.Put(ObjectName, "name");

            // ReSharper disable once UnusedVariable
            TpmHash atStart      = GetNextAcePolicyDigest(hashAlg);
            TpmHash firstExtend  = GetNextAcePolicyDigest(hashAlg).Extend(m.GetBytes());
            TpmHash secondExtend = firstExtend.Extend(PolicyRef);

            return(secondExtend);
        }
All Usage Examples Of Tpm2Lib.TpmHash::Extend