private void setDecryptor(int cryptoFlag) { int aux = cryptoFlag & 0xFF; switch (aux) { case 0x01: dec = new NoCrypt(); Debug.WriteLine("MODE: Decryption Algorithm NONE"); break; case 0x02: dec = new AESCBC128Decrypt(); Debug.WriteLine("MODE: Decryption Algorithm AESCBC128"); break; default: throw new Exception("Crypto mode is not valid: Undefined decryptor"); } // if ((cryptoFlag & 0x0F000000) != 0) cryptoDebug = true; }
public static string DecryptText(byte[] bytes, string password, string salt) { return(Encoding.UTF8.GetString(Decryptor.CreateDecryptor(password, salt).TransformFinalBlock(bytes, 0, bytes.Length))); }
public static string Decrypt(string fileName) { return(Decryptor.DecryptText(File.ReadAllBytes(fileName), "ITP", "I wandered lonely as a cloud,\r\n That floats on high o'er vales and hills,\r\n When all at once I saw a crowd,\r\n A host of golden daffodils")); }