SP800108HmacCounterKdf.DeriveBytes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
用衍生金鑰填充緩衝區。
多載
DeriveBytes(Byte[], HashAlgorithmName, Byte[], Byte[], Int32)
推導出指定長度的金鑰。
public:
static cli::array <System::Byte> ^ DeriveBytes(cli::array <System::Byte> ^ key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ label, cli::array <System::Byte> ^ context, int derivedKeyLengthInBytes);
public static byte[] DeriveBytes(byte[] key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] label, byte[] context, int derivedKeyLengthInBytes);
static member DeriveBytes : byte[] * System.Security.Cryptography.HashAlgorithmName * byte[] * byte[] * int -> byte[]
Public Shared Function DeriveBytes (key As Byte(), hashAlgorithm As HashAlgorithmName, label As Byte(), context As Byte(), derivedKeyLengthInBytes As Integer) As Byte()
參數
- key
- Byte[]
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- Byte[]
標示導出金鑰目的的標籤。
- context
- Byte[]
包含與導出金鑰相關資訊的上下文。
- derivedKeyLengthInBytes
- Int32
導出金鑰的長度,以位元組為單位。
傳回
一個包含導出金鑰的陣列。
例外狀況
hashAlgorithm 有個 Name 空的。
derivedKeyLengthInBytes 為負值或大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
目前平台尚未支援 HMAC 實作。
適用於
DeriveBytes(Byte[], HashAlgorithmName, String, String, Int32)
推導出指定長度的金鑰。
public:
static cli::array <System::Byte> ^ DeriveBytes(cli::array <System::Byte> ^ key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::String ^ label, System::String ^ context, int derivedKeyLengthInBytes);
public static byte[] DeriveBytes(byte[] key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, string label, string context, int derivedKeyLengthInBytes);
static member DeriveBytes : byte[] * System.Security.Cryptography.HashAlgorithmName * string * string * int -> byte[]
Public Shared Function DeriveBytes (key As Byte(), hashAlgorithm As HashAlgorithmName, label As String, context As String, derivedKeyLengthInBytes As Integer) As Byte()
參數
- key
- Byte[]
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- String
標示導出金鑰目的的標籤。
- context
- String
包含與導出金鑰相關資訊的上下文。
- derivedKeyLengthInBytes
- Int32
導出金鑰的長度,以位元組為單位。
傳回
一個包含導出金鑰的陣列。
例外狀況
hashAlgorithm 有個 Name 空的。
derivedKeyLengthInBytes 為負值或大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
label 或 context 包含無法轉換為 UTF-8 的文字。
目前平台尚未支援 HMAC 實作。
備註
label 並 context 會使用 UTF-8 編碼轉換成位元組。 對於其他編碼,則使用所需的編碼進行轉換,並使用一個過載,接受標籤與上下文作為位元組序列。
適用於
DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)
推導出指定長度的金鑰。
public:
static cli::array <System::Byte> ^ DeriveBytes(ReadOnlySpan<System::Byte> key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> label, ReadOnlySpan<System::Byte> context, int derivedKeyLengthInBytes);
public static byte[] DeriveBytes(ReadOnlySpan<byte> key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, int derivedKeyLengthInBytes);
static member DeriveBytes : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * ReadOnlySpan<byte> * int -> byte[]
Public Shared Function DeriveBytes (key As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, label As ReadOnlySpan(Of Byte), context As ReadOnlySpan(Of Byte), derivedKeyLengthInBytes As Integer) As Byte()
參數
- key
- ReadOnlySpan<Byte>
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- ReadOnlySpan<Byte>
標示導出金鑰目的的標籤。
- context
- ReadOnlySpan<Byte>
包含與導出金鑰相關資訊的上下文。
- derivedKeyLengthInBytes
- Int32
導出金鑰的長度,以位元組為單位。
傳回
一個包含導出金鑰的陣列。
例外狀況
hashAlgorithm 有一個 Name thatis null.
hashAlgorithm 有個 Name 空的。
derivedKeyLengthInBytes 為負值或大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
目前平台尚未支援 HMAC 實作。
適用於
DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>)
用衍生金鑰填充緩衝區。
public:
static void DeriveBytes(ReadOnlySpan<System::Byte> key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> label, ReadOnlySpan<System::Byte> context, Span<System::Byte> destination);
public static void DeriveBytes(ReadOnlySpan<byte> key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, Span<byte> destination);
static member DeriveBytes : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> -> unit
Public Shared Sub DeriveBytes (key As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, label As ReadOnlySpan(Of Byte), context As ReadOnlySpan(Of Byte), destination As Span(Of Byte))
參數
- key
- ReadOnlySpan<Byte>
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- ReadOnlySpan<Byte>
標示導出金鑰目的的標籤。
- context
- ReadOnlySpan<Byte>
包含與導出金鑰相關資訊的上下文。
例外狀況
hashAlgorithm 有一個 Name thatis null.
hashAlgorithm 有個 Name 空的。
destination 大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
目前平台尚未支援 HMAC 實作。
適用於
DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Int32)
推導出指定長度的金鑰。
public:
static cli::array <System::Byte> ^ DeriveBytes(ReadOnlySpan<System::Byte> key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<char> context, int derivedKeyLengthInBytes);
public static byte[] DeriveBytes(ReadOnlySpan<byte> key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<char> context, int derivedKeyLengthInBytes);
static member DeriveBytes : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<char> * ReadOnlySpan<char> * int -> byte[]
Public Shared Function DeriveBytes (key As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, label As ReadOnlySpan(Of Char), context As ReadOnlySpan(Of Char), derivedKeyLengthInBytes As Integer) As Byte()
參數
- key
- ReadOnlySpan<Byte>
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- ReadOnlySpan<Char>
標示導出金鑰目的的標籤。
- context
- ReadOnlySpan<Char>
包含與導出金鑰相關資訊的上下文。
- derivedKeyLengthInBytes
- Int32
導出金鑰的長度,以位元組為單位。
傳回
一個包含導出金鑰的陣列。
例外狀況
hashAlgorithm 有一個 Name thatis null.
hashAlgorithm 有個 Name 空的。
derivedKeyLengthInBytes 為負值或大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
label 或 context 包含無法轉換為 UTF-8 的文字。
目前平台尚未支援 HMAC 實作。
備註
label 並 context 會使用 UTF-8 編碼轉換成位元組。 對於其他編碼,則使用所需的編碼進行轉換,並使用一個過載,將標籤與上下文視為一串位元組。
適用於
DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Byte>)
用衍生金鑰填充緩衝區。
public:
static void DeriveBytes(ReadOnlySpan<System::Byte> key, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<char> context, Span<System::Byte> destination);
public static void DeriveBytes(ReadOnlySpan<byte> key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<char> context, Span<byte> destination);
static member DeriveBytes : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<char> * ReadOnlySpan<char> * Span<byte> -> unit
Public Shared Sub DeriveBytes (key As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, label As ReadOnlySpan(Of Char), context As ReadOnlySpan(Of Char), destination As Span(Of Byte))
參數
- key
- ReadOnlySpan<Byte>
就是金鑰推導金鑰。
- hashAlgorithm
- HashAlgorithmName
HMAC 演算法。
- label
- ReadOnlySpan<Char>
標示導出金鑰目的的標籤。
- context
- ReadOnlySpan<Char>
包含與導出金鑰相關資訊的上下文。
例外狀況
hashAlgorithm 有一個 Name thatis null.
hashAlgorithm 有個 Name 空的。
destination 大於可推導的最大位元組數。
hashAlgorithm 不是已知或支援的雜湊演算法。
label 或 context 包含無法轉換為 UTF-8 的文字。
目前平台尚未支援 HMAC 實作。
備註
label 並 context 會使用 UTF-8 編碼轉換成位元組。 對於其他編碼,則使用所需的編碼進行轉換,並使用一個過載,將標籤與上下文視為一串位元組。