I have just finished an application, a simple messenger client and I am looking to encrypt all of the data, whether a phrase of 3 or 200 letters.
What’s the best algorithm for this type of app? At this moment I am trying to use 3DES with crypto++ (on VC10), but padding and others things seem a bit difficult.
I am not familiar with cryptography, so any helpful advice is welcome.
One important factor is how reliable the network connection is expected to be. If you don’t expect many dropped packets, or packets that arrive quite late, then you can use a stream cipher, or a symmetric block cipher in chaining mode. If you expect more network unreliability, then a symmetric block cipher in ECB mode would be more appropriate, because lost data would simply be lost data, and wouldn’t throw the whole thing out of sync. You’d want to pad each cleartext block with some random data; e.g., if each block is 64 bits, make at most 32 bits of that data, and the rest random. That way, it won’t be obvious if the same data is sent multiple times.
Generally speaking, PKC isn’t used to encrypt messages. It’s used to encrypt a random session key, which is then used with a fast symmetric algorithm such as 3DES, AES, or Blowfish.