Пример #1
0
        public CryptographySettingsNode Build()
        {
            CryptographySettingsNode rootNode = new CryptographySettingsNode();

            HashProviderCollectionNode hashProviderCollectionNode = new HashProviderCollectionNode();

            foreach (HashProviderData hashProviderData in cryptographySettings.HashProviders)
            {
                CreateHashProviderNode(hashProviderCollectionNode, hashProviderData);
            }

            SymmetricCryptoProviderCollectionNode symmetricCryptoProviderCollectionNode = new SymmetricCryptoProviderCollectionNode();

            foreach (SymmetricProviderData symmetricCryptoProviderData in cryptographySettings.SymmetricCryptoProviders)
            {
                CreateSymmetricCryptoProviderNode(symmetricCryptoProviderCollectionNode, symmetricCryptoProviderData);
            }

            rootNode.AddNode(hashProviderCollectionNode);
            rootNode.AddNode(symmetricCryptoProviderCollectionNode);

            rootNode.DefaultHashProvider            = defaultHashProviderNode;
            rootNode.DefaultSymmetricCryptoProvider = defaultSymmetricProviderNode;

            return(rootNode);
        }
		private void CreateHashProviderNode(HashProviderCollectionNode hashProviderCollectionNode, HashProviderData hashProviderData)
		{
			HashProviderNode hashProviderNode = NodeCreationService.CreateNodeByDataType(hashProviderData.GetType(), new object[] { hashProviderData }) as HashProviderNode;
			if (null == hashProviderNode)
			{
				LogNodeMapError(hashProviderCollectionNode, hashProviderData.GetType());
				return;
			}

			if (string.Compare(hashProviderNode.Name, cryptographySettings.DefaultHashProviderName) == 0)
			{
				defaultHashProviderNode = hashProviderNode;
			}

			hashProviderCollectionNode.AddNode(hashProviderNode);
		}
Пример #3
0
        private void CreateHashProviderNode(HashProviderCollectionNode hashProviderCollectionNode, HashProviderData hashProviderData)
        {
            HashProviderNode hashProviderNode = NodeCreationService.CreateNodeByDataType(hashProviderData.GetType(), new object[] { hashProviderData }) as HashProviderNode;

            if (null == hashProviderNode)
            {
                LogNodeMapError(hashProviderCollectionNode, hashProviderData.GetType());
                return;
            }

            if (string.Compare(hashProviderNode.Name, cryptographySettings.DefaultHashProviderName) == 0)
            {
                defaultHashProviderNode = hashProviderNode;
            }

            hashProviderCollectionNode.AddNode(hashProviderNode);
        }
Пример #4
0
        private void GetHashProviderDataCollection()
        {
            HashProviderCollectionNode hashProviderCollectionNode = Hierarchy.FindNodeByType(typeof(HashProviderCollectionNode)) as HashProviderCollectionNode;

            if (hashProviderCollectionNode == null)
            {
                return;
            }
            if (Object.ReferenceEquals(cryptographySettings.HashProviders, hashProviderCollectionNode.HashProviderDataCollection))
            {
                return;
            }

            cryptographySettings.HashProviders.Clear();
            foreach (HashProviderData hashProviderData in hashProviderCollectionNode.HashProviderDataCollection)
            {
                cryptographySettings.HashProviders[hashProviderData.Name] = hashProviderData;
            }
        }
		public CryptographySettingsNode Build()
		{
			CryptographySettingsNode rootNode = new CryptographySettingsNode();

			HashProviderCollectionNode hashProviderCollectionNode = new HashProviderCollectionNode();
			foreach (HashProviderData hashProviderData in cryptographySettings.HashProviders)
			{
				CreateHashProviderNode(hashProviderCollectionNode, hashProviderData);
			}

			SymmetricCryptoProviderCollectionNode symmetricCryptoProviderCollectionNode = new SymmetricCryptoProviderCollectionNode();
			foreach (SymmetricProviderData symmetricCryptoProviderData in cryptographySettings.SymmetricCryptoProviders)
			{
				CreateSymmetricCryptoProviderNode(symmetricCryptoProviderCollectionNode, symmetricCryptoProviderData);
			}

			rootNode.AddNode(hashProviderCollectionNode);
			rootNode.AddNode(symmetricCryptoProviderCollectionNode);

			rootNode.DefaultHashProvider = defaultHashProviderNode;
			rootNode.DefaultSymmetricCryptoProvider = defaultSymmetricProviderNode;

			return rootNode;
		}