상속: TpmStructureBase
예제 #1
0
        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++;
                }
            }
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 public PcrValueCollection(PcrValue oneVal)
 {
     Values    = new PcrValue[1];
     Values[0] = new PcrValue(oneVal);
 }
예제 #4
0
 public PcrValue(PcrValue the_PcrValue)
 {
     if((Object) the_PcrValue == null ) throw new ArgumentException(Globs.GetResourceString("parmError"));
     index = the_PcrValue.index;
     value = the_PcrValue.value;
 }
예제 #5
0
 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++;
         }
     }
 }
예제 #6
0
 public PcrValueCollection(PcrValue[] vals)
 {
     Values = Globs.CopyArray<PcrValue>(vals);
 }
예제 #7
0
 public PcrValueCollection(PcrValue oneVal)
 {
     Values = new PcrValue[1];
     Values[0] = new PcrValue(oneVal);
 }