语言

HKDF.DeriveKey 方法

定义

执行密钥派生 HKF Expand 和 Extract 函数。

重载

名称 说明
DeriveKey(HashAlgorithmName, Byte[], Int32, Byte[], Byte[])

执行密钥派生 HKF Expand 和 Extract 函数。

DeriveKey(HashAlgorithmName, ReadOnlySpan<Byte>, Span<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

执行密钥派生 HKF Expand 和 Extract 函数。

DeriveKey(HashAlgorithmName, Byte[], Int32, Byte[], Byte[])

Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs

执行密钥派生 HKF Expand 和 Extract 函数。

public static byte[] DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, int outputLength, byte[]? salt = default, byte[]? info = default);
static member DeriveKey : System.Security.Cryptography.HashAlgorithmName * byte[] * int * byte[] * byte[] -> byte[]
Public Shared Function DeriveKey (hashAlgorithmName As HashAlgorithmName, ikm As Byte(), outputLength As Integer, Optional salt As Byte() = Nothing, Optional info As Byte() = Nothing) As Byte()

参数

hashAlgorithmName
HashAlgorithmName

用于 HMAC 操作的哈希算法。

ikm
Byte[]

输入键键材料。

outputLength
Int32

输出键键材料长度。

salt
Byte[]

可选的盐值(非机密随机值)。 如果未提供,则默认为与指定哈希算法的输出长度相同的字节数组。

info
Byte[]

可选的上下文和应用程序特定信息。

返回

Byte[]

输出键键材料。

例外

ikm是 null.

outputLength 小于 1。

在 .NET 11 及更高版本中Windows,ikm超过 2,048 字节。

适用于

DeriveKey(HashAlgorithmName, ReadOnlySpan<Byte>, Span<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs

执行密钥派生 HKF Expand 和 Extract 函数。

public:
 static void DeriveKey(System::Security::Cryptography::HashAlgorithmName hashAlgorithmName, ReadOnlySpan<System::Byte> ikm, Span<System::Byte> output, ReadOnlySpan<System::Byte> salt, ReadOnlySpan<System::Byte> info);
public static void DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> ikm, Span<byte> output, ReadOnlySpan<byte> salt, ReadOnlySpan<byte> info);
static member DeriveKey : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * Span<byte> * ReadOnlySpan<byte> * ReadOnlySpan<byte> -> unit
Public Shared Sub DeriveKey (hashAlgorithmName As HashAlgorithmName, ikm As ReadOnlySpan(Of Byte), output As Span(Of Byte), salt As ReadOnlySpan(Of Byte), info As ReadOnlySpan(Of Byte))

参数

hashAlgorithmName
HashAlgorithmName

用于 HMAC 操作的哈希算法。

ikm
ReadOnlySpan<Byte>

输入键键材料。

output
Span<Byte>

表示输出键键材料的输出缓冲区。

salt
ReadOnlySpan<Byte>

盐值(非机密随机值)。

info
ReadOnlySpan<Byte>

上下文和应用程序特定信息(可以是空范围)。

例外

output 为空,或大于允许的最大长度。

在 .NET 11 及更高版本中Windows,ikm超过 2,048 字节。

适用于