public void Encrypt_Normal(string plainText, string expetedText) { var plainBytes = Encoding.UTF8.GetBytes(plainText); var encryptedBytes = _desCryptoUtil.Encrypt(plainBytes, DesCryptoSetting.Key, DesCryptoSetting.Iv); var result = Convert.ToBase64String(encryptedBytes); Assert.AreEqual(expetedText, result); }
public void Encrypt(string plainText) { var plainBytes = _bytesUtil.FromString(plainText); var encryptedBytes = _desCryptoUtil.Encrypt(plainBytes); var encryptedText = _bytesUtil.ToBase64(encryptedBytes); Console.WriteLine("Plain text:{0}, encrypted text:{1}", plainText, encryptedText); }