Ejemplo n.º 1
0
        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)
                );
        }
Ejemplo n.º 2
0
        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)
                );
        }
Ejemplo n.º 3
0
        public void EncryptStringToBytes_ShoulThrowExcpetion_When_IVIsNull()
        {
            var rijandeal = new RijndealCryptography();
            var KEY       = rijandeal.GenerateKey();

            Assert.Throws <IVException>(
                () =>
                rijandeal.EncryptStringToBytes("test", KEY, null)
                );
        }
Ejemplo n.º 4
0
        public void EncryptStringToBytes_ShoulThrowExcpetion_When_KeyIsNull()
        {
            var rijandeal = new RijndealCryptography();
            var IV        = rijandeal.GenerateIV();

            Assert.Throws <KeyException>(
                () =>
                rijandeal.EncryptStringToBytes("test", null, IV)
                );
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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)
                );
        }