public void EncryptStringToBytes_ShoulThrowExcpetion_When_KeyIsNull() { var rijandeal = new RijndealCryptography(); var IV = rijandeal.GenerateIV(); Assert.Throws <KeyException>( () => rijandeal.EncryptStringToBytes("test", null, IV) ); }
public void DecryptStringFromBytes_ShoulThrowExcpetion_When_KeyIsNull() { var rijandeal = new RijndealCryptography(); var IV = rijandeal.GenerateIV(); Assert.Throws <KeyException>( () => rijandeal.DecryptStringFromBytes(new byte[] { 0, 1 }, null, IV) ); }
public void EncryptStringToBytes_ShouldReturn_EncryptedValue(string value) { var rijandeal = new RijndealCryptography(); var IV = rijandeal.GenerateIV(); var KEY = rijandeal.GenerateKey(); var encrypted = rijandeal.EncryptStringToBytes(value, KEY, IV); var decrypted = rijandeal.DecryptStringFromBytes(encrypted, KEY, IV); Assert.Equal(value, decrypted); }
public void DecryptStringFromBytes_ShoulThrowExcpetion_When_textIsnull() { var rijandeal = new RijndealCryptography(); var KEY = rijandeal.GenerateKey(); var IV = rijandeal.GenerateIV(); Assert.Throws <RijndealException>( () => rijandeal.DecryptStringFromBytes(null, KEY, IV) ); }