Ejemplo n.º 1
0
        public string Operation(CryptoRequest req, bool isDecryption)
        {
            Chilkat.Crypt2 crypt = new Chilkat.Crypt2
            {
                CryptAlgorithm = "aes",
                CipherMode     = "cbc",
                KeyLength      = 256,
                PaddingScheme  = 0,
                EncodingMode   = "hex"
            };

            var data = Convert.FromBase64String(req.Data64);

            crypt.SetSecretKeyViaPassword(req.Password);

            var operated = isDecryption ? crypt.DecryptBytes(data) : crypt.EncryptBytes(data);

            return(Convert.ToBase64String(operated));
        }