AsymmetricAlgorithm.Create AsymmetricAlgorithm.Create AsymmetricAlgorithm.Create AsymmetricAlgorithm.Create Method

Définition

Crée un objet de chiffrement utilisé pour exécuter l'algorithme asymétrique.Creates a cryptographic object used to perform the asymmetric algorithm.

Surcharges

Create() Create() Create() Create()

Crée un objet de chiffrement par défaut utilisé pour exécuter l'algorithme asymétrique.Creates a default cryptographic object used to perform the asymmetric algorithm.

Create(String) Create(String) Create(String) Create(String)

Crée une instance de l'implémentation spécifiée d'un algorithme asymétrique.Creates an instance of the specified implementation of an asymmetric algorithm.

Create() Create() Create() Create()

Crée un objet de chiffrement par défaut utilisé pour exécuter l'algorithme asymétrique.Creates a default cryptographic object used to perform the asymmetric algorithm.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create();
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
static member Create : unit -> System.Security.Cryptography.AsymmetricAlgorithm
Public Shared Function Create () As AsymmetricAlgorithm

Retours

Nouvelle instance de RSACryptoServiceProvider, à moins que les paramètres par défaut aient été modifiés avec l’élément <cryptoClass>.A new RSACryptoServiceProvider instance, unless the default settings have been changed with the <cryptoClass> element.

Exemples

L’exemple de code suivant montre comment implémenter Create la méthode dans une classe étendue.The following code example demonstrates how to implement the Create method in an extended class. Cet exemple de code fait partie d’un exemple plus complet fourni AsymmetricAlgorithm pour la classe.This code example is part of a larger example provided for the AsymmetricAlgorithm class.

    // The create function attempts to create a CustomCrypto 
    // object using the assembly name. This functionality requires 
    // modification of the machine.config file. Add the following 
    // section to the configuration element and modify the values 
    // of the cryptoClass to reflect what isinstalled 
    // in your machines GAC.
    //        <cryptoClass CustomCrypto="Contoso.CustomCrypto,
    //          CustomCrypto,
    //          Culture=neutral,
    //          PublicKeyToken=fdb9f9c4851028bf,
    //          Version=1.0.1448.27640" />
    //      <nameEntry name="Contoso.CustomCrypto" 
    //         class="CustomCrypto" />
    //      <nameEntry name="CustomCrypto" class="CustomCrypto" />

public:
    static CustomCrypto^ Create() 
    {
        return Create("CustomCrypto");
    }
// The create function attempts to create a CustomCrypto object using
// the assembly name. This functionality requires modification of the
// machine.config file. Add the following section to the configuration
// element and modify the values of the cryptoClass to reflect what is
// installed in your machines GAC.
//        <cryptoClass CustomCrypto="Contoso.CustomCrypto, 
//          CustomCrypto, 
//          Culture=neutral, 
//          PublicKeyToken=fdb9f9c4851028bf, 
//          Version=1.0.1448.27640" />
//      <nameEntry name="Contoso.CustomCrypto" class="CustomCrypto" />
//      <nameEntry name="CustomCrypto" class="CustomCrypto" />
new static public CustomCrypto Create() 
{
    return Create("CustomCrypto");
}
' The create function attempts to create a vbCustomCrypto object using
' the assembly name. This functionality requires modification of the
' machine.config file. Add the following section to the configuration
' element and modify the values of the cryptoClass to reflect what is
' installed in your machines GAC.
'          <cryptoClass vbCustomCrypto="Contoso.vbCustomCrypto, 
'            vbCustomCrypto, 
'            Culture=neutral, 
'            PublicKeyToken=fdb9f9c4851028bf, 
'            Version=1.0.1448.27640" />
'        <nameEntry name="Contoso.vbCustomCrypto" 
'                   class="vbCustomCrypto" />
'        <nameEntry name="vbCustomCrypto" class="vbCustomCrypto" />
Public Shadows Function Create() As vbCustomCrypto
    Return Create("vbCustomCrypto")
End Function
Voir aussi

Create(String) Create(String) Create(String) Create(String)

Crée une instance de l'implémentation spécifiée d'un algorithme asymétrique.Creates an instance of the specified implementation of an asymmetric algorithm.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create(System::String ^ algName);
public static System.Security.Cryptography.AsymmetricAlgorithm Create (string algName);
static member Create : string -> System.Security.Cryptography.AsymmetricAlgorithm
Public Shared Function Create (algName As String) As AsymmetricAlgorithm

