How do I secure the data transfer in android?

Quickly share your Android Code Snippets here...

How do I secure the data transfer in android?

Postby davetheroyale » Thu Jul 28, 2011 2:47 pm


I have a restful web service in netbeans which keeps usernames and passwords. On the other hand, I have android emulator running my own app. The app requests the authentication of username and password to the restful web service. The web service checks the username and password provided by the app and returns the XML file. The XML file is un-encrypted. The app reads the XML file. The XML file is as follows:
The OK is replaced by FAIL if the authentication fails.
Is there any way I can make this data transfer secure? I tried encoding the XML file but it did not work since I got Bad Padding Exception in android. I also tried encoding the XML file using another code found here: ... id-encrypt
That also doesn't work in android and I always get null when I try to decrypt the XML.
I also tried encoding only the informative bit like the 'OK' but that also fails to work. Some advice would be really helpful! Thanks!
Once Poster
Once Poster
Posts: 1
Joined: Thu Jul 28, 2011 2:39 pm


Re: How do I secure the data transfer in android?

Postby mitutitu » Wed Aug 03, 2011 11:37 pm

Hi davetheroyale,
You can use different encryption algorithms to securely transfer your data. Such as AES, bouncycastle etc.

Here are the two links : ... l#a4454327

I think that might solve your problem. :)

Android is awesome!
User avatar
Senior Developer
Senior Developer
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada


Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 6 guests