RNGCryptoServiceProvider Class
TOC
Collapse the table of content
Expand the table of content

RNGCryptoServiceProvider Class

 

Implements a cryptographic Random Number Generator (RNG) using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

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

System.Object
  System.Security.Cryptography.RandomNumberGenerator
    System.Security.Cryptography.RNGCryptoServiceProvider

[<Sealed>]
[<ComVisibleAttribute(true)>]
type RNGCryptoServiceProvider = 
    class
        inherit RandomNumberGenerator
    end

NameDescription
System_CAPS_pubmethodRNGCryptoServiceProvider()

Initializes a new instance of the RNGCryptoServiceProvider class.

System_CAPS_pubmethodRNGCryptoServiceProvider(Byte[])

Initializes a new instance of the RNGCryptoServiceProvider class.

System_CAPS_pubmethodRNGCryptoServiceProvider(CspParameters)

Initializes a new instance of the RNGCryptoServiceProvider class with the specified parameters.

System_CAPS_pubmethodRNGCryptoServiceProvider(String)

Initializes a new instance of the RNGCryptoServiceProvider class.

NameDescription
System_CAPS_pubmethodDispose()

When overridden in a derived class, releases all resources used by the current instance of the RandomNumberGenerator class.(Inherited from RandomNumberGenerator.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetBytes(Byte[])

Fills an array of bytes with a cryptographically strong sequence of random values.(Overrides RandomNumberGenerator.GetBytes(Byte[]).)

System_CAPS_pubmethodGetBytes(Byte[], Int32, Int32)

Fills the specified byte array with a cryptographically strong random sequence of values.(Inherited from RandomNumberGenerator.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetNonZeroBytes(Byte[])

Fills an array of bytes with a cryptographically strong sequence of random nonzero values.(Overrides RandomNumberGenerator.GetNonZeroBytes(Byte[]).)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_importantImportant

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the “Using an Object that Implements IDisposable” section in the IDisposable interface topic.

The following code example shows how to create a random number with the RNGCryptoServiceProvider class.

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

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

This type is thread safe.

Return to top
Show:
© 2016 Microsoft