Well first of all, if you're transmitting the plain text password, then you don't need to do anything in Java. Just run that password through Auth::check($username, $password) and that's all you have to do.
However, you SHOULDN'T be transmitting that password as plain text, you should be two-way encrypting it first, and then sending it over SSL. You can't one-way encrypt with Bcrypt because the salt is 100% random. You will never be able to reproduce the same salt twice in order to compare the hash directly.
So what you do is this at a minimum (though this is not ideal)
However, what you really should be doing is public/private key encryption instead of encrypting with two private keys.
Basically you would generate a public / private key pair in Java one time, since Java is the app is the one doing the encrypting. Give the public key to Laravel ahead of time, and encrypt the password with the private key in Java. Assuming both are using the same algorithm, then you should be able to decrypt the password using the public key that you generated. You can store that key in a config in Laravel somewhere.
But in addition to all of this, you should also be using message signing with hash_hmac, and of course, transmitting everything over SSL.
First of all I already use a SSL connection and say it I have two thing two say about your answer (thanks for yout answer).
The first is that you mentioned AES-256, why? I think laravel use Bcrypt algorithm (http://laravel.com/docs/security#storing-passwords) , and the second is that private/public key that you propose is similar to SSL mechanism.
Thanks for your answer.
Edit: I enter in your link (laravel docs) and it mentioned AES-256. So what is the algorithm that laravel use? AES or Bcrypt?
Laravel uses Bcrypt for one-way hashing, and it uses AES for two-way encrypting.
As I said in the above post, you cannot use Bcrypt to create a determinate hash because the salt is randomized every time. You must two-way encrypt the plain text password, send that encryption to Laravel, decrypt it with laravel, and then use Laravel to check the password.
Laravel uses both for different things. For the auth class it uses bcrypt. Passwords shouldn't be reversible in the database. It also uses the Crypt class for anything else that needs to be protected but also decrypted. The default AES is rijndael-256 with CBC. You can find this at vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php
You encrypt the password on the Android app to make sure it won't be seen when transmitting, even over SSL incase of a MITM attack.
The flow @GRAgmLauncher is proposing is as follows:
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us