Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
What's wrong with openssl bindings ? they seem to provide what you want... –  b0fh Aug 5 '10 at 15:08
add comment

1 Answer

Check out OpenSSL and GnuPG for PHP

(I can't post more than one hyperlink so search for GnuPG on the PHP site to get more info)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.