Wednesday 15 June 2011

client server - How do you import public key in C#? -


I can create asymmetric keys of both server and client and then I export them and try to exchange them . My problem is, and I can not find the solution, that is, I want to import the server's public key into the client program. It comes as a byte [], but I should be able to use it as an RSAParameters to be able to encrypt the data to go to the server. How do I change the byte [] to an RSAParameters type?

  Private Zero Safe ButtonNote (Object Sender, EventArgs e) {clientRSA = New RSACryptoServiceProvider (); Byte [] Client PublicKey = clientRSA.ExportCspBlob (wrong); Stm.Write (Client PublicKey, 0, clientPublicKey.Length); Stm.Read (serverPublicKey, 0, serverPublicKey.Length); }   

I know that this is not a "safe" way of doing this, because of weakness towards MITM, but I am running against a difficult school deadline and It's a brick before I can move forward, I need to come first.

Any help would be appreciated. thank you in advanced.

I will go ahead and answer it, then:

I have never done a bomb But whatever I usually do, I use RSACryptoServiceProvider.ToXMLString () to export to XML. Then I put that XML into my app in the resource and then put the RSACryptoServiceProvider.FromXMLString () key parameter back in the future use.

Do not let the public key be protected This is public

No comments:

Post a Comment