public void TestEncryptDecrypt() { byte[] key = Util.GetSecretBytes(32); ProfileCipher cipher = new ProfileCipher(key); byte[] name = cipher.EncryptName(Encoding.UTF8.GetBytes("Clement Duval"), 26); byte[] plaintext = cipher.DecryptName(name); Assert.AreEqual("Clement Duval", Encoding.UTF8.GetString(plaintext)); }
public void TestEmpty() { byte[] key = Util.GetSecretBytes(32); ProfileCipher cipher = new ProfileCipher(key); byte[] name = cipher.EncryptName(Encoding.UTF8.GetBytes(string.Empty), 26); byte[] plaintext = cipher.DecryptName(name); Assert.AreEqual(0, plaintext.Length); }