The Situation
I\'m working with RSA encryption in Java. I\'m trying to encrypt data on an HTC Saphire (32B) developer phone equipped with Cyanogenmod\'s
Perhaps you should do a checksum of the data and make sure it is exactly what you want to be passed into the encryption/decryption APIs.
RSA encryption (or any encryption algorithm) should work regardless of environment. However, it is possible that certain systems make different assumptions about default padding and the mode of operation. Make sure that when you are performing encryption and decryption that you fully specify not only the algorithm, but also the mode of operation (CBC, etc) and the padding. If that doesn't work, I suggest posting your code from both the device and the server so we can examine it more closely.
Edit To address your question, in Java, when you get a cipher from the crypto package, you usually do so with the following code:
Cipher cipher;
cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
The string provided to getInstance
instructs the runtime to get a cipher instance that will use the AES algorithm, the cipher block chaining mode of operation and the PKCS5 Padding. There are a number of supported algorithms and paddings. I would check out this document from Oracle for more information about encryption in Java.
To be more specific, the string you use to request a cipher is in the format
<algorithm>/<mode of operation>/<padding>
To make matters worse, despite Java providing a number of algorithms, modes of operation and paddings, not all of them will work together. You will need to read the documentation to find a configuration string that will work.