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; rootNode.RequirePermission = cryptographySettings.SectionInformation.RequirePermission; 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); }