Share via


AsymmetricAlgorithm.Create Méthode

Définition

Crée un objet de chiffrement utilisé pour exécuter l'algorithme asymétrique.

Surcharges

Create()
Obsolète.
Obsolète.

Crée un objet de chiffrement par défaut utilisé pour exécuter l'algorithme asymétrique.

Create(String)
Obsolète.

Crée une instance de l'implémentation spécifiée d'un algorithme asymétrique.

Create()

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

Attention

The default implementation of this cryptography algorithm is not supported

Attention

The default implementation of this cryptography algorithm is not supported.

Crée un objet de chiffrement par défaut utilisé pour exécuter l'algorithme asymétrique.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create();
[System.Obsolete("The default implementation of this cryptography algorithm is not supported", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
[System.Obsolete("The default implementation of this cryptography algorithm is not supported.", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
[<System.Obsolete("The default implementation of this cryptography algorithm is not supported", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : unit -> System.Security.Cryptography.AsymmetricAlgorithm
[<System.Obsolete("The default implementation of this cryptography algorithm is not supported.", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : unit -> System.Security.Cryptography.AsymmetricAlgorithm
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>.

Attributs

Exceptions

.NET Core 2.0 - 3.1 et .NET 5 et versions ultérieures : dans tous les cas.

Remarques

Cette méthode est obsolète dans .NET 5 et versions ultérieures.

Exemple

L’exemple de code suivant montre comment implémenter la Create méthode dans une classe étendue. Cet exemple de code fait partie d’un exemple plus grand fourni pour la AsymmetricAlgorithm classe .

    // 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

S’applique à

Create(String)

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

Attention

Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.

Crée une instance de l'implémentation spécifiée d'un algorithme asymétrique.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create(System::String ^ algName);
public static System.Security.Cryptography.AsymmetricAlgorithm? Create (string algName);
[System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm? Create (string algName);
public static System.Security.Cryptography.AsymmetricAlgorithm Create (string algName);
static member Create : string -> System.Security.Cryptography.AsymmetricAlgorithm
[<System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : string -> System.Security.Cryptography.AsymmetricAlgorithm
Public Shared Function Create (algName As String) As AsymmetricAlgorithm

Paramètres

algName
String

Implémentation de l'algorithme asymétrique à utiliser. Le tableau suivant indique les valeurs valides du paramètre algName et les algorithmes auxquels elles sont mappées.

Valeur de paramètre Implémentations
System.Security.Cryptography.AsymmetricAlgorithmAsymmetricAlgorithm
RSARSA
System.Security.Cryptography.RSARSA
DSADSA
System.Security.Cryptography.DSADSA
ECDsaECDsa
ECDsaCngECDsaCng
System.Security.Cryptography.ECDsaCngECDsaCng
ECDHECDiffieHellman
ECDiffieHellmanECDiffieHellman
ECDiffieHellmanCngECDiffieHellmanCng
System.Security.Cryptography.ECDiffieHellmanCngECDiffieHellmanCng

Retours

Nouvelle instance de l'implémentation de l'algorithme asymétrique spécifiée.

Attributs

Exemples

L’exemple de code suivant montre comment implémenter la Create méthode dans une classe étendue. Cet exemple de code fait partie d’un exemple plus grand fourni pour la AsymmetricAlgorithm classe .

    // 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 à