Exemplo n.º 1
0
        public byte [] Encrypt(byte [] plain)
        {
            int div = plain.Length / _tdcsp.Key.Length;
            int rem = plain.Length % 16;

            if (rem != 0)
            {
                throw new Exception("must be in 16 byte blocks");
            }

            byte [] cipher = _tdcsp.EncryptValue(plain);
            //just encrypt and throw away the last block
            byte [] cipherNoPad = new byte[cipher.Length - _tdcsp.IV.Length];
            Array.Copy(cipher, 0, cipherNoPad, 0, cipherNoPad.Length);
            return(cipherNoPad);
        }