Rfc2898DeriveBytes.Pbkdf2 方法

定义

重载

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

从密码字节创建 PBKDF2 派生密钥。

Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)

从密码字节创建 PBKDF2 派生密钥。

Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)

使用 PBKDF2 派生密钥填充缓冲区。

Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)

从密码创建 PBKDF2 派生密钥。

Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)

使用 PBKDF2 派生密钥填充缓冲区。

Pbkdf2(String, Byte[], Int32, HashAlgorithmName, Int32)

从密码创建 PBKDF2 派生密钥。

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

从密码字节创建 PBKDF2 派生密钥。

public:
 static cli::array <System::Byte> ^ Pbkdf2(cli::array <System::Byte> ^ password, cli::array <System::Byte> ^ salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : byte[] * byte[] * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As Byte(), salt As Byte(), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()

参数

password
Byte[]

用于派生密钥的密码。

salt
Byte[]

用于派生密钥的密钥 salt。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

outputLength
Int32

要派生的键的大小。

返回

Byte[]

包含创建的 PBKDF2 派生密钥的字节数组。

例外

passwordsaltnull

outputLength 不是零值或正值。

-或-

iterations 不是正值。

hashAlgorithmName具有空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括SHA1SHA256SHA384SHA512

适用于

Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)

从密码字节创建 PBKDF2 派生密钥。

public:
 static cli::array <System::Byte> ^ Pbkdf2(ReadOnlySpan<System::Byte> password, ReadOnlySpan<System::Byte> salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (ReadOnlySpan<byte> password, ReadOnlySpan<byte> salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : ReadOnlySpan<byte> * ReadOnlySpan<byte> * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As ReadOnlySpan(Of Byte), salt As ReadOnlySpan(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()

参数

password
ReadOnlySpan<Byte>

用于派生密钥的密码。

salt
ReadOnlySpan<Byte>

用于派生密钥的密钥 salt。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

outputLength
Int32

要派生的键的大小。

返回

Byte[]

包含创建的 PBKDF2 派生密钥的字节数组。

例外

outputLength 不是零值或正值。

-或-

iterations 不是正值。

hashAlgorithmName具有空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括SHA1SHA256SHA384SHA512

适用于

Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)

使用 PBKDF2 派生密钥填充缓冲区。

public:
 static void Pbkdf2(ReadOnlySpan<System::Byte> password, ReadOnlySpan<System::Byte> salt, Span<System::Byte> destination, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public static void Pbkdf2 (ReadOnlySpan<byte> password, ReadOnlySpan<byte> salt, Span<byte> destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
static member Pbkdf2 : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * int * System.Security.Cryptography.HashAlgorithmName -> unit
Public Shared Sub Pbkdf2 (password As ReadOnlySpan(Of Byte), salt As ReadOnlySpan(Of Byte), destination As Span(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName)

参数

password
ReadOnlySpan<Byte>

用于派生密钥的密码。

salt
ReadOnlySpan<Byte>

用于派生密钥的密钥 salt。

destination
Span<Byte>

要填充派生密钥的缓冲区。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

例外

iterations 不是正值。

hashAlgorithm 具有为 Name 空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括 SHA1SHA256SHA384SHA512

适用于

Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)

从密码创建 PBKDF2 派生密钥。

public:
 static cli::array <System::Byte> ^ Pbkdf2(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (ReadOnlySpan<char> password, ReadOnlySpan<byte> salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : ReadOnlySpan<char> * ReadOnlySpan<byte> * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As ReadOnlySpan(Of Char), salt As ReadOnlySpan(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()

参数

password
ReadOnlySpan<Char>

用于派生密钥的密码。

salt
ReadOnlySpan<Byte>

用于派生密钥的密钥 salt。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

outputLength
Int32

要派生的键的大小。

返回

Byte[]

用伪随机键字节填充的长度 outputLength 字节数组。

例外

outputLength 不是零值或正值。

-或-

iterations 不是正值。

hashAlgorithm 具有为 Name 空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括 SHA1SHA256SHA384SHA512

password 包含无法转换为 UTF8 的文本。

注解

password将使用 UTF8 编码将转换为字节。 对于其他编码,请使用适当的 Encoding 用法 Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)将密码字符串转换为字节。

适用于

Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)

使用 PBKDF2 派生密钥填充缓冲区。

public:
 static void Pbkdf2(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> salt, Span<System::Byte> destination, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public static void Pbkdf2 (ReadOnlySpan<char> password, ReadOnlySpan<byte> salt, Span<byte> destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
static member Pbkdf2 : ReadOnlySpan<char> * ReadOnlySpan<byte> * Span<byte> * int * System.Security.Cryptography.HashAlgorithmName -> unit
Public Shared Sub Pbkdf2 (password As ReadOnlySpan(Of Char), salt As ReadOnlySpan(Of Byte), destination As Span(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName)

参数

password
ReadOnlySpan<Char>

用于派生密钥的密码。

salt
ReadOnlySpan<Byte>

用于派生密钥的密钥 salt。

destination
Span<Byte>

要填充派生密钥的缓冲区。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

例外

iterations 不是正值。

hashAlgorithm 具有为 Name 空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括 SHA1SHA256SHA384SHA512

password 包含无法转换为 UTF8 的文本。

注解

password将使用 UTF8 编码将转换为字节。 对于其他编码,请使用适当的 Encoding 用法 Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)将密码字符串转换为字节。

适用于

Pbkdf2(String, Byte[], Int32, HashAlgorithmName, Int32)

从密码创建 PBKDF2 派生密钥。

public:
 static cli::array <System::Byte> ^ Pbkdf2(System::String ^ password, cli::array <System::Byte> ^ salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : string * byte[] * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As String, salt As Byte(), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()

参数

password
String

用于派生密钥的密码。

salt
Byte[]

用于派生密钥的密钥 salt。

iterations
Int32

操作的迭代数。

hashAlgorithm
HashAlgorithmName

用于派生密钥的哈希算法。

outputLength
Int32

要派生的键的大小。

返回

Byte[]

用伪随机键字节填充的长度 outputLength 字节数组。

例外

passwordsaltnull

outputLength 不是零值或正值。

-或-

iterations 不是正值。

hashAlgorithm 具有为 Name 空或 null

hashAlgorithm 是不支持的哈希算法。 支持的算法包括 SHA1SHA256SHA384SHA512

password 包含无法转换为 UTF8 的文本。

注解

password将使用 UTF8 编码将转换为字节。 对于其他编码,请使用适当的 Encoding 用法 Pbkdf2(Byte[], Byte[], Int32, HashAlgorithmName, Int32)将密码字符串转换为字节。

适用于