public string decrypt(byte[] encrypted, byte[] key, byte[] iv)
        {
            //Get a decryptor that uses the same key and IV as the encryptor.
            ICryptoTransform decryptor = desCSP.CreateDecryptor(key, iv);

            Symmetric symm = new Symmetric();

            return(symm.decrypt(decryptor, encrypted));
        }
Esempio n. 2
0
        public string decrypt(byte[] encrypted, byte[] key, byte[] iv)
        {
            tripledesCSP.Mode = mode;
            tripledesCSP.Padding = padding;
            //MessageBox.Show(tripledesCSP.Mode + "/" + tripledesCSP.Padding);
            //Get a decryptor that uses the same key and IV as the encryptor.
            ICryptoTransform decryptor = tripledesCSP.CreateDecryptor(key, iv);

            Symmetric symm = new Symmetric();

            return symm.decrypt(decryptor, encrypted);
        }
        public string decrypt(byte[] encrypted, byte[] key, byte[] iv)
        {
            //Get a decryptor that uses the same key and IV as the encryptor.
            rc2CSP.Mode    = mode;
            rc2CSP.Padding = padding;
            MessageBox.Show(rc2CSP.Mode + "/" + rc2CSP.Padding);
            ICryptoTransform decryptor = rc2CSP.CreateDecryptor(key, iv);

            Symmetric symm = new Symmetric();

            return(symm.decrypt(decryptor, encrypted));
        }