public void EncryptStringToBytes_ShoulThrowExcpetion_When_IVIsNull() { var rijandeal = new RijndealCryptography(); var KEY = rijandeal.GenerateKey(); Assert.Throws <IVException>( () => rijandeal.EncryptStringToBytes("test", KEY, null) ); }
public void DecryptStringFromBytes_ShoulThrowExcpetion_When_IVIsNull() { var rijandeal = new RijndealCryptography(); var KEY = rijandeal.GenerateKey(); Assert.Throws <IVException>( () => rijandeal.DecryptStringFromBytes(new byte[] { 0, 1 }, KEY, null) ); }
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) ); }