codeigniter - php generate public/private keypair and encrypt string (without protocols) -


let's there's shop , bank. shop wants know if client has sent money account, so:

  • the shop send's encrypted username , password bank using public key.
  • the bank decrypts information using private key.
  • if credentials right, bank sends shop's logs.

now, how do php? how generate key pair, , how decrypt/encrypt strings using them?

by way, i'm using codeigniter. maybe there's built-in functions?

pseudocode:

shop: $public_key = file_get_contents(shop/key...); $contents = encrypt($name+' '+$password,$public_key); $log = file_get_contents('bank/get_history?secure='+$contents);   bank: $private_key = file_get_contents(bank/key...); $credentials = decrypt($_get['secure'],$private_key); echo $this->model->get_logs($credentials); 


Comments