<nameEntry> Element
Maps a class name to a friendly algorithm name, which allows one class to have many friendly names.
<configuration>
<mscorlib>
<cryptographySettings>
<cryptoNameMapping>
<nameEntry>
<nameEntry name="friendly name" Class="class name" />
Required Attributes
Attribute | Description |
---|---|
name | Specifies the friendly name of the algorithm that the cryptography class implements. |
class | Specifies the value for the name attribute in the <cryptoClass> element. |
Remarks
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.
Example
The following example shows how to use the <nameEntry> element to map a cryptography class to friendly algorithm name. This example configures the runtime so that System.Security.CryptoConfig.CreateFromName("RSA") and System.Security.Cryptography.AsymmetricAlgorithm.Create in an application returns 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>
Configuration File
This element can be used in the machine configuration file (Machine.config).
See Also
Configuration File Schema | Cryptography Settings Schema | Cryptographic Services | Configuring Cryptography Classes