示例#1
0
        public void CanCreateSymmetricAlgorithmProviderNodeByData()
        {
            INodeCreationService           nodeCreationService    = ServiceHelper.GetNodeCreationService(ServiceProvider);
            SymmetricAlgorithmProviderNode symmetricAlgorithmNode = nodeCreationService.CreateNodeByDataType(typeof(SymmetricAlgorithmProviderData)) as SymmetricAlgorithmProviderNode;

            Assert.IsNotNull(symmetricAlgorithmNode);
        }
        public void SymmetricAlgorithmProviderDataTest()
        {
            Type algorithmType = typeof(RijndaelManaged);
            string protectedKeyFilename = "some filename";
            DataProtectionScope protectedKeyProtectionScope = DataProtectionScope.LocalMachine;
            string name = "some name";

            SymmetricAlgorithmProviderData data = new SymmetricAlgorithmProviderData();
            data.Name = name;
            data.AlgorithmType = algorithmType;
            data.ProtectedKeyFilename = protectedKeyFilename;
            data.ProtectedKeyProtectionScope = protectedKeyProtectionScope;

            SymmetricAlgorithmProviderNode node = new SymmetricAlgorithmProviderNode(data);
            Assert.AreEqual(name, node.Name);
            Assert.AreEqual(algorithmType, node.AlgorithmType);
            Assert.AreEqual(protectedKeyProtectionScope, node.Key.Scope);
            Assert.AreEqual(protectedKeyFilename, node.Key.Filename);
        }
示例#3
0
        public void SymmetricAlgorithmProviderDataTest()
        {
            Type   algorithmType        = typeof(RijndaelManaged);
            string protectedKeyFilename = "some filename";
            DataProtectionScope protectedKeyProtectionScope = DataProtectionScope.LocalMachine;
            string name = "some name";

            SymmetricAlgorithmProviderData data = new SymmetricAlgorithmProviderData();

            data.Name                        = name;
            data.AlgorithmType               = algorithmType;
            data.ProtectedKeyFilename        = protectedKeyFilename;
            data.ProtectedKeyProtectionScope = protectedKeyProtectionScope;

            SymmetricAlgorithmProviderNode node = new SymmetricAlgorithmProviderNode(data);

            Assert.AreEqual(name, node.Name);
            Assert.AreEqual(algorithmType, node.AlgorithmType);
            Assert.AreEqual(protectedKeyProtectionScope, node.Key.Scope);
            Assert.AreEqual(protectedKeyFilename, node.Key.Filename);
        }
示例#4
0
        public void SymmetricAlgorithmProviderNodeTest()
        {
            Type algorithmType = typeof(RijndaelManaged);
            ProtectedKeySettings keySettings = new ProtectedKeySettings("some filename", DataProtectionScope.CurrentUser);
            string name = "some name";

            SymmetricAlgorithmProviderNode node = new SymmetricAlgorithmProviderNode();

            node.Name          = name;
            node.AlgorithmType = algorithmType;
            node.Key           = keySettings;

            Assert.AreEqual(name, node.Name);
            Assert.AreEqual(algorithmType, node.AlgorithmType);
            Assert.AreEqual(keySettings.Filename, node.Key.Filename);
            Assert.AreEqual(keySettings.Scope, node.Key.Scope);

            SymmetricAlgorithmProviderData data = (SymmetricAlgorithmProviderData)node.SymmetricCryptoProviderData;

            Assert.AreEqual(name, data.Name);
            Assert.AreEqual(algorithmType, data.AlgorithmType);
            Assert.AreEqual(keySettings.Filename, data.ProtectedKeyFilename);
            Assert.AreEqual(keySettings.Scope, data.ProtectedKeyProtectionScope);
        }
        public void SymmetricAlgorithmProviderNodeTest()
        {
            
            Type algorithmType = typeof(RijndaelManaged);
            ProtectedKeySettings keySettings = new ProtectedKeySettings("some filename", DataProtectionScope.CurrentUser);
            string name = "some name";

            SymmetricAlgorithmProviderNode node = new SymmetricAlgorithmProviderNode();
            node.Name = name;
            node.AlgorithmType = algorithmType;
            node.Key = keySettings;

            Assert.AreEqual(name, node.Name);
            Assert.AreEqual(algorithmType, node.AlgorithmType);
            Assert.AreEqual(keySettings.Filename, node.Key.Filename);
            Assert.AreEqual(keySettings.Scope, node.Key.Scope);

            SymmetricAlgorithmProviderData data = (SymmetricAlgorithmProviderData)node.SymmetricCryptoProviderData ;
            Assert.AreEqual(name, data.Name);
            Assert.AreEqual(algorithmType, data.AlgorithmType);
            Assert.AreEqual(keySettings.Filename, data.ProtectedKeyFilename);
            Assert.AreEqual(keySettings.Scope, data.ProtectedKeyProtectionScope);

        }