Rfc2898DeriveBytes.GetBytes Method (Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns the pseudo-random key for this object.

Namespace:   System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

override GetBytes : 
        cb:int -> byte[]

Parameters

cb
Type: System.Int32

The number of pseudo-random key bytes to generate.

Return Value

Type: System.Byte[]

A byte array filled with pseudo-random key bytes.

Exception Condition
ArgumentOutOfRangeException

cb is out of range. This parameter requires a non-negative number.

The Rfc2898DeriveBytes class implements PBKDF2 functionality by using a pseudorandom number generator based on HMACSHA1. The Rfc2898DeriveBytes class takes a password, a salt, and an iteration count, and then generates keys through calls to the GetBytes method. Repeated calls to this method will not generate the same key; instead, appending two calls of the GetBytes method with a cb parameter value of 20 is the equivalent of calling the GetBytes method once with a cb parameter value of 40.

The following example shows how to use the GetBytes method to get the key for an instance of Rfc2898DeriveBytes. This code example is part of a larger example provided for the Rfc2898DeriveBytes class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: