AsymmetricAlgorithm.Create Método

Definición

Crea un objeto criptográfico para realizar el algoritmo asimétrico.

Sobrecargas

Create()
Obsoleto.
Obsoleto.

Crea un objeto criptográfico predeterminado que se usa para realizar el algoritmo asimétrico.

Create(String)

Crea una instancia de la implementación especificada de un algoritmo asimétrico.

Create()

Precaución

The default implementation of this cryptography algorithm is not supported

Precaución

The default implementation of this cryptography algorithm is not supported.

Crea un objeto criptográfico predeterminado que se usa para realizar el algoritmo asimétrico.

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

Devoluciones

AsymmetricAlgorithm

Una nueva instancia de RSACryptoServiceProvider, a menos que la configuración predeterminada se haya cambiado con el elemento <cryptoClass>.

Atributos

Excepciones

.NET Core 2.0 - 3.1 y .NET 5 y versiones posteriores: en todos los casos.

Comentarios

Este método está obsoleto en .NET 5 y versiones posteriores.

Ejemplo

En el ejemplo de código siguiente se muestra cómo implementar el Create método en una clase extendida. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la AsymmetricAlgorithm clase .

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

Consulte también

Se aplica a

Create(String)

Crea una instancia de la implementación especificada de un algoritmo asimétrico.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create(System::String ^ algName);
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
Public Shared Function Create (algName As String) As AsymmetricAlgorithm

Parámetros

algName
String

La implementación de algoritmo asimétrico que se usará. En la tabla siguiente se muestran los valores válidos para el parámetro algName y los algoritmos a los que se asignan.

Valor de parámetro Implementaciones
System.Security.Cryptography.AsymmetricAlgorithm AsymmetricAlgorithm
RSA RSA
System.Security.Cryptography.RSA RSA
DSA DSA
System.Security.Cryptography.DSA DSA
ECDsa ECDsa
ECDsaCng ECDsaCng
System.Security.Cryptography.ECDsaCng ECDsaCng
ECDH ECDiffieHellman
ECDiffieHellman ECDiffieHellman
ECDiffieHellmanCng ECDiffieHellmanCng
System.Security.Cryptography.ECDiffieHellmanCng ECDiffieHellmanCng

Devoluciones

AsymmetricAlgorithm

Nueva instancia de la implementación de algoritmo asimétrico especificada.

Ejemplos

En el ejemplo de código siguiente se muestra cómo implementar el Create método en una clase extendida. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la AsymmetricAlgorithm clase .

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

Consulte también

Se aplica a