views:

102

answers:

2

I'm using the RSACryptoServiceProvider to do some asymmetric encryption.

As per MSDN, when you instantiate a new RSACryptoServiceProvider, you get a public/private key pair generated for you that you can use.

Clearly this pair is being generated using some defaults - specifically the length. I'd like to specify my own length for greater security.

How can I do this?

Thanks in advance.

+2  A: 

One of the constructors for RSACryptoServiceProvider takes a KeySize as parameter. Do consult the docs about allowable values though.

Henk Holterman
Don't know how I missed that. Thanks.
Thenon
A: 

http://msdn.microsoft.com/en-us/library/d0c0sch1.aspx

public:
RSACryptoServiceProvider(
    int dwKeySize, // <- wow a size!
    CspParameters^ parameters
)
ralu