I'm looking for an asymmetric encryption library for php that can generate keys, hand out public keys and decrypt incoming messages with the corresponding private key. However, I'm a novice in the field of encryption and while googling for a usable library, I always come across all these functions that take tons of arguments of which I have no idea what they are for and how they work.
What I basically need is 3 functions like this :
list($public_key, $private_key) = generate_random_keys(); //Generate a pair of keys that I put in a database. Then hand out the public key to a certain user.
$encrypted_message = encrypt($message, $public_key); //Encrypt a message to a user with the public key associated with that user.
$decrypted_message = decrypt($encrypted_message, $private_key); //Decrypt an incoming message from a user with the private key associated with that user.
Does anyone know a simple library for that, that doesn't need all kinds of extra parameters that need to be in all kinds of formats that aren't clear to people who have no experience in these things?