Ejemplo n.º 1
0
        public PSTHeader(PSTFile pst)
        {
            var tempBytes = new byte[684];

            using (var mmfView = pst.PSTMMF.CreateViewAccessor(0, tempBytes.Length))
            {
                mmfView.ReadArray(0, tempBytes, 0, tempBytes.Length);
                DWMagic = Encoding.ASCII.GetString(tempBytes, 0, 4);

                var ver = BitConverter.ToUInt16(tempBytes, 10);

                bool ansi = (ver == 14 || ver == 15);
                isUnicode = !ansi;

                //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                var sentinel = tempBytes[isUnicode ? 512 : 460];
                EncodingAlgotihm = (BlockEncoding)tempBytes[isUnicode ? 513 : 461];

                var nbt_bref = new BREF(isUnicode, tempBytes, isUnicode ? 216 : 184);
                var bbt_bref = new BREF(isUnicode, tempBytes, isUnicode ? 232 : 192);

                NodeBT  = new NDB.PSTBTree(isUnicode, nbt_bref, pst);
                BlockBT = new NDB.PSTBTree(isUnicode, bbt_bref, pst);
            }
        }
Ejemplo n.º 2
0
        public PSTHeader(PSTFile pst)
        {
            using(var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var temp = new byte[4];
                mmfView.ReadArray(0, temp, 0, 4);
                this.DWMagic = Encoding.Default.GetString(temp);

                var ver = mmfView.ReadInt16(10);

                this.IsANSI = ver == 14 || ver == 15 ? true : (ver == 23 ? (bool?)false : null);

                if (this.IsANSI != null && this.IsANSI.Value)
                {

                } else if (this.IsUNICODE != null && this.IsUNICODE.Value)
                {
                    //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                    var sentinel = mmfView.ReadByte(512);
                    var cryptMethod = (uint) mmfView.ReadByte(513);

                    this.EncodingAlgotihm = (BlockEncoding) cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    this.NodeBT = new NDB.PSTBTree(nbt_bref, pst);
                    this.BlockBT = new NDB.PSTBTree(bbt_bref, pst);
                }
            }
        }
Ejemplo n.º 3
0
        public static void CryptPermute(byte[] pv, int cb, bool fEncrypt, BlockEncoding blockEncoding)
        {
            if (blockEncoding == BlockEncoding.NONE) return;
            if (blockEncoding == BlockEncoding.PERMUTE)
            {
                int idx = (fEncrypt ? 0 : 512);
                int temp = 0;

                for (int pvIndex = 0; pvIndex < cb; pvIndex++)
                {
                    temp = pv[pvIndex];
                    temp = temp & 0xFF;
                    pv[pvIndex] = mpbbCrypt[temp + idx];
                }
            }
        }
Ejemplo n.º 4
0
        public PSTHeader(PSTFile pst)
        {
            using (var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var temp = new byte[4];
                mmfView.ReadArray(0, temp, 0, 4);
                this.DWMagic = Encoding.Default.GetString(temp);

                var ver = mmfView.ReadInt16(10);


                this.IsANSI = ver == 14 || ver == 15 ? true : (ver == 23 ? (bool?)false : null);

                if (this.IsANSI != null && this.IsANSI.Value)
                {
                }
                else if (this.IsUNICODE != null && this.IsUNICODE.Value)
                {
                    //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                    var sentinel    = mmfView.ReadByte(512);
                    var cryptMethod = (uint)mmfView.ReadByte(513);

                    this.EncodingAlgotihm = (BlockEncoding)cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    this.NodeBT  = new NDB.PSTBTree(nbt_bref, pst);
                    this.BlockBT = new NDB.PSTBTree(bbt_bref, pst);
                }
            }
        }