diff --git a/util/cryp/cryp_test.go b/util/cryp/cryp_test.go index f9c13c2f..cb198f0f 100644 --- a/util/cryp/cryp_test.go +++ b/util/cryp/cryp_test.go @@ -56,6 +56,20 @@ func TestBlank(t *testing.T) { } +func TestCorrupt(t *testing.T) { + + key := []byte("1hg7dbrma8ghe547") + enc := []byte("corrupt") + + Convey("Cryptography should fail", t, func() { + dec, _ := Decrypt(key, enc) + Convey("Decrypt", func() { + So(dec, ShouldResemble, enc) + }) + }) + +} + func TestInvalid(t *testing.T) { key := []byte("invalidkey") @@ -74,6 +88,36 @@ func TestInvalid(t *testing.T) { } +func TestInvalidD(t *testing.T) { + + val := []byte("1hg7dbrma8ghe547") + key := []byte("invalidkey") + str := []byte("Hello World") + + Convey("Decryption should fail", t, func() { + enc, _ := Encrypt(val, str) + dec, _ := Decrypt(key, enc) + Convey("Decrypt", func() { + So(dec, ShouldResemble, []byte(nil)) + }) + }) + +} + +func TestInvalidE(t *testing.T) { + + key := []byte("invalidkey") + str := []byte("Hello World") + + Convey("Encryption should fail", t, func() { + enc, _ := Encrypt(key, str) + Convey("Encrypt", func() { + So(enc, ShouldResemble, []byte(nil)) + }) + }) + +} + func TestAES128(t *testing.T) { key := []byte("1hg7dbrma8ghe547")