HMAC.Create Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Skapar en instans av en implementering av en Hash-baserad kod för meddelandeautentisering (HMAC) .
Överlagringar
| Name | Description |
|---|---|
| Create() |
Föråldrad.
Föråldrad.
Skapar en instans av standardimplementeringen av en Hash-baserad kod för meddelandeautentisering (HMAC). |
| Create(String) |
Föråldrad.
Skapar en instans av den angivna implementeringen av en Hash-baserad kod för meddelandeautentisering (HMAC). |
Create()
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
Varning
The default implementation of this cryptography algorithm is not supported.
Varning
The default implementation of this cryptography algorithm is not supported
Skapar en instans av standardimplementeringen av en Hash-baserad kod för meddelandeautentisering (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
Returer
En ny SHA-1-instans, såvida inte standardinställningarna har ändrats med hjälp <av cryptoClass-elementet>.
- Attribut
Undantag
.NET Core 2.0 – 3.1 och .NET 5 och senare: I samtliga fall.
Kommentarer
Den här metoden är föråldrad i .NET 5 och senare versioner.
Som standard använder den här överlagringen SHA-1-implementeringen av HMAC. Om du vill ange en annan implementering använder du överlagringen Create(String) , vilket gör att du kan ange ett algoritmnamn i stället.
På grund av kollisionsproblem med SHA-1 rekommenderar Microsoft en säkerhetsmodell baserad på SHA-256 eller bättre.
Gäller för
Create(String)
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
- Källa:
- HMAC.cs
Varning
Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.
Skapar en instans av den angivna implementeringen av en Hash-baserad kod för meddelandeautentisering (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
Parametrar
- algorithmName
- String
Den HMAC-implementering som ska användas. I följande tabell visas giltiga värden för parametern algorithmName och de algoritmer som de mappas till.
| Parametervärde | Implementerar |
|---|---|
| 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 |
Returer
En ny instans av den angivna HMAC-implementeringen.
- Attribut
Kommentarer
HMAC stöder ett antal hashalgoritmer, inklusive MD5, SHA-1, SHA-256 och RIPEMD160. Den fullständiga listan finns i de värden som stöds för parametern algorithmName .
På grund av kollisionsproblem med MD5 och SHA-1 rekommenderar Microsoft en säkerhetsmodell baserad på SHA-256 eller bättre.