public PcrValueCollection(PcrSelection[] pcrSelection, Tpm2bDigest[] values) { // Calculate how many indivudal PCRs we have int count = pcrSelection.Sum(sel => sel.GetSelectedPcrs().Length); Values = new PcrValue[count]; // Now set the PcrValue[] based on the selection and values count = 0; foreach (PcrSelection sel in pcrSelection) { foreach (uint pcrNum in sel.GetSelectedPcrs()) { Values[count] = new PcrValue(pcrNum, new TpmHash(sel.hash, values[count].buffer)); count++; } } }
/// <summary> /// Get the hash of the concatenation of the values in the array order defined by the PcrSelection[] /// returned from GetPcrSelectionArray. /// </summary> /// <param name="hashAlg"></param> /// <returns></returns> public TpmHash GetSelectionHash(TpmAlgId hashAlg) { var m = new Marshaller(); PcrSelection[] selections = GetPcrSelectionArray(); foreach (PcrSelection sel in selections) { uint[] pcrIndices = sel.GetSelectedPcrs(); foreach (uint index in pcrIndices) { PcrValue v = GetSpecificValue(sel.hash, index); m.Put(v.value.HashData, "hash"); } } var valueHash = new TpmHash(hashAlg, CryptoLib.HashData(hashAlg, m.GetBytes())); return(valueHash); }
public PcrValueCollection(PcrValue oneVal) { Values = new PcrValue[1]; Values[0] = new PcrValue(oneVal); }
public PcrValue(PcrValue the_PcrValue) { if((Object) the_PcrValue == null ) throw new ArgumentException(Globs.GetResourceString("parmError")); index = the_PcrValue.index; value = the_PcrValue.value; }
public PcrValueCollection(PcrValue[] vals) { Values = Globs.CopyArray<PcrValue>(vals); }