Export (0) Print
Expand All

<nameEntry> Element

Maps a class name to a friendly algorithm name, which allows one class to have many friendly names.

<configuration> Element
  <mscorlib> Element for Cryptography Settings
    <cryptographySettings> Element
      <cryptoNameMapping> Element
        <nameEntry> Element
<nameEntry name="friendly name" Class="class name" />

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

name

Required attribute.

Specifies the friendly name of the algorithm that the cryptography class implements.

class

Required attribute.

Specifies the value for the name attribute in the <cryptoClass> element.

Child Elements

None.

Parent Elements

Element

Description

configuration

The root element in every configuration file used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section.

The name attribute can be the name of one of the abstract classes found in the System.Security.Cryptography namespace. When you call the Create method on an abstract cryptography class, the abstract class name is passed to the Security.CryptoConfig.CreateFromName method. CreateFromName returns an instance of the type indicated by the class attribute. If the name attribute is a short name, such as RSA, you can use that name when calling the CreateFromName method.

The following example shows how to use the <nameEntry> element to reference a cryptography class and to configure the runtime. You can then pass the string "RSA" to the CryptoConfig.CreateFromName method and use the Create method to return a MyCryptoRSAClass object.

<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>
Show:
© 2014 Microsoft