public IntegrityVerificationStorage(IntegrityVerificationInfo info, IStorage hashStorage,
                                            IntegrityCheckLevel integrityCheckLevel, bool leaveOpen)
            : base(info.Data, info.BlockSize, leaveOpen)
        {
            HashStorage         = hashStorage;
            IntegrityCheckLevel = integrityCheckLevel;
            Salt = info.Salt;
            Type = info.Type;

            BlockValidities = new Validity[SectorCount];
        }
Esempio n. 2
0
        private static IntegrityVerificationInfo[] GetIvfcInfo(IvfcHeader ivfc, IList <IStorage> levels, IntegrityStorageType type)
        {
            var initInfo = new IntegrityVerificationInfo[ivfc.NumLevels];

            initInfo[0] = new IntegrityVerificationInfo
            {
                Data      = levels[0],
                BlockSize = 0
            };

            for (int i = 1; i < ivfc.NumLevels; i++)
            {
                initInfo[i] = new IntegrityVerificationInfo
                {
                    Data      = levels[i],
                    BlockSize = 1 << ivfc.LevelHeaders[i - 1].BlockSizePower,
                        Salt  = new HMACSHA256(Encoding.ASCII.GetBytes(SaltSources[i - 1])).ComputeHash(ivfc.SaltSource),
                        Type  = type
                };
            }

            return(initInfo);
        }