HMAC.Create Метод

Определение

Создает экземпляр реализации хэш-кода проверки подлинности сообщения (HMAC).

Перегрузки

Create()
Устаревшие..
Устаревшие..

Создает экземпляр реализации хэш-кода проверки подлинности сообщения (HMAC) по умолчанию.

Create(String)
Устаревшие..

Создает экземпляр заданной реализации хэш-кода проверки подлинности сообщения (HMAC).

Create()

Исходный код:
HMAC.cs
Исходный код:
HMAC.cs
Исходный код:
HMAC.cs

Внимание!

The default implementation of this cryptography algorithm is not supported

Внимание!

The default implementation of this cryptography algorithm is not supported.

Создает экземпляр реализации хэш-кода проверки подлинности сообщения (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

Возвращаемое значение

Новый экземпляр SHA-1, если параметры по умолчанию не были изменены с помощью элемента <cryptoClass>.

Атрибуты

Исключения

.NET Core 2.0 –3.1 и .NET 5 и более поздних версий: во всех случаях.

Комментарии

Этот метод устарел в .NET 5 и более поздних версиях.

По умолчанию эта перегрузка использует реализацию SHA-1 HMAC. Если вы хотите указать другую реализацию, используйте перегрузку Create(String) , которая позволяет указать имя алгоритма.

Из-за проблем с конфликтами с SHA-1 Майкрософт рекомендует использовать модель безопасности на основе SHA-256 или более поздней версии.

Применяется к

Create(String)

Исходный код:
HMAC.cs
Исходный код:
HMAC.cs
Исходный код:
HMAC.cs

Внимание!

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

Создает экземпляр заданной реализации хэш-кода проверки подлинности сообщения (HMAC).

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

Параметры

algorithmName
String

Реализация кода HMAC для использования. В следующей таблице представлены допустимые значения параметра algorithmName и алгоритмы, с которыми они сопоставляются.

Значение параметра Инструменты
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

Возвращаемое значение

Новый экземпляр заданной реализации кода HMAC.

Атрибуты

Комментарии

HMAC поддерживает ряд хэш-алгоритмов, включая MD5, SHA-1, SHA-256 и RIPEMD160. Полный список см. в разделе Поддерживаемые значения параметра algorithmName .

Из-за проблем с конфликтами с MD5 и SHA-1 Майкрософт рекомендует модель безопасности на основе SHA-256 или более поздней версии.

Применяется к