HMAC.Create Metoda

Definicja

Tworzy wystąpienie implementacji kodu uwierzytelniania komunikatów opartego na skrótach (HMAC) .

Przeciążenia

Nazwa Opis
Create()
Przestarzałe.
Przestarzałe.

Tworzy wystąpienie domyślnej implementacji kodu uwierzytelniania komunikatów opartego na skrótach (HMAC).

Create(String)
Przestarzałe.

Tworzy wystąpienie określonej implementacji kodu uwierzytelniania komunikatów opartych na skrótach (HMAC).

Create()

Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs

Uwaga

The default implementation of this cryptography algorithm is not supported.

Uwaga

The default implementation of this cryptography algorithm is not supported

Tworzy wystąpienie domyślnej implementacji kodu uwierzytelniania komunikatów opartego na skrótach (HMAC).

public:
 static System::Security::Cryptography::HMAC ^ 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.HMAC 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.HMAC Create();
public static System.Security.Cryptography.HMAC 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.HMAC
[<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.HMAC
static member Create : unit -> System.Security.Cryptography.HMAC
Public Shared Function Create () As HMAC

Zwraca

Nowe wystąpienie SHA-1, chyba że ustawienia domyślne zostały zmienione przy użyciu <elementu cryptoClass>.

Atrybuty

Wyjątki

.NET Core 2.0 — 3.1 i .NET 5 i nowszych: we wszystkich przypadkach.

Uwagi

Ta metoda jest przestarzała w wersji .NET 5 i nowszych.

Domyślnie to przeciążenie używa implementacji ALGORYTMU SHA-1 HMAC. Jeśli chcesz określić inną implementację, użyj Create(String) przeciążenia, które umożliwia określenie nazwy algorytmu.

Ze względu na problemy z kolizją z algorytmem SHA-1 firma Microsoft zaleca model zabezpieczeń oparty na algorytmie SHA-256 lub lepszym.

Dotyczy

Create(String)

Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs
Źródło:
HMAC.cs

Uwaga

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

Tworzy wystąpienie określonej implementacji kodu uwierzytelniania komunikatów opartych na skrótach (HMAC).

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

Parametry

algorithmName
String

Implementacja HMAC do użycia. W poniższej tabeli przedstawiono prawidłowe wartości parametru algorithmName i algorytmy, do których są mapowe.

Wartość parametru Implementuje
System.Security.Cryptography.HMAC HMACSHA1
System.Security.Cryptography.KeyedHashAlgorithm HMACSHA1
HMACMD5 HMACMD5
System.Security.Cryptography.HMACMD5 HMACMD5
HMACRIPEMD160 HMACRIPEMD160
System.Security.Cryptography.HMACRIPEMD160 HMACRIPEMD160
HMACSHA1 HMACSHA1
System.Security.Cryptography.HMACSHA1 HMACSHA1
HMACSHA256 HMACSHA256
System.Security.Cryptography.HMACSHA256 HMACSHA256
HMACSHA384 HMACSHA384
System.Security.Cryptography.HMACSHA384 HMACSHA384
HMACSHA512 HMACSHA512
System.Security.Cryptography.HMACSHA512 HMACSHA512
Mactripledes MACTripleDES
System.Security.Cryptography.MACTripleDES MACTripleDES

Zwraca

Nowe wystąpienie określonej implementacji HMAC.

Atrybuty

Uwagi

HMAC obsługuje wiele algorytmów wyznaczania wartości skrótu, w tym MD5, SHA-1, SHA-256 i RIPEMD160. Aby uzyskać pełną listę, zobacz obsługiwane wartości parametru algorithmName .

Ze względu na problemy z kolizjami z rozwiązaniem MD5 i SHA-1 firma Microsoft zaleca model zabezpieczeń oparty na algorytmie SHA-256 lub lepszym.

Dotyczy