I kown RSACryptoServiceProvider can encrypted with the public key,then it can be decrypted with the private key.
Is possible to encrypt with private key and decrypted with the public key using RSACryptoServiceProvider ?
I kown RSACryptoServiceProvider can encrypted with the public key,then it can be decrypted with the private key.
Is possible to encrypt with private key and decrypted with the public key using RSACryptoServiceProvider ?
No. That's not how any public/private key encryption works. You can only encrypt with the public key, and only decrypt with the private key.
Fortunately no. You can however sign with the private key and verify the signature with the public key.
While the math involve makes sense when the key roles are reversed (and this is how signatures work), encrypting for privacy doesn't make much sense when the decryption key is well know and public.
The security of public key cryptosystems rests on the fact that the sign()/encrypt() function is a one-way function in that it would take an infeasible amount of time to decrypt it without the public key "trap-door".
Also, usually the generated keys are not the same length, although they could be. There is a lot of papers about asymmetric key length with RSA.
Performing the raw RSA operation with the private key is usually called the decryption operation (just as performing it with the public key is called the encryption operation).
It is useful to have access to this operation - for example to implement an operation that is not supported by the framework.
The operation exists: it is the DecryptValue-method, which is defined by RSACryptoServiceProvider's base-class: System.Security.Cryptography.RSA. Unfortunately, it is not supported by RSACryptoServiceProvider (since the underlying win32-api, CryptoAPI, does not support it). If you could get hold of another .NET-implementation of the RSA-class, you would be able to do it, however.
Just to clear things up a bit:
RSA can be used either for encryption (ensuring that Eve cannot read messages that Alice sends to Bob) or for signing (ensuring that if Alice sends a message to Bob, Bob knows that it was actually Alice that sent the message, and not Eve pretending to be Alice)
RSA generates a pair of keys - a public key and a private key. RSA is designed so that if you apply the public key and then apply the private key, or vice versa, you will get the same message back. And the public key cannot be derived from the private key (or vice versa).
To use RSA for encryption, Alice encrypts the message using Bob's public key. The only way to read this message is with Bob's private key, which only he has. Thus Eve can't read the message because he does not have this key. On the other hand, this provides no authentication of the source of the message. Eve can also get Bob's public key (since it's public) and send messages to Bob, pretending to be Alice.
To use RSA for signing, Alice takes a hash of the message, encrypts the hash using her own private key, and appends the result (this is the signature) to the message. Eve can of course still decrypt this using Alice's public key. However, Bob can decrypt the signature using Alice's public key and see if it matches. If it does, it must have been encrypted using Alice's private key, which only she has, so it must have come from Alice.
Now, I'm not familiar with the .NET cryptography API, so I'm not sure if it works exactly as described here. But this explanation might help you understand some of the answers you are getting.