RSACryptoServiceProvider Constructor (Int32)

RSACryptoServiceProvider Constructor (Int32)


Initializes a new instance of the RSACryptoServiceProvider class with the specified key size.

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

new : 
        dwKeySize:int -> RSACryptoServiceProvider


Type: System.Int32

The size of the key to use in bits.

Exception Condition

The cryptographic service provider (CSP) cannot be acquired.

If no default key is found, a new key is created.

This constructor creates an Exchange key pair suitable to encrypt session keys so that they can be safely stored and exchanged with other users. The generated key corresponds to a key generated using the AT_KEYEXCHANGE value used in the unmanaged Microsoft Cryptographic API (CAPI).

The following code example creates a RSACryptoServiceProvider, generates a new key, and stores it in a key container.

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

.NET Framework
Available since 1.1
Windows Phone Silverlight
Available since 7.1
Return to top
© 2016 Microsoft