Question: I'm looking for two functions conceptually similar to these:

```
// returns the encrypted text
string encrypt( string public_key, string pass_phrase, string text );
// returns the original text
string decrypt( string private_key, string pass_phrase, string encrypted_text );

```

where `string` could be a `char*`, a `std::string` or something easily convertible to those two. And where `public_key` and `private_key` can be basically anything, from keys generated with some commands (gpg/ssl stuff or whatever), to keys generated with other **simple** functions.

I've looked into a few cryptography libraries (libgcrypt, libgpgme, openssl ...), but it doesn't look easy at all to implement such functions with those libraries: they require a non-superficial knowledge about asymmetric encryption and a lot of code.

Anyway this task doesn't seem uncommon.
How can I implement the two functions above?

Answer: 
Unfortunately, encryption *always* requires a non-superficial knowledge of the algorithms involved. It is hard to get right. The "Handbook of Applied Cryptography" is a relatively readable guide to the various algorithms available so it's probably worth a look.

You could also try [cryptlib](http://www.cs.auckland.ac.nz/~pgut001/cryptlib/). It seems to have a well-layered design that gives you sensible defaults for a lot of parameters so you can hopefully get started without having to worry too much about the details.
When someone asks for easy encryption, I can only recommend [KeyCzar](https://github.com/google/keyczar).

It not only provides a clean interface in several languages (that can use the same keys) but also mechanisms to handle key rotations and the like.

And of course, safe defaults for the algorithms implemented so that you don't have to worry about the technical details.

Really, the better easy & safe combination I've seen so far.