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

Hi,

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:
<result>
OK
</result>
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:
http://stackoverflow.com/questions/4874 ... 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!
davetheroyale
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Jul 28, 2011 2:39 pm

Top

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 :
http://pocket-for-android.1047292.n5.na ... l#a4454327
http://www.androidsnippets.com/encryptdecrypt-strings

I think that might solve your problem. :)

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

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests