Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asymmetric encryption with RSA

Status
Not open for further replies.

Durkin

Programmer
Joined
Nov 6, 2000
Messages
304
Location
GB
Hi. I'm pretty new to encryption(ie. about three days of scratching my head) so forgive me if I am missing something obvious. Anyway, I am using an RSACryptoServiceProvider to encrypt some data and then to decrypt it. I thought that if I used
Code:
.ToXmlString(false)
to export just the public parameters then I could use
Code:
.FromXmlString
to create another RSACryptoServiceProvider which could be used to encrypt only. Unfortunately, this is telling me 'Bad Key'. The only way I can get it to work is by sending out the private key as well which kind of defeats the purpose.
Basically, what I want to do is:
1. Generate a public/private key pair.
2. Send the public key to another machine.
3. Have the other machine encrypt the data with the public key and send it back.
4. Decrypt it using the private key.

As far as I can see, this is exactly what public key encryption is designed for so why isn't that the way these libraries were designed? Thanks in advance for any help.

Durkin
 
Never mind. I figured it out.

Durkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top