Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

RSACryptoServiceProvider Constructor (Int32, CspParameters)

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

Namespace:  System.Security.Cryptography
Assembly:  mscorlib.Extensions (in mscorlib.Extensions.dll)
[SecuritySafeCriticalAttribute]
public RSACryptoServiceProvider(
	int keySize,
	CspParameters parameters
)

Parameters

keySize
Type: System.Int32
parameters
Type: System.Security.Cryptography.CspParameters
The parameters to be passed to the cryptographic service provider (CSP).
ExceptionCondition
CryptographicException

The CSP cannot be acquired.

-or-

The key cannot be created.

This constructor creates or reuses a key container specified using the KeyContainerName field of the parameters parameter.

By default, 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).

You can create a Signature key pair suitable for authenticating (digitally signed) messages or files by setting the KeyNumber field of the parameters parameter to the Signature value. This type of key corresponds to the AT_SIGNATURE value used in CAPI.

If you create an RSACryptoServiceProvider object with the Exchange value specified and then create another RSACryptoServiceProvider object with the Signature value specified, both keys will be placed in a single container if both objects specify the same key container name.

To create a key that is compatible with stong-name signing using the RSACryptoServiceProvider class, you must create a Signature key pair.

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

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

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.