I have a native Win32 client application, and a .NET web application. I’d like to be able to encrypt a string on the client (given a user supplied password), and to be able to decrypt this string on the server given the same password. My client application is 32-bit, and my .NET web application is 64-bit. On the client, I’m not able to deploy the .NET framework.
I need a simple and robust solution. By simple, I mean I’d prefer a single function call. By robust, I mean I’d like an industry standard encryption algorithm like AES, and I don’t want memory leaks.
Any suggestions on how I can accomplish this in a simple and robust way?
(Perhaps a DLL that comes in both a 32-bit and a 64-bit version? My .NET web application could P/Invoke to it, and my native application could just use it.)
I’m afraid that there is no “magic” function that will do this for both your server and the client. It is not hard to write a simple encryption / decryption scheme that will work across both though, since the algorithms are standard. Building your own will also help you to understand how the encryption and decryption works in your software.
For .NET, you can use the System.Security.Cryptography namespace and for Win32 you should use the CryptoAPI.
As for the encryption scheme, going by your use case, you can use a simple symmetric encryption scheme.
Encryption:
Decryption: