PasswordDeriveBytes.CryptDeriveKey Method
Derives a cryptographic key from the PasswordDeriveBytes object.
Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
public byte[] CryptDeriveKey( string algname, string alghashname, int keySize, byte[] rgbIV )
Parameters
- algname
- Type: System.String
The algorithm name for which to derive the key.
- alghashname
- Type: System.String
The hash algorithm name to use to derive the key.
- keySize
- Type: System.Int32
The size of the key, in bits, to derive.
- rgbIV
- Type: System.Byte[]
The initialization vector (IV) to use to derive the key.
| Exception | Condition |
|---|---|
| CryptographicException | 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. |
This code example is part of a larger example provided for the PasswordDeriveBytes class.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.