Rfc2898DeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Rfc2898DeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Rfc2898DeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Rfc2898DeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Method

Definition

Derives a cryptographic key from the Rfc2898DeriveBytes object.

public:
 cli::array <System::Byte> ^ CryptDeriveKey(System::String ^ algname, System::String ^ alghashname, int keySize, cli::array <System::Byte> ^ rgbIV);
public byte[] CryptDeriveKey (string algname, string alghashname, int keySize, byte[] rgbIV);
member this.CryptDeriveKey : string * string * int * byte[] -> byte[]
Public Function CryptDeriveKey (algname As String, alghashname As String, keySize As Integer, rgbIV As Byte()) As Byte()

Parameters

algname
String String String String

The algorithm name for which to derive the key.

alghashname
String String String String

The hash algorithm name to use to derive the key.

keySize
Int32 Int32 Int32 Int32

The size of the key, in bits, to derive.

rgbIV
Byte[]

The initialization vector (IV) to use to derive the key.

Returns

Byte[]

The derived key.

Exceptions

The keySize parameter is incorrect.

-or-

The cryptographic service provider (CSP) cannot be acquired.

-or-

The algname parameter is not a valid algorithm name.

-or-

The alghashname parameter is not a valid hash algorithm name.

Remarks

This function is a wrapper for the Crypto API function CryptDeriveKey(), and is intended to offer interoperability with applications using the Crypto API.

If the keySize parameter is set to 0 bits, the default key size for the specified algorithm is used.

Applies to