GetBytes Method
Collapse the table of content
Expand the table of content

Rfc2898DeriveBytes.GetBytes Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Returns a pseudo-random key from a password, salt and iteration count.

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

'Declaration
Public Overrides Function GetBytes ( _
	cb As Integer _
) As 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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft