Share via


HMAC.Create Método

Definição

Cria uma instância da implementação de um HMAC (Hash-based Message Authentication Code).

Sobrecargas

Create()
Obsoleto.
Obsoleto.

Cria uma instância da implementação padrão de um HMAC (Hash-based Message Authentication Code).

Create(String)
Obsoleto.

Cria uma instância da implementação especificada de um HMAC (Hash-based Message Authentication Code).

Create()

Origem:
HMAC.cs
Origem:
HMAC.cs
Origem:
HMAC.cs

Cuidado

The default implementation of this cryptography algorithm is not supported

Cuidado

The default implementation of this cryptography algorithm is not supported.

Cria uma instância da implementação padrão de um 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

Retornos

Uma nova instância SHA-1, a menos que as configurações padrão tenham sido alteradas usando o elemento <cryptoClass>.

Atributos

Exceções

.NET Core 2.0 – 3.1 e .NET 5 e posterior: em todos os casos.

Comentários

Esse método é obsoleto no .NET 5 e versões posteriores.

Por padrão, essa sobrecarga usa a implementação SHA-1 do HMAC. Se você quiser especificar uma implementação diferente, use a Create(String) sobrecarga, que permite especificar um nome de algoritmo.

Devido a problemas de colisão com SHA-1, a Microsoft recomenda um modelo de segurança baseado no SHA-256 ou superior.

Aplica-se a

Create(String)

Origem:
HMAC.cs
Origem:
HMAC.cs
Origem:
HMAC.cs

Cuidado

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

Cria uma instância da implementação especificada de um 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

Parâmetros

algorithmName
String

A implementação do HMAC a ser usada. A tabela a seguir mostra os valores válidos para o parâmetro algorithmName e os algoritmos para os quais são mapeados.

Valor do parâmetro Implements
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

Retornos

Uma nova instância da implementação do HMAC especificada.

Atributos

Comentários

O HMAC dá suporte a vários algoritmos de hash, incluindo MD5, SHA-1, SHA-256 e RIPEMD160. Para obter a lista completa, consulte os valores com suporte para o algorithmName parâmetro .

Devido a problemas de colisão com MD5 e SHA-1, a Microsoft recomenda um modelo de segurança baseado no SHA-256 ou superior.

Aplica-se a