public void EncryptDecryptBufferTest() { string STRING_EncryptionKey = "thisIsMyP@55w0rd"; byte[] vBYTE_ToEncrypt = Encoding.UTF8.GetBytes("0123456789qwertyuiopasdfghjklzxcvbnm");//new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 }; byte[] vBYTE_EncryptedBuffer = AesProvider.AES_CBC_Encryption_Rand_IV(vBYTE_ToEncrypt, STRING_EncryptionKey); byte[] vBYTE_DecryptedBuffer = AesProvider.AES_CBC_Decryption_Rand_IV(vBYTE_EncryptedBuffer, STRING_EncryptionKey); Assert.IsTrue(vBYTE_ToEncrypt.SequenceEqual(vBYTE_DecryptedBuffer)); }
public void EncryptDecryptStringTest() { string STRING_EncryptionKey = "thisIsMyP@55w0rd"; string STRING_ToEncrypt = "0123456789qwertyuiopasdfghjklzxcvbnm"; string STRING_EncryptedString = AesProvider.AES_CBC_Encryption_Rand_IV(STRING_ToEncrypt, STRING_EncryptionKey); string STRING_DecryptedString = AesProvider.AES_CBC_Decryption_Rand_IV(STRING_EncryptedString, STRING_EncryptionKey); Assert.IsTrue(STRING_DecryptedString.Equals(STRING_ToEncrypt)); }