Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Rfc2898DeriveBytes.GetBytes Method

Updated: December 2008

Returns the pseudo-random key for this object.

Namespace:  System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)
public override function 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.
ExceptionCondition
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.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Date

History

Reason

December 2008

Corrected example introduction.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.