Esempio n. 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);
        }
        /// <summary>
        /// <para>Adds the <see cref="CryptographySettingsNode"/> to the current application, with its default childnodes.</para>
        /// </summary>
        /// <param name="e"><para>An <see cref="EventArgs"/> containing the event data.</para></param>
        protected override void OnExecuted(EventArgs e)
        {
            base.OnExecuted(e);
            CryptographySettingsNode node = ChildNode as CryptographySettingsNode;

            Debug.Assert(null != node, "The added node should be a CryptographySettingsNode");

            node.AddNode(new HashProviderCollectionNode());
            node.AddNode(new SymmetricCryptoProviderCollectionNode());
        }
		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;
		}