Exemplo n.º 1
0
        public void CreateHMACSHA1Key()
        {
            KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACSHA1).AssemblyQualifiedName);

            Assert.AreEqual(64, keyCreator.KeyLength);
            Assert.AreEqual(64, keyCreator.GenerateKey().Length);
            Assert.IsFalse(CryptographyUtility.CompareBytes(keyCreator.GenerateKey(), keyCreator.GenerateKey()));
        }
 public void KeyWithZeroLEngthDoesNotPassValidation()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsFalse(keyCreator.KeyIsValid(new byte[0]));
 }
 public void NullKeyDoesNotPassValidation()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsFalse(keyCreator.KeyIsValid(null));
 }
 public void CreateKeyCreatesValidKey()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsTrue(keyCreator.KeyIsValid(keyCreator.GenerateKey()));
 }
 public void CreateKeyCreatesKeyOfDefaultSize()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.AreEqual(keyCreator.KeyLength, keyCreator.GenerateKey().Length);
 }
Exemplo n.º 6
0
 public void KeyWithZeroLEngthDoesNotPassValidation()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsFalse(keyCreator.KeyIsValid(new byte[0]));
 }
Exemplo n.º 7
0
 public void NullKeyDoesNotPassValidation()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsFalse(keyCreator.KeyIsValid(null));
 }
Exemplo n.º 8
0
 public void CreateKeyCreatesValidKey()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.IsTrue(keyCreator.KeyIsValid(keyCreator.GenerateKey()));
 }
Exemplo n.º 9
0
 public void CreateKeyCreatesKeyOfDefaultSize()
 {
     KeyedHashAlgorithmKeyCreator keyCreator = new KeyedHashAlgorithmKeyCreator(typeof(HMACMD5));
     Assert.AreEqual(keyCreator.KeyLength, keyCreator.GenerateKey().Length);
 }