new line appending on my encrypted string
I may be late in answering this, but came across with same problem. Actually problem lies here
Base64.encodeBase64String(hashPassword)
Change that line to look like this it should work:
Base64.encodeBase64String(hashPassword,Base64.NO_WRAP)
By default the Android Base64 util adds a newline character to the end of the encoded string. The Base64.NO_WRAP flag tells the util to create the encoded string without the newline character.
Check here
In case anyone needs this for any libraries using OkHttp, there's a Credentials
class you can use for Base64 encoding your username/pass
String credentials = Credentials.basic("username", "password");
request.header(HttpHeaders.AUTHORIZATION, credentials);
Use:
String encryPass = Base64.encodeBase64String(hashPassword).trim();