Paramètres

algName
String String String String

Implémentation de l'algorithme asymétrique à utiliser.The asymmetric algorithm implementation to use. Le tableau suivant indique les valeurs valides du paramètre algName et les algorithmes auxquels elles sont mappées.The following table shows the valid values for the algName parameter and the algorithms they map to.

Valeur de paramètreParameter value ImplémentationsImplements
System.Security.Cryptography.AsymmetricAlgorithmSystem.Security.Cryptography.AsymmetricAlgorithm AsymmetricAlgorithm
RSARSA RSA
System.Security.Cryptography.RSASystem.Security.Cryptography.RSA RSA
DSADSA DSA
System.Security.Cryptography.DSASystem.Security.Cryptography.DSA DSA
ECDsaECDsa ECDsa
ECDsaCngECDsaCng ECDsaCng
System.Security.Cryptography.ECDsaCngSystem.Security.Cryptography.ECDsaCng ECDsaCng
ECDHECDH ECDiffieHellman
ECDiffieHellmanECDiffieHellman ECDiffieHellman
ECDiffieHellmanCngECDiffieHellmanCng ECDiffieHellmanCng
System.Security.Cryptography.ECDiffieHellmanCngSystem.Security.Cryptography.ECDiffieHellmanCng ECDiffieHellmanCng

Retours

Nouvelle instance de l'implémentation de l'algorithme asymétrique spécifiée.A new instance of the specified asymmetric algorithm implementation.

Exemples

L’exemple de code suivant montre comment implémenter Create la méthode dans une classe étendue.The following code example demonstrates how to implement the Create method in an extended class. Cet exemple de code fait partie d’un exemple plus complet fourni AsymmetricAlgorithm pour la classe.This code example is part of a larger example provided for the AsymmetricAlgorithm class.

    // The create function attempts to create a CustomCrypto object 
    // using the assembly name. This functionality requires 
    // modification of the machine.config file. Add the following 
    // section to the configuration element and modify the values 
    // of the cryptoClass to reflect what is installed 
    // in your machines GAC.
    //       <cryptoClass CustomCrypto="Contoso.CustomCrypto,
    //         CustomCrypto,
    //         Culture=neutral,
    //         PublicKeyToken=fdb9f9c4851028bf,
    //         Version=1.0.1448.27640" />
    //     <nameEntry name="Contoso.CustomCrypto" 
    //        class="CustomCrypto" />
    //     <nameEntry name="CustomCrypto" class="CustomCrypto" />

public:
    static CustomCrypto^ Create(String^ algorithmName) 
    {
        return (CustomCrypto^) 
            CryptoConfig::CreateFromName(algorithmName);
    }
// The create function attempts to create a CustomCrypto object using
// the assembly name. This functionality requires modification of the
// machine.config file. Add the following section to the configuration
// element and modify the values of the cryptoClass to reflect what is
// installed in your machines GAC.
//       <cryptoClass CustomCrypto="Contoso.CustomCrypto, 
//         CustomCrypto, 
//         Culture=neutral, 
//         PublicKeyToken=fdb9f9c4851028bf, 
//         Version=1.0.1448.27640" />
//     <nameEntry name="Contoso.CustomCrypto" class="CustomCrypto" />
//     <nameEntry name="CustomCrypto" class="CustomCrypto" />
new static public CustomCrypto Create(String algorithmName) 
{
    return (CustomCrypto) CryptoConfig.CreateFromName(algorithmName);
}
' The create function attempts to create a vbCustomCrypto object using
' the assembly name. This functionality requires modification of the
' machine.config file. Add the following section to the configuration
' element and modify the values of the cryptoClass to reflect what is
' installed in your machines GAC.
'          <cryptoClass vbCustomCrypto="Contoso.vbCustomCrypto, 
'            vbCustomCrypto, 
'            Culture=neutral, 
'            PublicKeyToken=fdb9f9c4851028bf, 
'            Version=1.0.1448.27640" />
'        <nameEntry name="Contoso.vbCustomCrypto" 
'                   class="vbCustomCrypto" />
'        <nameEntry name="vbCustomCrypto" class="vbCustomCrypto" />
Public Shadows Function Create( _
    ByVal algorithmName As String) As vbCustomCrypto

    Return CType( _
        CryptoConfig.CreateFromName(algorithmName), _
        vbCustomCrypto)

End Function
Voir aussi

S’applique à