Encryption is not my forté.
I’m writing an application in Silverlight 3 which communicates with a web service to authenticate users. The web service won’t necessarily be hosted under SSL. I’m trying to find a way to reversibly encrypt the user name and password before passing them which doesn’t rely on the key and salt being hard-coded into the Silverlight assembly. It doesn’t support RSA (or any asymmetric algorithm), so I can’t use a public key from the server.
Are there any patterns for doing this sort of thing?
RSA would really be the best way to go here, but indeed there’s no implementation in either the Silverlight 2 or 3 libraries. It’s something that really should have been added in my opinion, though it’s very unlikely to happen until Silverlight 4 now. Unfortunately, a custom RSA implementation is likely to be truly painful, so it’s not quite feasible I’d expect.
Here is my proposed solution… It’s certainly not as simple as simply sending the public key from the server, but it should do the job securely still.
System.Security.Cryptographynamespace of the Silverlight BCL.Hope that helps. Let me know if you’re not clear on any of the points.