private SymmetricAlgorithmProviderData GetSymmetricAlgorithmProviderDataFromCursor() { SymmetricCryptoProviderData symmetricCryptoProviderData = cryptoConfigurationView.GetSymmetricCryptoProviderData(ConfigurationName); ArgumentValidation.CheckExpectedType(symmetricCryptoProviderData, typeof(SymmetricAlgorithmProviderData)); return((SymmetricAlgorithmProviderData)symmetricCryptoProviderData); }
/// <summary> /// <para>Gets the <see cref="Type"/> of the <see cref="ISymmetricCryptoProvider"/> to create based on the name.</para> /// </summary> /// <param name="cryptoProviderName"> /// <para>The name of the configuration object to create.</para> /// </param> /// <returns> /// <para>The <see cref="Type"/> of <see cref="ISymmetricCryptoProvider"/> to create.</para> /// </returns> protected override Type GetConfigurationType(string cryptoProviderName) { CryptographyConfigurationView cryptoConfigurationView = (CryptographyConfigurationView)CreateConfigurationView(); SymmetricCryptoProviderData symmetricCryptoProviderData = cryptoConfigurationView.GetSymmetricCryptoProviderData(cryptoProviderName); return(GetType(symmetricCryptoProviderData.TypeName)); }
/// <summary> /// Constructs a new instance /// with the corresponding runtime configuration data. /// </summary> /// <param name="symmetricCryptoProviderData">The corresponding runtime configuration data.</param> protected SymmetricCryptoProviderNode(SymmetricCryptoProviderData symmetricCryptoProviderData) : base(/*SR.SymmetricCryptoProviderNodeName*/) { if (symmetricCryptoProviderData == null) { throw new ArgumentNullException("symmetricCryptoProviderData"); } this.symmetricCryptoProviderData = symmetricCryptoProviderData; }
public void Indexer() { SymmetricCryptoProviderDataCollection collection = new SymmetricCryptoProviderDataCollection(); MockSymmetricCryptoProviderData providerData = new MockSymmetricCryptoProviderData(); providerData.Name = "provider1"; collection[providerData.Name] = providerData; Assert.AreEqual(1, collection.Count, "count"); SymmetricCryptoProviderData compareData1 = collection["provider1"]; Assert.AreSame(providerData, compareData1, "string indexer"); SymmetricCryptoProviderData compareData2 = collection[0]; Assert.AreSame(providerData, compareData2, "int indexer"); }
/// <summary> /// <para>Gets the named <see cref="SymmetricCryptoProviderData"/> from the <see cref="CryptographySettings"/>.</para> /// </summary> /// <param name="symmetricProviderName"> /// <para>The name of the <see cref="SymmetricCryptoProviderData"/>.</para> /// </param> /// <returns> /// <para>The named <see cref="SymmetricCryptoProviderData"/> from the <see cref="CryptographySettings"/>.</para> /// </returns> public virtual SymmetricCryptoProviderData GetSymmetricCryptoProviderData(string symmetricProviderName) { CryptographySettings settings = ConfigurationContext.GetConfiguration(CryptographySettings.SectionName) as CryptographySettings; if (settings == null) { throw new ConfigurationException(SR.ExceptionCryptoSettingsMissing); } SymmetricCryptoProviderData symmetricCryptoProviderData = settings.SymmetricCryptoProviders[symmetricProviderName]; if (symmetricCryptoProviderData == null) { throw new ConfigurationException(SR.ExceptionNoCryptoProvider(symmetricProviderName)); } return(symmetricCryptoProviderData); }