Make sure home_dir option is not too many characters or else private keys fail.
You will notice that functions take a long time (seconds).
Commandline test yield error:
> gpg: can't connect to the agent: IPC connect call failed
Executing `gpg-agent --daemon --homedir /very/long/path/to/.gnupg` gave the error.
> socket name for '/very/long/path/to/.gnupg/S.gpg-agent.extra' is too long
So you must check that home_dir + '/S.gpg-agent.extra' is:
* < 107 characters on Linux
* < 104 on BSD 4.4