AsymmetricAlgorithm.Create Método
Definición
Crea un objeto criptográfico para realizar el algoritmo asimétrico.Creates a cryptographic object used to perform the asymmetric algorithm.
Sobrecargas
Create() |
Crea un objeto criptográfico predeterminado que se usa para realizar el algoritmo asimétrico.Creates a default cryptographic object used to perform the asymmetric algorithm. |
Create(String) |
Crea una instancia de la implementación especificada de un algoritmo asimétrico.Creates an instance of the specified implementation of an asymmetric algorithm. |
Create()
Crea un objeto criptográfico predeterminado que se usa para realizar el algoritmo asimétrico.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
Devoluciones
Una nueva instancia de RSACryptoServiceProvider, a menos que la configuración predeterminada se haya cambiado con el elemento <cryptoClass>.A new RSACryptoServiceProvider instance, unless the default settings have been changed with the <cryptoClass> element.
Excepciones
.NET Core 2.0 - 3.1, así como .NET 5.0 y versiones posteriores: En todos los casos..NET Core 2.0 - 3.1 and .NET 5.0 and later: In all cases.
Comentarios
Este método está obsoleto en .NET 5,0 y versiones posteriores.This method is obsolete in .NET 5.0 and later versions.
EjemploExample
En el ejemplo de código siguiente se muestra cómo implementar el Create método en una clase extendida.The following code example demonstrates how to implement the Create method in an extended class. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para la AsymmetricAlgorithm clase.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
Consulte también
Se aplica a
Create(String)
Crea una instancia de la implementación especificada de un algoritmo asimétrico.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);
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á.The asymmetric algorithm implementation to use. En la tabla siguiente se muestran los valores válidos para el parámetro algName
y los algoritmos a los que se asignan.The following table shows the valid values for the algName
parameter and the algorithms they map to.
Valor de parámetroParameter value | ImplementacionesImplements |
---|---|
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 |
Devoluciones
Nueva instancia de la implementación de algoritmo asimétrico especificada.A new instance of the specified asymmetric algorithm implementation.
Ejemplos
En el ejemplo de código siguiente se muestra cómo implementar el Create método en una clase extendida.The following code example demonstrates how to implement the Create method in an extended class. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para la AsymmetricAlgorithm clase.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