how to encrypt the json data and send using http method in android?

i want to send my encrypted json data to server using post method in android. This is my code for sending json data. how to encrypt it?

public String Update(String userid,String uname)
String response = null; 
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();           
nameValuePairs.add(new BasicNameValuePair("user_id",userid));
nameValuePairs.add(new BasicNameValuePair("status","update"));
nameValuePairs.add(new BasicNameValuePair("user_name",uname));
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL+OPERATION_UPDATE_USERNAME);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));                 
ResponseHandler<String> responseHandler = new BasicResponseHandler();
response= httpclient.execute(httppost,responseHandler);
JSONObject jsonObj = new JSONObject(response);
catch(Exception e)
return response.trim();

Source: json

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.