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

            Assert.IsNotNull(symmetricAlgorithmNode);
        }
コード例 #2
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);
        }
コード例 #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);
        }
コード例 #5
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);

        }