HMAC.Create Metoda

Definice

Vytvoří instanci implementace kódu založenéhoHMAC na hodnotě hash () .

Přetížení

Create()
Zastaralé.
Zastaralé.

Vytvoří instanci výchozí implementace kódu HMAC (Hash-based Message Authentication Code).

Create(String)
Zastaralé.

Vytvoří instanci zadané implementace kódu HMAC (Hash-based Message Authentication Code).

Create()

Zdroj:
HMAC.cs
Zdroj:
HMAC.cs
Zdroj:
HMAC.cs

Upozornění

The default implementation of this cryptography algorithm is not supported

Upozornění

The default implementation of this cryptography algorithm is not supported.

Vytvoří instanci výchozí implementace kódu HMAC (Hash-based Message Authentication Code).

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

Návraty

Nová instance SHA-1, pokud výchozí nastavení nebyla změněna pomocí elementu< cryptoClass>.

Atributy

Výjimky

.NET Core 2.0 – 3.1 a .NET 5 a novější: Ve všech případech.

Poznámky

Tato metoda je v .NET 5 a novějších verzích zastaralá.

Ve výchozím nastavení toto přetížení používá implementaci SHA-1 HMAC. Pokud chcete zadat jinou implementaci, použijte Create(String) přetížení, které místo toho umožňuje zadat název algoritmu.

Kvůli problémům s kolizí se sha-1 Microsoft doporučuje model zabezpečení založený na sha-256 nebo lepším.

Platí pro

Create(String)

Zdroj:
HMAC.cs
Zdroj:
HMAC.cs
Zdroj:
HMAC.cs

Upozornění

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

Vytvoří instanci zadané implementace kódu HMAC (Hash-based Message Authentication Code).

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

Parametry

algorithmName
String

Implementace HMAC, která se má použít. Následující tabulka uvádí platné hodnoty parametru algorithmName a algoritmy, na které se mapují.

Hodnota parametru Implementuje
System.Security.Cryptography.HMACHMACSHA1
System.Security.Cryptography.KeyedHashAlgorithmHMACSHA1
HMACMD5HMACMD5
System.Security.Cryptography.HMACMD5HMACMD5
HMACRIPEMD160HMACRIPEMD160
System.Security.Cryptography.HMACRIPEMD160HMACRIPEMD160
HMACSHA1HMACSHA1
System.Security.Cryptography.HMACSHA1HMACSHA1
HMACSHA256HMACSHA256
System.Security.Cryptography.HMACSHA256HMACSHA256
HMACSHA384HMACSHA384
System.Security.Cryptography.HMACSHA384HMACSHA384
HMACSHA512HMACSHA512
System.Security.Cryptography.HMACSHA512HMACSHA512
MACTripleDESMACTripleDES
System.Security.Cryptography.MACTripleDESMACTripleDES

Návraty

Nová instance zadané implementace HMAC.

Atributy

Poznámky

HMAC podporuje řadu hash algoritmů, včetně MD5, SHA-1, SHA-256 a RIPEMD160. Úplný seznam najdete v podporovaných hodnotách parametru algorithmName .

Kvůli problémům se kolizemi s MD5 a SHA-1 Microsoft doporučuje model zabezpečení založený na algoritmu SHA-256 nebo lepším.

Platí pro