public void TestStringDecryption() { _encryption = new StringEncryption(new AesCryptoServiceProvider()); byte[] encrypted = _encryption.EncryptStringToBytes(_password, _key); string unencrypted = _encryption.DecryptStringFromBytes(encrypted, _key); Assert.AreEqual(unencrypted, _password); }
public void TestStringDecryptionDoesNotDecryptForInvalidPassword() { _encryption = new StringEncryption(new AesCryptoServiceProvider()); var decryption = new StringEncryption(new AesCryptoServiceProvider()); byte[] encrypted = _encryption.EncryptStringToBytes(_password, _key); Encoding enc = new UnicodeEncoding(); byte[] badPassBytes = enc.GetBytes("2dor39tp"); decryption.DecryptStringFromBytes(encrypted, badPassBytes); }
public void TestStringEncryption() { _encryption = new StringEncryption(new AesCryptoServiceProvider()); byte[] encrypted = _encryption.EncryptStringToBytes(_password, _key); Assert.NotNull(encrypted); }