0

I wrote some code where I establish a TCPIP-Connection between a server and a client and managed to send data from the client to the server. Now i want to encrypt the data, with RSACryptoServiceProvider, which will be sent between both, so that the client encrypts the data and the server decrypts it for further work. Unfortunally I don't find anything how to manage this on the internet especially when it comes to the keys, because most of it runs on the same machine inside the same programm. Can somehelp me to solve my scenario in vb.net or c#?

Husky110
  • 723
  • 2
  • 10
  • 27
  • Are you planning on using certificates or something else? – Jeremy Holovacs Apr 20 '12 at 20:55
  • I think this question is too general and unconcrete to give an answer. Close. – usr Apr 20 '12 at 20:56
  • i degeneralised it, but the thing is that i found nothing about this scenario, and where could i get an answer when not here? @JeremyHolovacs not sure what you mean. if your refer to something like ssl-certificate, i would say no, not yet. – Husky110 Apr 20 '12 at 20:59
  • 1
    You could try this link http://stackoverflow.com/questions/695802/using-ssl-and-sslstream-for-peer-to-peer-authentication - it's C# but a very good pointer (and SSL but you should give it a try) – NSGaga-mostly-inactive Apr 20 '12 at 21:04
  • @NSGaga it seems to b a good start, but I want to connect in both directions (so that the client connects to the server and the server connects to a client), so (it seems to me) that i would need a certificate for each machine the program is running on, which is impossible in my case. – Husky110 Apr 20 '12 at 21:11
  • Please describe your situation in detail. BTW, the machines may change role, it is perfectly possible to put a certificate on each machine (and authenticate both ways too, using cient authentication) and perform SSL while the connections come from two directions. If you perform secret key cryptography (e.g. AES) you will have to install a key on both machines just as well. SSL (or, more precisely TLS) is the best option most of the time. – Maarten Bodewes Apr 20 '12 at 21:54

1 Answers1

0

My math teacher gave me something that is very smilar to this but that was in danish and i don't think it's a good idea to let you play with google-translate. But this is just as good :-)

Just note (stolen from my math teather, I'm not sure if the link tells it):

The number that you use need to be really big to get you the security level at a acceptable point. Actually, to be secure, you would need at least 1024 bit (preferably 2048), which corresponds to between 307 and 614 decimals.

Hope that helped :-)

deni
  • 119
  • 1
  • 1
  • 11