public void Do_Encrypt(string data) { var initialVector = new byte[16]; var key = new byte[32]; var rnd = new Random(); rnd.NextBytes(key); rnd.NextBytes(initialVector); var sut = new CryptographyProvider(); var encryptedValue = sut.Encrypt(data, key, initialVector, Encoding.ASCII); var value = sut.Decrypt(encryptedValue, key, initialVector, Encoding.ASCII); Assert.Equal(data, value); }
/// <summary> /// Decryptes the specified cypherText and returns the decrypted value. /// </summary> /// <param name="cypherText">The text to decrypt.</param> /// <returns>The decrypted text.</returns> public static string Decrypt(string cypherText) { return(_provider.Decrypt(cypherText)); }