Export (0) Print
Expand All

PasswordDeriveBytes.CryptDeriveKey Method

Derives a cryptographic key from the PasswordDeriveBytes object.

[Visual Basic]
Public Function CryptDeriveKey( _
   ByVal algname As String, _
   ByVal alghashname As String, _
   ByVal keySize As Integer, _
   ByVal rgbIV() As Byte _
) As Byte()
[C#]
public byte[] CryptDeriveKey(
 string algname,
 string alghashname,
 int keySize,
 byte[] rgbIV
);
[C++]
public: unsigned char CryptDeriveKey(
 String* algname,
 String* alghashname,
 int keySize,
 unsigned char rgbIV __gc[]
)  __gc[];
[JScript]
public function CryptDeriveKey(
   algname : String,
 alghashname : String,
 keySize : int,
 rgbIV : Byte[]
) : Byte[];

Parameters

algname
The algorithm name for which to derive the key.
alghashname
The hash algorithm name to use to derive the key.
keySize
The size of the key to derive.
rgbIV
The initialization vector (IV) to use to derive the key.

Return Value

The derived key.

Exceptions

Exception Type Condition
CryptographicException The keySize parameter is greater than 128.

-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, the default key size for the specified algorithm is used.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

PasswordDeriveBytes Class | PasswordDeriveBytes Members | System.Security.Cryptography Namespace | Cryptographic Services

Show:
© 2014 Microsoft