Bewerken

Delen via


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

Definition

Caution

Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.

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);
[System.Obsolete("Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.", DiagnosticId="SYSLIB0033", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public byte[] CryptDeriveKey (string algname, string alghashname, int keySize, byte[] rgbIV);
member this.CryptDeriveKey : string * string * int * byte[] -> byte[]
[<System.Obsolete("Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.", DiagnosticId="SYSLIB0033", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
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

The algorithm name for which to derive the key.

alghashname
String

The hash algorithm name to use to derive the key.

keySize
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.

Attributes

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