Reputation: 368
I have the encrypted password function at Android java function and Decrypt function at C# side. My problem is when I encrypt the password
Password is
No8ANfBX/0GAWJnF4v0bQwf/4UiJ7qY7rOPfrfB0XMQ=
When I pass this parameter via Rest API, My password changed to-
No8ANfBX/0GAWJnF4v0bQwf\/4UiJ7qY7rOPfrfB0XMQ= Image
So when decrypt at server,password is not same. My code for parameter pass is
public JSONObject A(String userName, String passWord, String version) throws Exception {
JSONObject result = null;
JSONObject o = new JSONObject();
JSONObject p = new JSONObject();
try {
o.put("interface", "AA");
o.put("method", "A");
p.put("userName", mapObject(userName));
p.put("passWord", mapObject(passWord));
p.put("version", mapObject(version));
o.put("parameters", p);
Log.e("Pass",String.valueOf(passWord));
Log.e("Pass",String.valueOf(mapObject(passWord)));
String s = o.toString();
Log.e("Params", String.valueOf(s));
String r = load(s);
Log.e("Params", String.valueOf(r));
result = new JSONObject(r);
} catch (Exception e) {
Log.e("Error is", String.valueOf(e));
}
return result;
}
How could I change not to add extra \ in params?
Upvotes: 1
Views: 278
Reputation: 2464
You need to pass your password with UTF-8 formate & also decrypt from server end with UTF-8
So it would be like URLEncoder.encode("No8ANfBX/0GAWJnF4v0bQwf/4UiJ7qY7rOPfrfB0XMQ=", "utf-8")
Upvotes: 1