I have python and android code for AES encryption. When I encrypt a text in android, it decrypt on python successfully but it can’t decrypt in android side. Do anyone have an
You're encoding the output after decryption.
public String decrypt_string(final String plain) throws ...
{
byte[] encryptedBytes = decrypt(Base64.decode(plain, 0));
return Base64.encodeToString( encryptedBytes, Base64.DEFAULT);
// ^--------------------| this
}
If you only encrypt printable data then you can safely remove the Base64.encodeToString
call from the above code. To return the correct type, you can do
return new String(encryptedBytes);