加密设置的 <mscorlib> 元素

更新:2007 年 11 月

包含 <cryptographySettings> 元素

<configuration> 元素
  加密设置的 <mscorlib> 元素

<mscorlib> 
</mscorlib>

属性和元素

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

属性

无。

子元素

元素

说明

cryptographySettings

包含加密设置。

父元素

元素

说明

configuration

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

示例

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

<configuration>
   <mscorlib>
      <cryptographySettings>
         <cryptoNameMapping>
            <cryptoClasses>
               <cryptoClass   MyCryptoRSA="MyCryptoRSAClass, MyAssembly
                  Culture=neutral, PublicKeyToken=a5d015c7d5a0b012,
                  Version=1.0.0.0"/>
            </cryptoClasses>
            <nameEntry name="RSA" class="MyCryptoRSA"/>
            <nameEntry name="System.Security.Cryptography.AsymmetricAlgorithm"
                       class="MyCryptoRSA"/>
         </cryptoNameMapping>
      </cryptographySettings>
   </mscorlib>
</configuration>

请参见

参考

密码设置架构

CreateFromName

System.Security.Cryptography

其他资源

.NET Framework 的配置文件架构

加密服务

配置加密类