@@ -0,0 +1,1565 @@
+package com.growthbeat.utils;%0A%0Aimport java.io.IOException;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.apache.http.NameValuePair;%0Aimport org.apache.http.client.entity.UrlEncodedFormEntity;%0Aimport org.apache.http.message.BasicNameValuePair;%0Aimport org.apache.http.protocol.HTTP;%0A%0Apublic class HttpUtils %7B%0A%0A%09public static final UrlEncodedFormEntity makeUrlEncodedFormEntity(Map%3CString, Object%3E parameters) %7B%0A%0A%09%09List%3CNameValuePair%3E nameValuePairs = new ArrayList%3CNameValuePair%3E();%0A%0A%09%09for (Map.Entry%3CString, Object%3E entry : parameters.entrySet())%0A%09%09%09nameValuePairs.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));%0A%0A%09%09try %7B%0A%09%09%09return new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8);%0A%09%09%7D catch (UnsupportedEncodingException e) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%7D%0A%0A%09public static final Map%3CString, Object%3E makeEncryptedParameters(Map%3CString, Object%3E parameters, String base64EncodedPublicKey) %7B%0A%0A%09%09Map%3CString, Object%3E encryptedParameters = new HashMap%3CString, Object%3E();%0A%0A%09%09encryptedParameters.put(%22publicKey%22, base64EncodedPublicKey);%0A%0A%09%09UrlEncodedFormEntity urlEncodedFormEntity = makeUrlEncodedFormEntity(parameters);%0A%09%09try %7B%0A%09%09%09String urlEncodedFormEntityString = IOUtils.toString(urlEncodedFormEntity.getContent());%0A%09%09%09String data = RSAUtils.encrypt(urlEncodedFormEntityString, base64EncodedPublicKey);%0A%09%09%09encryptedParameters.put(%22data%22, data);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%09return encryptedParameters;%0A%0A%09%7D%0A%7D%0A

Add HttpUtils class and make encrypted parameter map