Rfc2898DeriveBytes.Pbkdf2 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會用 PBKDF2 衍生的金鑰填充緩衝區。
多載
| 名稱 | Description |
|---|---|
| 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[]
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
- outputLength
- Int32
要推導的金鑰大小,以位元組為單位。
傳回
一個包含 PBKDF2 衍生金鑰的位元組陣列。
例外狀況
password 或 salt 為 null。
hashAlgorithm 有一個 Name 空 null或 。
適用於
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>
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
- outputLength
- Int32
要推導的金鑰大小,以位元組為單位。
傳回
一個包含 PBKDF2 衍生金鑰的位元組陣列。
例外狀況
hashAlgorithm 有一個 Name 空 null或 。
適用於
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>
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
例外狀況
iterations 這不是一個正值。
hashAlgorithm 有一個 Name 空 null或 。
適用於
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>
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
- outputLength
- Int32
要推導的金鑰大小,以位元組為單位。
傳回
一個長度為 的 outputLength 位元組陣列,填充了偽隨機的密鑰位元組。
例外狀況
hashAlgorithm 有一個 Name 空 null或 。
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>
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
例外狀況
iterations 這不是一個正值。
hashAlgorithm 有一個 Name 空 null或 。
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[]
用來推導出鑰匙的 key salt。
- iterations
- Int32
運算的迭代次數。
- hashAlgorithm
- HashAlgorithmName
用來推導金鑰的雜湊演算法。
- outputLength
- Int32
要推導的金鑰大小,以位元組為單位。
傳回
一個長度為 的 outputLength 位元組陣列,填充了偽隨機的密鑰位元組。
例外狀況
password 或 salt 為 null。
hashAlgorithm 有一個 Name 空 null或 。
password 包含無法轉換為 UTF8 的文字。
備註
會 password 使用 UTF8 編碼轉換成位元組。 對於其他編碼,請使用適當的 Encoding 密碼串轉換為位元組,並使用 Pbkdf2(Byte[], Byte[], Int32, HashAlgorithmName, Int32)。