Ejemplo n.º 1
0
 public void SetKeyNull()
 {
     using (var keyedHash = new TestKeyedHashAlgorithm())
     {
         Assert.Throws<NullReferenceException>(() => keyedHash.Key = null);
     }
 }
Ejemplo n.º 2
0
 public void SetKeyNull()
 {
     using (var keyedHash = new TestKeyedHashAlgorithm())
     {
         Assert.Throws <NullReferenceException>(() => keyedHash.Key = null);
     }
 }
Ejemplo n.º 3
0
        public void SetKeyNull()
        {
            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = new byte[1];
                Assert.NotNull(keyedHash.Key);

                keyedHash.Key = null;
                Assert.Null(keyedHash.Key);
            }
        }
Ejemplo n.º 4
0
        public void SetKeyNull()
        {
            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = new byte[1];
                Assert.NotNull(keyedHash.Key);

                keyedHash.Key = null;
                Assert.Null(keyedHash.Key);
            }
        }
Ejemplo n.º 5
0
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;
                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();
                Assert.Null(keyedHash.Key);
            }
        }
Ejemplo n.º 6
0
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;
                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();
                Assert.Null(keyedHash.Key);
            }
        }
Ejemplo n.º 7
0
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();

                byte[] ignored;
                Assert.Throws<NullReferenceException>(() => ignored = keyedHash.Key);
            }
        }
Ejemplo n.º 8
0
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();

                byte[] ignored;
                Assert.Throws <NullReferenceException>(() => ignored = keyedHash.Key);
            }
        }
Ejemplo n.º 9
0
        public void EnsureKeyIsolation()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };
            byte[] keyCopy = (byte[])key.Clone();

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                key[0]++;

                byte[] hashKey = keyedHash.Key;

                Assert.Equal(keyCopy, hashKey);
                Assert.NotEqual(key, hashKey);
            }
        }
Ejemplo n.º 10
0
        public void EnsureKeyIsolation()
        {
            byte[] key     = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };
            byte[] keyCopy = (byte[])key.Clone();

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                key[0]++;

                byte[] hashKey = keyedHash.Key;

                Assert.Equal(keyCopy, hashKey);
                Assert.NotEqual(key, hashKey);
            }
        }
Ejemplo n.º 11
0
        public void EnsureGetKeyCopies()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                byte[] getKey1 = keyedHash.Key;
                byte[] getKey2 = keyedHash.Key;

                Assert.NotSame(getKey1, getKey2);
                Assert.Equal(getKey1, getKey2);
                Assert.Equal(key, getKey1);

                getKey1[0]++;
                Assert.NotEqual(getKey1, getKey2);
            }
        }
Ejemplo n.º 12
0
        public void EnsureGetKeyCopies()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                byte[] getKey1 = keyedHash.Key;
                byte[] getKey2 = keyedHash.Key;

                Assert.NotSame(getKey1, getKey2);
                Assert.Equal(getKey1, getKey2);
                Assert.Equal(key, getKey1);

                getKey1[0]++;
                Assert.NotEqual(getKey1, getKey2);
            }
        }