Beispiel #1
0
        public byte[] DecryptData(byte[] data)
        {
            var test = new AES_Communication(_sessionKey);

            var packet = new EncryptedPacket()
            {
                Iv            = data.Take(16).ToArray(),
                Hmac          = data.Skip(16).Take(32).ToArray(),
                EncryptedData = data.Skip(48).ToArray()
            };

            return(test.DecryptPacket(packet));
        }
Beispiel #2
0
        public byte[] EncryptData(byte[] data)
        {
            var test = new AES_Communication(_sessionKey);
            //first 16 iv
            //second 32 is hmac
            //rest is data;
            var packet = test.EncryptData(data);
            var a1     = packet.Iv;
            var a2     = packet.Hmac;
            var a3     = packet.EncryptedData;

            return(a1.Concat(a2).ToArray().Concat(a3).ToArray());
        }