แก้ไข

แชร์ผ่าน


SP800108HmacCounterKdf.DeriveBytes Method

Definition

Overloads

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

Derives a key of a specified length.

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

Derives a key of a specified length.

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

Derives a key of a specified length.

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

Fills a buffer with a derived key.

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

Derives a key of a specified length.

DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Byte>)

Fills a buffer with a derived key.

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

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Derives a key of a specified length.

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()

Parameters

key
Byte[]

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
Byte[]

The label that identifies the purpose for the derived key.

context
Byte[]

The context containing information related to the derived key.

derivedKeyLengthInBytes
Int32

The length of the derived key, in bytes.

Returns

Byte[]

An array containing the derived key.

Exceptions

key is null.

-or-

label is null.

-or-

context is null.

-or-

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

derivedKeyLengthInBytes is negative or larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

The current platform does not have a supported implementation of HMAC.

Applies to

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

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Derives a key of a specified length.

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()

Parameters

key
Byte[]

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
String

The label that identifies the purpose for the derived key.

context
String

The context containing information related to the derived key.

derivedKeyLengthInBytes
Int32

The length of the derived key, in bytes.

Returns

Byte[]

An array containing the derived key.

Exceptions

key is null.

-or-

label is null.

-or-

context is null.

-or-

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

derivedKeyLengthInBytes is negative or larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

label or context contains text that cannot be converted to UTF-8.

The current platform does not have a supported implementation of HMAC.

Remarks

label and context will be converted to bytes using the UTF-8 encoding. for other encodings, perform the conversion using the desired encoding and use an overload which accepts the label and context as a sequence of bytes.

Applies to

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

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Derives a key of a specified length.

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()

Parameters

key
ReadOnlySpan<Byte>

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
ReadOnlySpan<Byte>

The label that identifies the purpose for the derived key.

context
ReadOnlySpan<Byte>

The context containing information related to the derived key.

derivedKeyLengthInBytes
Int32

The length of the derived key, in bytes.

Returns

Byte[]

An array containing the derived key.

Exceptions

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

derivedKeyLengthInBytes is negative or larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

The current platform does not have a supported implementation of HMAC.

Applies to

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

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Fills a buffer with a derived key.

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))

Parameters

key
ReadOnlySpan<Byte>

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
ReadOnlySpan<Byte>

The label that identifies the purpose for the derived key.

context
ReadOnlySpan<Byte>

The context containing information related to the derived key.

destination
Span<Byte>

The buffer which will receive the derived key.

Exceptions

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

destination is larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

The current platform does not have a supported implementation of HMAC.

Applies to

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

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Derives a key of a specified length.

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()

Parameters

key
ReadOnlySpan<Byte>

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
ReadOnlySpan<Char>

The label that identifies the purpose for the derived key.

context
ReadOnlySpan<Char>

The context containing information related to the derived key.

derivedKeyLengthInBytes
Int32

The length of the derived key, in bytes.

Returns

Byte[]

An array containing the derived key.

Exceptions

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

derivedKeyLengthInBytes is negative or larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

label or context contains text that cannot be converted to UTF-8.

The current platform does not have a supported implementation of HMAC.

Remarks

label and context will be converted to bytes using the UTF-8 encoding. for other encodings, perform the conversion using the desired encoding and use an overload which accepts the label and context as a sequence of bytes.

Applies to

DeriveBytes(ReadOnlySpan<Byte>, HashAlgorithmName, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Byte>)

Source:
SP800108HmacCounterKdf.cs
Source:
SP800108HmacCounterKdf.cs

Fills a buffer with a derived key.

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))

Parameters

key
ReadOnlySpan<Byte>

The key-derivation key.

hashAlgorithm
HashAlgorithmName

The HMAC algorithm.

label
ReadOnlySpan<Char>

The label that identifies the purpose for the derived key.

context
ReadOnlySpan<Char>

The context containing information related to the derived key.

destination
Span<Byte>

The buffer which will receive the derived key.

Exceptions

hashAlgorithm has a Name which is null.

hashAlgorithm has a Name which is empty.

destination is larger than the maximum number of bytes that can be derived.

hashAlgorithm is not a known or supported hash algorithm.

label or context contains text that cannot be converted to UTF-8.

The current platform does not have a supported implementation of HMAC.

Remarks

label and context will be converted to bytes using the UTF-8 encoding. for other encodings, perform the conversion using the desired encoding and use an overload which accepts the label and context as a sequence of bytes.

Applies to