AsymmetricAlgorithm.Create Methode

Definitie

Hiermee maakt u een cryptografisch object dat wordt gebruikt om het asymmetrische algoritme uit te voeren.

Overloads

Name Description
Create()
Verouderd.
Verouderd.

Hiermee maakt u een standaard cryptografisch object dat wordt gebruikt om het asymmetrische algoritme uit te voeren.

Create(String)
Verouderd.

Hiermee maakt u een exemplaar van de opgegeven implementatie van een asymmetrisch algoritme.

Create()

Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs

Let op

The default implementation of this cryptography algorithm is not supported.

Let op

The default implementation of this cryptography algorithm is not supported

Hiermee maakt u een standaard cryptografisch object dat wordt gebruikt om het asymmetrische algoritme uit te voeren.

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

Retouren

Een nieuw RSACryptoServiceProvider exemplaar, tenzij de standaardinstellingen zijn gewijzigd met het <cryptoClass-element>.

Kenmerken

Uitzonderingen

.NET Core 2.0 - 3.1 en .NET 5 en hoger: In alle gevallen.

Opmerkingen

Deze methode is verouderd in .NET 5 en latere versies.

Voorbeeld

In het volgende codevoorbeeld ziet u hoe u de Create methode in een uitgebreide klasse implementeert. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de AsymmetricAlgorithm klasse.

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

Zie ook

Van toepassing op

Create(String)

Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs
Bron:
AsymmetricAlgorithm.cs

Let op

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

Hiermee maakt u een exemplaar van de opgegeven implementatie van een asymmetrisch algoritme.

public:
 static System::Security::Cryptography::AsymmetricAlgorithm ^ Create(System::String ^ algName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
[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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
public static System.Security.Cryptography.AsymmetricAlgorithm? Create(string algName);
public static System.Security.Cryptography.AsymmetricAlgorithm Create(string algName);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")>]
[<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
static member Create : string -> System.Security.Cryptography.AsymmetricAlgorithm
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")>]
static member Create : string -> System.Security.Cryptography.AsymmetricAlgorithm
Public Shared Function Create (algName As String) As AsymmetricAlgorithm

Parameters

algName
String

De implementatie van het asymmetrische algoritme dat moet worden gebruikt. In de volgende tabel ziet u de geldige waarden voor de algName parameter en de algoritmen waaraan ze zijn toegewezen.

Parameterwaarde Implementeert
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

Retouren

Een nieuw exemplaar van de opgegeven asymmetrische algoritme-implementatie.

Kenmerken

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de Create methode in een uitgebreide klasse implementeert. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de AsymmetricAlgorithm klasse.

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

Zie ook

Van toepassing op