<cryptoClasses> 元素

更新:2007 年 11 月

包含密码类的列表,这些类具有到 <nameEntry> 元素中的友好名称的映射。

<configuration> 元素
  加密设置的 <mscorlib> 元素
    <cryptographySettings> 元素
      <cryptoNameMapping> 元素
        <cryptoClasses> 元素

<cryptoClasses> 
</cryptoClasses>

属性和元素

以下几节描述了属性、子元素和父元素。

属性

无。

子元素

元素

说明

<cryptoClass>

包含一个密码类,该类具有到 <nameEntry> 元素中的友好名称的映射。

父元素

元素

说明

configuration

公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中的根元素。

cryptographySettings

包含加密设置。

cryptoNameMapping

包含类到友好名称的映射。

mscorlib

包含 cryptographySettings 元素。

示例

下面的示例演示如何使用 <cryptoClass> 元素来引用密码类和配置运行库。然后,您就可以将字符串“RSA”传递到 CryptoConfig.CreateFromName 方法并使用 Create 方法返回一个 MyCryptoRSAClass 对象。

<configuration>
   <mscorlib>
      <cryptographySettings>
         <cryptoNameMapping>
            <cryptoClasses>
               <cryptoClass   MyCryptoRSA="MyCryptoRSAClass, MyAssembly
                  Culture=neutral, PublicKeyToken=a5d015c7d5a0b012,
                  Version=1.0.0.0"/>
               <!-- Other cryptography classes go here. -->
            </cryptoClasses>
            <nameEntry name="RSA" class="MyCryptoRSA"/>
            <nameEntry name="System.Security.Cryptography.AsymmetricAlgorithm"
                       class="MyCryptoRSA"/>
             <!-- Mappings to other cryptography classes go here. -->
         </cryptoNameMapping>
      </cryptographySettings>
   </mscorlib>
</configuration>

请参见

参考

密码设置架构

System.Security.Cryptography.CryptoConfig.CreateFromName

System.Security.Cryptography

其他资源

.NET Framework 的配置文件架构

加密服务

配置加密类