public static void TestSetBadArguments() { KeyWrap1HeaderBlockForTest keyWrap1HeaderBlock = new KeyWrap1HeaderBlockForTest(new AesKey()); KeyWrapSalt okSalt = new KeyWrapSalt(16); KeyWrapSalt badSalt = new KeyWrapSalt(32); Assert.Throws <ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(null, okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[0], okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[16], okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[32], okSalt, 100); }); Assert.Throws <ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], null, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], badSalt, 100); }); }
public static void TestSetBadArguments() { KeyWrap1HeaderBlockForTest keyWrap1HeaderBlock = new KeyWrap1HeaderBlockForTest(new AesKey()); KeyWrapSalt okSalt = new KeyWrapSalt(16); KeyWrapSalt badSalt = new KeyWrapSalt(32); Assert.Throws<ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(null, okSalt, 100); }); Assert.Throws<ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[0], okSalt, 100); }); Assert.Throws<ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[16], okSalt, 100); }); Assert.Throws<ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[32], okSalt, 100); }); Assert.Throws<ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], null, 100); }); Assert.Throws<ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], badSalt, 100); }); }
public void TestSetBadArguments() { KeyWrap1HeaderBlockForTest keyWrap1HeaderBlock = new KeyWrap1HeaderBlockForTest(new V1DerivedKey(new Passphrase("passphrase")).DerivedKey); Salt okSalt = new Salt(128); Salt badSalt = new Salt(256); Assert.Throws <ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(null, okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[0], okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[16], okSalt, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[32], okSalt, 100); }); Assert.Throws <ArgumentNullException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], null, 100); }); Assert.Throws <ArgumentException>(() => { keyWrap1HeaderBlock.SetValuesDirect(new byte[24], badSalt, 100); }); }