<cryptoClasses> 元素

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

<配置><mscorlib><cryptographySettings><cryptoNameMapping><cryptoClasses>

Syntax

<cryptoClasses>
</cryptoClasses>

特性和元素

下列各节描述了特性、子元素和父元素。

特性

没有。

子元素

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

父元素

元素 Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。
cryptographySettings 包含加密设置。
cryptoNameMapping 包含类到友好名称的映射。
mscorlib 包含 cryptographySettings 元素。

Example

以下示例演示如何使用 <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>

另请参阅