public void CreateKeyWithAES()
 {
     SymmetricAlgorithmKeyCreator keyCreator = new SymmetricAlgorithmKeyCreator(typeof(RijndaelManaged).AssemblyQualifiedName);
     Assert.AreEqual(32, keyCreator.KeyLength);
     Assert.AreEqual(32, keyCreator.GenerateKey().Length);
     Assert.IsFalse((keyCreator.GenerateKey() == keyCreator.GenerateKey()));
 }
Beispiel #2
0
        public void Clone()
        {
            SymmetricAlgorithmKeyCreator keyCreator = new SymmetricAlgorithmKeyCreator(typeof(RijndaelManaged).AssemblyQualifiedName);
            byte[] key = keyCreator.GenerateKey();

            KeySettings settings = new KeySettings(keyCreator);
            settings.Key = key;
            KeySettings settingsClone = settings.Clone();

            Assert.AreSame(keyCreator, settingsClone.KeyCreator);
            Assert.AreEqual(key, settingsClone.Key);
        }